mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
add dependency manager (#5535)
* add dependency manager * add plugins/module_utils/deps.py to BOTMETA * ditch usng OrderedDict to keep compatibility with Python 2.6 * Update plugins/module_utils/deps.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
5e5af458fb
commit
0624951e17
7 changed files with 117 additions and 69 deletions
|
@ -97,19 +97,14 @@ dest_iso:
|
|||
'''
|
||||
|
||||
import os
|
||||
import traceback
|
||||
|
||||
PYCDLIB_IMP_ERR = None
|
||||
try:
|
||||
import pycdlib
|
||||
HAS_PYCDLIB = True
|
||||
except ImportError:
|
||||
PYCDLIB_IMP_ERR = traceback.format_exc()
|
||||
HAS_PYCDLIB = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible_collections.community.general.plugins.module_utils import deps
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
with deps.declare("pycdlib"):
|
||||
import pycdlib
|
||||
|
||||
|
||||
# The upper dir exist, we only add subdirectoy
|
||||
def iso_add_dir(module, opened_iso, iso_type, dir_path):
|
||||
|
@ -306,9 +301,7 @@ def main():
|
|||
required_one_of=[('delete_files', 'add_files'), ],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
if not HAS_PYCDLIB:
|
||||
module.fail_json(
|
||||
missing_required_lib('pycdlib'), exception=PYCDLIB_IMP_ERR)
|
||||
deps.validate(module)
|
||||
|
||||
src_iso = module.params['src_iso']
|
||||
if not os.path.exists(src_iso):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue