Add "default" entry option back (removed in e95bcae), update will translate entry to standard parameters so compatibility with BDS is kept

pull/18777/head
quoing 9 years ago committed by Matt Clay
parent c3450d542f
commit 3a91853e7e

@ -127,23 +127,29 @@ def split_entry(entry):
''' splits entry and ensures normalized return''' ''' splits entry and ensures normalized return'''
a = entry.split(':') a = entry.split(':')
d = None
if entry.lower().startswith("d"):
d = True
a.pop(0)
if len(a) == 2: if len(a) == 2:
a.append(None) a.append(None)
t, e, p = a t, e, p = a
if t.startswith("u"): if t.lower().startswith("u"):
t = "user" t = "user"
elif t.startswith("g"): elif t.lower().startswith("g"):
t = "group" t = "group"
elif t.startswith("m"): elif t.lower().startswith("m"):
t = "mask" t = "mask"
elif t.startswith("o"): elif t.lower().startswith("o"):
t = "other" t = "other"
else: else:
t = None t = None
return [t, e, p] return [d, t, e, p]
def build_entry(etype, entity, permissions=None): def build_entry(etype, entity, permissions=None):
@ -269,16 +275,18 @@ def main():
if etype or entity or permissions: if etype or entity or permissions:
module.fail_json(msg="'entry' MUST NOT be set when 'entity', 'etype' or 'permissions' are set.") module.fail_json(msg="'entry' MUST NOT be set when 'entity', 'etype' or 'permissions' are set.")
if state == 'present' and entry.count(":") != 2: if state == 'present' and not entry.count(":") in [2, 3]:
module.fail_json(msg="'entry' MUST have 3 sections divided by ':' when 'state=present'.") module.fail_json(msg="'entry' MUST have 3 or 4 sections divided by ':' when 'state=present'.")
if state == 'absent' and entry.count(":") != 1: if state == 'absent' and not entry.count(":") in [1, 2]:
module.fail_json(msg="'entry' MUST have 2 sections divided by ':' when 'state=absent'.") module.fail_json(msg="'entry' MUST have 2 or 3 sections divided by ':' when 'state=absent'.")
if state == 'query': if state == 'query':
module.fail_json(msg="'entry' MUST NOT be set when '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 changed = False
msg = "" msg = ""

Loading…
Cancel
Save