Fix recursive cases on linux_acl.absent state

This commit is contained in:
Pablo Suárez Hernández 2018-09-06 11:36:27 +01:00
parent 4a018490b8
commit a0ed59dad9
No known key found for this signature in database
GPG key ID: A9683F02B512C911
2 changed files with 13 additions and 2 deletions

View file

@ -210,7 +210,18 @@ def absent(name, acl_type, acl_name='', perms='', recurse=False):
except (AttributeError, IndexError, StopIteration, KeyError):
user = None
if user:
need_refresh = False
for path in __current_perms:
acl_found = False
for user_acl in __current_perms[path].get(_acl_type, []):
if _search_name in user_acl:
acl_found = True
break
if acl_found:
need_refresh = True
break
if user or need_refresh:
ret['comment'] = 'Removing permissions'
if __opts__['test']:

View file

@ -234,7 +234,7 @@ class LinuxAclTestCase(TestCase, LoaderModuleMockMixin):
'changes': {}}
mock = MagicMock(side_effect=[
{name: {acl_type: [{acl_name: {'octal': 'rwx'}}]}, name+"/foo": {acl_type: [{acl_name: {'octal': 'A'}}]}}
{name: {acl_type: [{acl_name: {'octal': 7}}]}, name+"/foo": {acl_type: [{acl_name: {'octal': 'A'}}]}}
])
with patch.dict(linux_acl.__salt__, {'acl.getfacl': mock}):
with patch.dict(linux_acl.__opts__, {'test': True}):