From 0baef3c5662bcd18fec06aa0940083107e89acf2 Mon Sep 17 00:00:00 2001 From: Krzysztof Magosa Date: Mon, 5 Dec 2016 18:28:13 +0100 Subject: kubernetes: handle situation when target host does not have yaml library (fixes #3301) (#3449) --- clustering/kubernetes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'clustering/kubernetes.py') diff --git a/clustering/kubernetes.py b/clustering/kubernetes.py index 18372cb6..12c62b30 100644 --- a/clustering/kubernetes.py +++ b/clustering/kubernetes.py @@ -150,9 +150,14 @@ api_response: phase: "Active" ''' -import yaml import base64 +try: + import yaml + has_lib_yaml = True +except ImportError: + has_lib_yaml = False + ############################################################################ ############################################################################ # For API coverage, this Anislbe module provides capability to operate on @@ -325,6 +330,9 @@ def main(): required_one_of = (('file_reference', 'inline_data'),), ) + if not has_lib_yaml: + module.fail_json(msg="missing python library: yaml") + decode_cert_data(module) api_endpoint = module.params.get('api_endpoint') -- cgit v1.2.1