mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-08 17:29:11 -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
|
@ -9,13 +9,17 @@ __metaclass__ = type
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils._text import to_text, to_native
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
|
||||
CS_IMP_ERR = None
|
||||
try:
|
||||
from cs import CloudStack, CloudStackException, read_config
|
||||
HAS_LIB_CS = True
|
||||
except ImportError:
|
||||
CS_IMP_ERR = traceback.format_exc()
|
||||
HAS_LIB_CS = False
|
||||
|
||||
CS_HYPERVISORS = [
|
||||
|
@ -53,7 +57,7 @@ class AnsibleCloudStack:
|
|||
|
||||
def __init__(self, module):
|
||||
if not HAS_LIB_CS:
|
||||
module.fail_json(msg="python library cs required: pip install cs")
|
||||
module.fail_json(msg=missing_required_lib('cs'), exception=CS_IMP_ERR)
|
||||
|
||||
self.result = {
|
||||
'changed': False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue