|
|
9e975f |
From e4497c18e9fb39b4e8c022eb0898060005cf6af6 Mon Sep 17 00:00:00 2001
|
|
|
9e975f |
From: Thomas Woerner <twoerner@redhat.com>
|
|
|
9e975f |
Date: Fri, 26 Jul 2019 18:33:41 +0200
|
|
|
9e975f |
Subject: [PATCH] ipatopologysegment: Store suffix for commands in command list
|
|
|
9e975f |
|
|
|
9e975f |
With adding the domain and ca suffixes with `suffix: domain+ca` only ca
|
|
|
9e975f |
has been added as the suffix was only used from the last command. The
|
|
|
9e975f |
suffix is now stored together with the command and the argument. This
|
|
|
9e975f |
will fix this error.
|
|
|
9e975f |
|
|
|
9e975f |
Fixes: #106 (Last suffix adding twice in the list of topology segments)
|
|
|
9e975f |
---
|
|
|
9e975f |
plugins/modules/ipatopologysegment.py | 13 +++++++------
|
|
|
9e975f |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
9e975f |
|
|
|
9e975f |
diff --git a/plugins/modules/ipatopologysegment.py b/plugins/modules/ipatopologysegment.py
|
|
|
9e975f |
index d64c7be..e768f72 100644
|
|
|
9e975f |
--- a/plugins/modules/ipatopologysegment.py
|
|
|
9e975f |
+++ b/plugins/modules/ipatopologysegment.py
|
|
|
9e975f |
@@ -256,12 +256,12 @@ def main():
|
|
|
9e975f |
del args[key]
|
|
|
9e975f |
if len(args) > 1:
|
|
|
9e975f |
# cn needs to be in args always
|
|
|
9e975f |
- commands.append(["topologysegment_mod", args])
|
|
|
9e975f |
+ commands.append(["topologysegment_mod", args, suffix])
|
|
|
9e975f |
# else: Nothing to change
|
|
|
9e975f |
else:
|
|
|
9e975f |
if name is None:
|
|
|
9e975f |
args["cn"] = to_text("%s-to-%s" % (left, right))
|
|
|
9e975f |
- commands.append(["topologysegment_add", args])
|
|
|
9e975f |
+ commands.append(["topologysegment_add", args, suffix])
|
|
|
9e975f |
|
|
|
9e975f |
elif state in ["absent", "disabled"]:
|
|
|
9e975f |
# Make sure topology segment does not exist
|
|
|
9e975f |
@@ -274,7 +274,7 @@ def main():
|
|
|
9e975f |
args = {
|
|
|
9e975f |
"cn": res_find["cn"][0]
|
|
|
9e975f |
}
|
|
|
9e975f |
- commands.append(["topologysegment_del", args])
|
|
|
9e975f |
+ commands.append(["topologysegment_del", args, suffix])
|
|
|
9e975f |
|
|
|
9e975f |
elif state == "checked":
|
|
|
9e975f |
# Check if topology segment does exists
|
|
|
9e975f |
@@ -309,14 +309,15 @@ def main():
|
|
|
9e975f |
elif direction == "right-to-left":
|
|
|
9e975f |
args["right"] = True
|
|
|
9e975f |
|
|
|
9e975f |
- commands.append(["topologysegment_reinitialize", args])
|
|
|
9e975f |
+ commands.append(["topologysegment_reinitialize", args,
|
|
|
9e975f |
+ suffix])
|
|
|
9e975f |
else:
|
|
|
9e975f |
ansible_module.fail_json(msg="Unkown state '%s'" % state)
|
|
|
9e975f |
|
|
|
9e975f |
# Execute command
|
|
|
9e975f |
|
|
|
9e975f |
- for command, args in commands:
|
|
|
9e975f |
- api_command(ansible_module, command, to_text(suffix), args)
|
|
|
9e975f |
+ for command, args, _suffix in commands:
|
|
|
9e975f |
+ api_command(ansible_module, command, to_text(_suffix), args)
|
|
|
9e975f |
changed = True
|
|
|
9e975f |
|
|
|
9e975f |
except Exception as e:
|