mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 23:31:25 -07:00
Bubble up import exception content for k8s module (#50657)
* Bubble up import exception content for k8s module Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us> * Track down other places import exception is reported * Add changelog fragment
This commit is contained in:
parent
35caebd036
commit
09bfe42a5c
4 changed files with 13 additions and 6 deletions
|
@ -203,8 +203,10 @@ try:
|
|||
from openshift.dynamic import DynamicClient
|
||||
from openshift.dynamic.exceptions import NotFoundError
|
||||
HAS_K8S_MODULE_HELPER = True
|
||||
except ImportError as exc:
|
||||
k8s_import_exception = None
|
||||
except ImportError as e:
|
||||
HAS_K8S_MODULE_HELPER = False
|
||||
k8s_import_exception = e
|
||||
|
||||
try:
|
||||
import yaml
|
||||
|
@ -219,7 +221,7 @@ class KubernetesLookup(K8sAnsibleMixin):
|
|||
|
||||
if not HAS_K8S_MODULE_HELPER:
|
||||
raise Exception(
|
||||
"Requires the OpenShift Python client. Try `pip install openshift`"
|
||||
"Requires the OpenShift Python client. Try `pip install openshift`. Detail: {0}".format(k8s_import_exception)
|
||||
)
|
||||
|
||||
if not HAS_YAML:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue