mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Remove all references to deleted indirect map from parent map
An attempt to do this was already coded but the wrong argument was used. It was passing in the location name and not the map name so the map wouldn't be completely removed. Include a test to verify that the map is gone after removing it by calling automountlocation-tofiles which will fail if the map wasn't properly removed. Fixes: https://pagure.io/freeipa/issue/9397 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
82b129fe76
commit
d98d5e4751
@ -412,7 +412,7 @@ class automountmap_del(LDAPDelete):
|
||||
# delete optional parental connection (direct maps may not have this)
|
||||
try:
|
||||
entry_attrs = ldap.find_entry_by_attr(
|
||||
'automountinformation', keys[0], 'automount',
|
||||
'automountinformation', keys[1], 'automount',
|
||||
base_dn=DN(self.obj.container_dn, api.env.basedn)
|
||||
)
|
||||
ldap.delete_entry(entry_attrs)
|
||||
|
@ -479,7 +479,32 @@ class test_automount_indirect(AutomountTest):
|
||||
with pytest.raises(errors.NotFound):
|
||||
api.Command['automountmap_show'](self.locname, self.mapname)
|
||||
|
||||
def test_5_automountlocation_del(self):
|
||||
def test_5_automountmap_add_indirect(self):
|
||||
"""
|
||||
Add back the indirect map
|
||||
"""
|
||||
res = api.Command['automountmap_add_indirect'](
|
||||
self.locname, self.mapname, **self.map_kw)['result']
|
||||
assert res
|
||||
assert_attr_equal(res, 'automountmapname', self.mapname)
|
||||
|
||||
def test_6_automountmap_del(self):
|
||||
"""
|
||||
Remove the indirect map without removing the key first.
|
||||
"""
|
||||
res = api.Command['automountmap_del'](
|
||||
self.locname, self.mapname)['result']
|
||||
assert res
|
||||
assert not res['failed']
|
||||
|
||||
# Verify that it is gone
|
||||
with pytest.raises(errors.NotFound):
|
||||
api.Command['automountmap_show'](self.locname, self.mapname)
|
||||
|
||||
# automountlocation-tofiles should succeed if the map was removed
|
||||
api.Command['automountlocation_tofiles'](self.locname)
|
||||
|
||||
def test_7_automountlocation_del(self):
|
||||
"""
|
||||
Remove the location.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user