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) (#2546)

* better mechanism for customizing "changed" behaviour

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

* added changelog fragment

(cherry picked from commit 2a376642dd)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-05-17 20:50:43 +02:00 committed by GitHub
parent b2e4485567
commit 1f7047e725
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):