Merge pull request #7968 from bcoca/acl_fix_compare

acl module: now compares permissions correctly
This commit is contained in:
Michael DeHaan 2014-07-28 10:47:38 -04:00
commit 0221727050

View file

@ -102,6 +102,17 @@ EXAMPLES = '''
register: acl_info register: acl_info
''' '''
def normalize_permissions(p):
perms = ['-','-','-']
for char in p:
if char == 'r':
perms[0] = 'r'
if char == 'w':
perms[1] = 'w'
if char == 'x':
perms[2] = 'x'
return ''.join(perms)
def split_entry(entry): def split_entry(entry):
''' splits entry and ensures normalized return''' ''' splits entry and ensures normalized return'''
@ -129,15 +140,7 @@ def split_entry(entry):
else: else:
t = None t = None
perms = ['-','-','-'] p = normalize_permissions(p)
for char in p:
if char == 'r':
perms[0] = 'r'
if char == 'w':
perms[1] = 'w'
if char == 'x':
perms[2] = 'x'
p = ''.join(perms)
return [d,t,e,p] return [d,t,e,p]
@ -208,7 +211,7 @@ def main():
entry = module.params.get('entry') entry = module.params.get('entry')
entity = module.params.get('entity') entity = module.params.get('entity')
etype = module.params.get('etype') etype = module.params.get('etype')
permissions = module.params.get('permissions') permissions = normalize_permissions(module.params.get('permissions'))
state = module.params.get('state') state = module.params.get('state')
follow = module.params.get('follow') follow = module.params.get('follow')
default = module.params.get('default') default = module.params.get('default')