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:
parent
2b1eff2783
commit
2a376642dd
2 changed files with 9 additions and 1 deletions
2
changelogs/fragments/2514-mh-improved-changed.yml
Normal file
2
changelogs/fragments/2514-mh-improved-changed.yml
Normal 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).
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue