mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-27 19:39:13 -07:00
Multiple modules using ModuleHelper (#4674)
* Multiple modules using ModuleHelper Replaced raising exception with calling method do_raise() in MH. Removed the importing of the exception class. * added changelog fragment
This commit is contained in:
parent
319c29c2a2
commit
6052776de1
6 changed files with 36 additions and 35 deletions
|
@ -99,7 +99,7 @@ msg:
|
|||
import os
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
CmdModuleHelper, ArgFormat, ModuleHelperException
|
||||
CmdModuleHelper, ArgFormat
|
||||
)
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ class MkSysB(CmdModuleHelper):
|
|||
|
||||
def __init_module__(self):
|
||||
if not os.path.isdir(self.vars.storage_path):
|
||||
raise ModuleHelperException("Storage path %s is not valid." % self.vars.storage_path)
|
||||
self.do_raise("Storage path %s is not valid." % self.vars.storage_path)
|
||||
|
||||
def __run__(self):
|
||||
if not self.module.check_mode:
|
||||
|
@ -149,7 +149,7 @@ class MkSysB(CmdModuleHelper):
|
|||
|
||||
def process_command_output(self, rc, out, err):
|
||||
if rc != 0:
|
||||
raise ModuleHelperException("mksysb failed.")
|
||||
self.do_raise("mksysb failed.")
|
||||
self.vars.msg = out
|
||||
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ RETURN = '''
|
|||
'''
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import (
|
||||
CmdStateModuleHelper, ArgFormat, ModuleHelperException
|
||||
CmdStateModuleHelper, ArgFormat
|
||||
)
|
||||
|
||||
|
||||
|
@ -216,7 +216,7 @@ class XFConfProperty(CmdStateModuleHelper):
|
|||
self.vars.meta('value').set(initial_value=self.vars.previous_value)
|
||||
|
||||
if self.module.params['disable_facts'] is False:
|
||||
raise ModuleHelperException('Returning results as facts has been removed. Stop using disable_facts=false.')
|
||||
self.do_raise('Returning results as facts has been removed. Stop using disable_facts=false.')
|
||||
|
||||
def process_command_output(self, rc, out, err):
|
||||
if err.rstrip() == self.does_not:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue