summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-10-20 22:23:15 -0400
committerJason Gerard DeRose <jderose@redhat.com>2009-10-21 03:55:59 -0600
commit914d2cd4df3b065973cc86ea2316fe8468a2de7e (patch)
tree4bfd6c421d22fe46f79dad3e600629ffb3d1d277
parentbc9684b05626cf80ff5da239d16da7d2a72c1fef (diff)
downloadfreeipa-914d2cd4df3b065973cc86ea2316fe8468a2de7e.tar.gz
freeipa-914d2cd4df3b065973cc86ea2316fe8468a2de7e.tar.xz
freeipa-914d2cd4df3b065973cc86ea2316fe8468a2de7e.zip
Require that a host exist before creating a service for it.
-rw-r--r--ipalib/plugins/service.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index 782948a5..481a9f6d 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