mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Final round of moving modules to new import error msg (#51852)
* Final round of moving modules to new import error msg * readd URL to jenkins install guide * fix unit tests
This commit is contained in:
parent
ffbc9d99de
commit
a39c4ad464
42 changed files with 292 additions and 150 deletions
|
@ -113,14 +113,17 @@ cloudstack_user_data:
|
|||
'''
|
||||
|
||||
import os
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
import traceback
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils.facts import ansible_collector, default_collectors
|
||||
|
||||
YAML_IMP_ERR = None
|
||||
try:
|
||||
import yaml
|
||||
HAS_LIB_YAML = True
|
||||
except ImportError:
|
||||
YAML_IMP_ERR = traceback.format_exc()
|
||||
HAS_LIB_YAML = False
|
||||
|
||||
CS_METADATA_BASE_URL = "http://%s/latest/meta-data"
|
||||
|
@ -231,7 +234,7 @@ def main():
|
|||
)
|
||||
|
||||
if not HAS_LIB_YAML:
|
||||
module.fail_json(msg="missing python library: yaml")
|
||||
module.fail_json(msg=missing_required_lib("PyYAML"), exception=YAML_IMP_ERR)
|
||||
|
||||
cs_facts = CloudStackFacts().run()
|
||||
cs_facts_result = dict(changed=False, ansible_facts=cs_facts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue