Skip to content
Snippets Groups Projects
Unverified Commit f7866586 authored by Varun Mylaraiah's avatar Varun Mylaraiah Committed by GitHub
Browse files

Merge pull request #109 from t-woerner/topologysegment_add

ipatopologysegment: Store suffix for commands in command list
parents ad7e17ea e4497c18
No related branches found
No related tags found
No related merge requests found
...@@ -256,12 +256,12 @@ def main(): ...@@ -256,12 +256,12 @@ def main():
del args[key] del args[key]
if len(args) > 1: if len(args) > 1:
# cn needs to be in args always # cn needs to be in args always
commands.append(["topologysegment_mod", args]) commands.append(["topologysegment_mod", args, suffix])
# else: Nothing to change # else: Nothing to change
else: else:
if name is None: if name is None:
args["cn"] = to_text("%s-to-%s" % (left, right)) args["cn"] = to_text("%s-to-%s" % (left, right))
commands.append(["topologysegment_add", args]) commands.append(["topologysegment_add", args, suffix])
elif state in ["absent", "disabled"]: elif state in ["absent", "disabled"]:
# Make sure topology segment does not exist # Make sure topology segment does not exist
...@@ -274,7 +274,7 @@ def main(): ...@@ -274,7 +274,7 @@ def main():
args = { args = {
"cn": res_find["cn"][0] "cn": res_find["cn"][0]
} }
commands.append(["topologysegment_del", args]) commands.append(["topologysegment_del", args, suffix])
elif state == "checked": elif state == "checked":
# Check if topology segment does exists # Check if topology segment does exists
...@@ -309,14 +309,15 @@ def main(): ...@@ -309,14 +309,15 @@ def main():
elif direction == "right-to-left": elif direction == "right-to-left":
args["right"] = True args["right"] = True
commands.append(["topologysegment_reinitialize", args]) commands.append(["topologysegment_reinitialize", args,
suffix])
else: else:
ansible_module.fail_json(msg="Unkown state '%s'" % state) ansible_module.fail_json(msg="Unkown state '%s'" % state)
# Execute command # Execute command
for command, args in commands: for command, args, _suffix in commands:
api_command(ansible_module, command, to_text(suffix), args) api_command(ansible_module, command, to_text(_suffix), args)
changed = True changed = True
except Exception as e: except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment