summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@redhat.com>2016-11-28 19:35:39 +0100
committerMichael Scherer <misc@redhat.com>2016-11-28 19:35:39 +0100
commit698ad269005c0d053aafdb9fd1f29683f13d1398 (patch)
tree3890730aabc48eea77da5614507b39d7b8f11191
parent420e6f1359818187e3bb409fe8bc93759c86883a (diff)
downloadopenshift-698ad269005c0d053aafdb9fd1f29683f13d1398.tar.gz
openshift-698ad269005c0d053aafdb9fd1f29683f13d1398.tar.bz2
openshift-698ad269005c0d053aafdb9fd1f29683f13d1398.tar.xz
openshift-698ad269005c0d053aafdb9fd1f29683f13d1398.zip
Gracefully handle OpenSSL module absence
Should fix #2869
-rw-r--r--filter_plugins/oo_filters.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 38bc3ad6b..997634777 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -10,7 +10,14 @@ from collections import Mapping
from distutils.util import strtobool
from distutils.version import LooseVersion
from operator import itemgetter
-import OpenSSL.crypto
+
+HAS_OPENSSL=False
+try:
+ import OpenSSL.crypto
+ HAS_OPENSSL=True
+except ImportError:
+ pass
+
import os
import pdb
import pkg_resources
@@ -516,6 +523,9 @@ class FilterModule(object):
if not isinstance(internal_hostnames, list):
raise errors.AnsibleFilterError("|failed expects internal_hostnames is list")
+ if not HAS_OPENSSL:
+ raise errors.AnsibleFilterError("|missing OpenSSL python bindings")
+
for certificate in certificates:
if 'names' in certificate.keys():
continue