From c212b43516cb870bbaa86c607dde33f373768043 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Fri, 26 Jul 2019 19:30:11 +0200
Subject: [PATCH] ipatopologysegment: Fail for missing entry with reinitialized
Currently it is ignored if the entry for reinitialized can not be found if
the name or left and right are not correct. Now there is a failure in this
case.
Fixes: #107 (Reinitialize are failed to find the node in ipatopology ..)
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
---
plugins/modules/ipatopologysegment.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/plugins/modules/ipatopologysegment.py b/plugins/modules/ipatopologysegment.py
index e768f72..e506b53 100644
--- a/plugins/modules/ipatopologysegment.py
+++ b/plugins/modules/ipatopologysegment.py
@@ -311,6 +311,18 @@ def main():
commands.append(["topologysegment_reinitialize", args,
suffix])
+ else:
+ params = []
+ if name is not None:
+ params.append("name=%s" % name)
+ if left is not None:
+ params.append("left=%s" % left)
+ if right is not None:
+ params.append("right=%s" % right)
+ ansible_module.fail_json(
+ msg="No entry '%s' for suffix '%s'" %
+ (",".join(params), suffix))
+
else:
ansible_module.fail_json(msg="Unkown state '%s'" % state)