mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
module_helper - implemented classmethod to start the module (#3206)
* module_helper - implemented classmethod to start the module plus minor change * rolled back the __changed__() method * added changelog fragment * Update plugins/module_utils/mh/base.py Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua> * no capt Piccards allowed in the base class * removed extra piccards Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
This commit is contained in:
parent
f19e191467
commit
41101e55a0
4 changed files with 8 additions and 4 deletions
2
changelogs/fragments/3206-mh-classmethod.yaml
Normal file
2
changelogs/fragments/3206-mh-classmethod.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- module_helper module_utils - added classmethod to trigger the execution of MH modules (https://github.com/ansible-collections/community.general/pull/3206).
|
|
@ -63,3 +63,7 @@ class ModuleHelperBase(object):
|
||||||
if 'failed' not in output:
|
if 'failed' not in output:
|
||||||
output['failed'] = False
|
output['failed'] = False
|
||||||
self.module.exit_json(changed=self.has_changed(), **output)
|
self.module.exit_json(changed=self.has_changed(), **output)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, module=None):
|
||||||
|
cls(module).run()
|
||||||
|
|
|
@ -248,8 +248,7 @@ class CPANMinus(CmdMixin, ModuleHelper):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cpanm = CPANMinus()
|
CPANMinus.execute()
|
||||||
cpanm.run()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -277,8 +277,7 @@ class XFConfProperty(CmdMixin, StateMixin, ModuleHelper):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
xfconf = XFConfProperty()
|
XFConfProperty.execute()
|
||||||
xfconf.run()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue