replaced the call to the method with an explicit call to property
Dieser Commit ist enthalten in:
Ursprung
9966a237aa
Commit
53cb14162c
|
@ -86,16 +86,16 @@ class AnsibleModule(object):
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
return self.params[key]
|
return self.params[key]
|
||||||
|
|
||||||
@property
|
def changed_get(self):
|
||||||
def changed(self):
|
"""value that shows if changes were detected/made"""
|
||||||
"""returns if changes were detected/made"""
|
|
||||||
return self.result["changed"]
|
return self.result["changed"]
|
||||||
|
|
||||||
@changed.setter
|
@changed.setter
|
||||||
def changed_set(self, value):
|
def changed_set(self, value):
|
||||||
"""sets the changed value. this is always converted to bool"""
|
|
||||||
self.result["changed"] = not not value
|
self.result["changed"] = not not value
|
||||||
|
|
||||||
|
changed = property(changed_get, changed_set, None, changed_get.__doc__)
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
raise NotImplementedError()
|
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.
|
"""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"""
|
If an exception is raised this is catched and the module automatically fails with an traceback"""
|
||||||
self.prepare()
|
self.prepare()
|
||||||
|
print(self.changed)
|
||||||
try:
|
try:
|
||||||
if self.module.check_mode:
|
if self.module.check_mode:
|
||||||
self.check()
|
self.check()
|
||||||
|
|
Laden…
In neuem Issue referenzieren