From 3a91853e7ea1ab65bf45a8b6f5ec0d22a550096b Mon Sep 17 00:00:00 2001 From: quoing Date: Tue, 8 Dec 2015 16:31:25 +0100 Subject: [PATCH] Add "default" entry option back (removed in e95bcae), update will translate entry to standard parameters so compatibility with BDS is kept --- lib/ansible/modules/files/acl.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/files/acl.py b/lib/ansible/modules/files/acl.py index ad0f4607609..91687f05eb5 100644 --- a/lib/ansible/modules/files/acl.py +++ b/lib/ansible/modules/files/acl.py @@ -127,23 +127,29 @@ def split_entry(entry): ''' splits entry and ensures normalized return''' a = entry.split(':') + + d = None + if entry.lower().startswith("d"): + d = True + a.pop(0) + if len(a) == 2: a.append(None) t, e, p = a - if t.startswith("u"): + if t.lower().startswith("u"): t = "user" - elif t.startswith("g"): + elif t.lower().startswith("g"): t = "group" - elif t.startswith("m"): + elif t.lower().startswith("m"): t = "mask" - elif t.startswith("o"): + elif t.lower().startswith("o"): t = "other" else: t = None - return [t, e, p] + return [d, t, e, p] def build_entry(etype, entity, permissions=None): @@ -269,16 +275,18 @@ def main(): if etype or entity or permissions: module.fail_json(msg="'entry' MUST NOT be set when 'entity', 'etype' or 'permissions' are set.") - if state == 'present' and entry.count(":") != 2: - module.fail_json(msg="'entry' MUST have 3 sections divided by ':' when 'state=present'.") + if state == 'present' and not entry.count(":") in [2, 3]: + module.fail_json(msg="'entry' MUST have 3 or 4 sections divided by ':' when 'state=present'.") - if state == 'absent' and entry.count(":") != 1: - module.fail_json(msg="'entry' MUST have 2 sections divided by ':' when 'state=absent'.") + if state == 'absent' and not entry.count(":") in [1, 2]: + module.fail_json(msg="'entry' MUST have 2 or 3 sections divided by ':' when 'state=absent'.") if state == 'query': module.fail_json(msg="'entry' MUST NOT be set when 'state=query'.") - etype, entity, permissions = split_entry(entry) + default_flag, etype, entity, permissions = split_entry(entry) + if default_flag != None: + default = default_flag changed = False msg = ""