From 914d2cd4df3b065973cc86ea2316fe8468a2de7e Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 20 Oct 2009 22:23:15 -0400 Subject: Require that a host exist before creating a service for it. --- ipalib/plugins/service.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ipalib/plugins') diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py index 782948a5a..481a9f6dc 100644 --- a/ipalib/plugins/service.py +++ b/ipalib/plugins/service.py @@ -141,6 +141,11 @@ class service_add(LDAPCreate): if service.lower() == 'host' and not options['force']: raise errors.HostService() + try: + (hostdn, hostentry) = api.Command['host_show'](hostname, **{}) + except errors.NotFound: + raise errors.NotFound(reason="The host '%s' does not exist to add a service to." % hostname) + cert = entry_attrs.get('usercertificate') if cert: # FIXME: should be in a normalizer: need to fix normalizers -- cgit