mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00: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:
@@ -264,14 +264,17 @@ EXAMPLES = '''
|
||||
|
||||
import os
|
||||
import time
|
||||
import traceback
|
||||
|
||||
LINODE_IMP_ERR = None
|
||||
try:
|
||||
from linode import api as linode_api
|
||||
HAS_LINODE = True
|
||||
except ImportError:
|
||||
LINODE_IMP_ERR = traceback.format_exc()
|
||||
HAS_LINODE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
|
||||
|
||||
def randompass():
|
||||
@@ -608,7 +611,7 @@ def main():
|
||||
)
|
||||
|
||||
if not HAS_LINODE:
|
||||
module.fail_json(msg='linode-python required for this module')
|
||||
module.fail_json(msg=missing_required_lib('linode-python'), exception=LINODE_IMP_ERR)
|
||||
|
||||
state = module.params.get('state')
|
||||
api_key = module.params.get('api_key')
|
||||
|
||||
Reference in New Issue
Block a user