1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ModuleHelper - better mechanism for customizing "changed" behaviour (#2514)

* better mechanism for customizing "changed" behaviour

* dont drink and code: silly mistake from late at night

* added changelog fragment
This commit is contained in:
Alexei Znamensky 2021-05-18 06:28:21 +12:00 committed by GitHub
parent 2b1eff2783
commit 2a376642dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ModuleHelper module utils - improved mechanism for customizing the calculation of ``changed`` (https://github.com/ansible-collections/community.general/pull/2514).

View file

@ -33,9 +33,15 @@ class ModuleHelperBase(object):
def __quit_module__(self):
pass
def __changed__(self):
raise NotImplementedError()
@property
def changed(self):
return self._changed
try:
return self.__changed__()
except NotImplementedError:
return self._changed
@changed.setter
def changed(self, value):