Fixed misleading helm module import failure message (#44916)
This commit is contained in:
parent
19220a0607
commit
4da87fb3ee
1 changed files with 7 additions and 7 deletions
|
@ -104,15 +104,16 @@ EXAMPLES = '''
|
|||
namespace: default
|
||||
'''
|
||||
|
||||
import traceback
|
||||
HELM_IMPORT_ERR = None
|
||||
try:
|
||||
import grpc
|
||||
from pyhelm import tiller
|
||||
from pyhelm import chartbuilder
|
||||
HAS_PYHELM = True
|
||||
except ImportError as exc:
|
||||
HAS_PYHELM = False
|
||||
except ImportError:
|
||||
HELM_IMPORT_ERR = traceback.format_exc()
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
|
||||
|
||||
def install(module, tserver):
|
||||
|
@ -182,9 +183,8 @@ def main():
|
|||
),
|
||||
supports_check_mode=True)
|
||||
|
||||
if not HAS_PYHELM:
|
||||
module.fail_json(msg="Could not import the pyhelm python module. "
|
||||
"Please install `pyhelm` package.")
|
||||
if HELM_IMPORT_ERR:
|
||||
module.fail_json(msg=missing_required_lib('pyhelm'), exception=HELM_IMPORT_ERR)
|
||||
|
||||
host = module.params['host']
|
||||
port = module.params['port']
|
||||
|
|
Loading…
Reference in a new issue