summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/host.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-05-08 17:42:54 -0400
committerRob Crittenden <rcritten@redhat.com>2009-05-13 14:17:21 -0400
commit5e3cdb96432d820fcfcb0f951f9670736c1e5c6c (patch)
tree05e6d356ce82e316e997a500b44884a87adccfba /ipalib/plugins/host.py
parent014f3ff1c63eeff6d6bc36cbdce7f082676d6925 (diff)
downloadfreeipa-5e3cdb96432d820fcfcb0f951f9670736c1e5c6c.tar.gz
freeipa-5e3cdb96432d820fcfcb0f951f9670736c1e5c6c.tar.xz
freeipa-5e3cdb96432d820fcfcb0f951f9670736c1e5c6c.zip
Remove all services when a host is removed Revoke certificate (if any) when a service is removed
Diffstat (limited to 'ipalib/plugins/host.py')
-rw-r--r--ipalib/plugins/host.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index a7a590b6..c136ccab 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -140,7 +140,7 @@ class host_add(crud.Add):
current = util.get_current_principal()
if not current:
- raise errors.NotFound('Unable to determine current user')
+ raise errors.NotFound(reason='Unable to determine current user')
kw['enrolledby'] = ldap.find_entry_dn("krbPrincipalName", current, "posixAccount")
# Get our configuration
@@ -186,6 +186,17 @@ class host_del(crud.Del):
"""
ldap = self.api.Backend.ldap
dn = get_host(hostname)
+
+ # Remove all service records for this host
+ services=api.Command['service_find'](hostname, **{})
+
+ counter = services[0]
+ services = services[1:]
+ if counter > 0:
+ for s in services:
+ principal = s.get('krbprincipalname').decode('UTF-8')
+ api.Command['service_del'](principal, **{})
+
return ldap.delete(dn)
def output_for_cli(self, textui, result, *args, **options):
"""