mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user