From 5e4c0014df46cd9a00ec8b8099533522cbbc1448 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Thu, 2 Jul 2009 10:04:28 +0200 Subject: Fix bug: when deleting hosts, their services where deleted incorrectly --- ipalib/plugins/host.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ipalib') diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py index 472f8262..c1fa987b 100644 --- a/ipalib/plugins/host.py +++ b/ipalib/plugins/host.py @@ -28,6 +28,7 @@ import sys from ipalib import api, crud, errors, util from ipalib import Object from ipalib import Str, Flag +from ipalib.plugins.service import split_principal _container_dn = api.env.container_host _default_attributes = [ @@ -210,12 +211,15 @@ class host_del(crud.Delete): """ ldap = self.api.Backend.ldap2 dn = get_host(ldap, hostname) + hostname = hostname.lower() # Remove all service records for this host (services, truncated) = api.Command['service_find'](hostname) - for (dn, entry_attrs) in services: - principal = entry_attrs['krbprincipalname'] - api.Command['service_del'](principal) + for (dn_, entry_attrs) in services: + principal = entry_attrs['krbprincipalname'][0] + (service, hostname_, realm) = split_principal(principal) + if hostname_.lower() == hostname: + api.Command['service_del'](principal) ldap.delete_entry(dn) -- cgit