1
0
Fork 0

replaced the call to the method with an explicit call to property

Dieser Commit ist enthalten in:
Sebastian Tobie 2023-04-16 11:26:47 +02:00
Ursprung 9966a237aa
Commit 53cb14162c
1 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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()