Fix bug: when deleting hosts, their services where deleted incorrectly

This commit is contained in:
Pavel Zuna authored and Rob Crittenden committed 2009-07-02 13:33:04 -04:00
1 parent 3c5988d078
commit 5e4c0014df
1 file changed
+7 -3
+7 -3
View File
@@ -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)