From 53cb14162c1eca5393c08327135570d47d1020ef Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 16 Apr 2023 11:26:47 +0200 Subject: [PATCH] replaced the call to the method with an explicit call to property --- plugins/module_utils/module.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index cab59df..390bd2c 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -86,16 +86,16 @@ class AnsibleModule(object): raise KeyError() return self.params[key] - @property - def changed(self): - """returns if changes were detected/made""" + def changed_get(self): + """value that shows if changes were detected/made""" return self.result["changed"] @changed.setter def changed_set(self, value): - """sets the changed value. this is always converted to bool""" self.result["changed"] = not not value + changed = property(changed_get, changed_set, None, changed_get.__doc__) + def prepare(self): raise NotImplementedError() @@ -109,6 +109,7 @@ class AnsibleModule(object): """This calls the module. first prepare is called and then check or run, depending on the check mode. If an exception is raised this is catched and the module automatically fails with an traceback""" self.prepare() + print(self.changed) try: if self.module.check_mode: self.check()