summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2015-10-26 09:00:59 -0400
committerAndrew Butcher <abutcher@redhat.com>2015-10-26 09:00:59 -0400
commit05458ecde01c9c1ade9d1a5216bc7621a92b9d6f (patch)
treec3c93a908fb8b0fd4506ddd77bfd819c916c34bc /roles
parent7eefcf8a04251da4d10deb936273847d47ccb609 (diff)
downloadopenshift-05458ecde01c9c1ade9d1a5216bc7621a92b9d6f.tar.gz
openshift-05458ecde01c9c1ade9d1a5216bc7621a92b9d6f.tar.bz2
openshift-05458ecde01c9c1ade9d1a5216bc7621a92b9d6f.tar.xz
openshift-05458ecde01c9c1ade9d1a5216bc7621a92b9d6f.zip
Use standard library for version comparison.
Diffstat (limited to 'roles')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index d0388e6fe..ece272c78 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -20,8 +20,8 @@ EXAMPLES = '''
import ConfigParser
import copy
import os
-from ansible.runner.filter_plugins.core import version_compare
from distutils.util import strtobool
+from distutils.version import LooseVersion
def hostname_valid(hostname):
@@ -503,10 +503,13 @@ def set_deployment_facts_if_unset(facts):
data_dir = '/var/lib/openshift'
facts['common']['data_dir'] = data_dir
facts['common']['version'] = version = get_openshift_version()
- if deployment_type == 'origin':
- version_gt_3_1_or_1_1 = version_compare(version, '1.0.6', '>')
+ if version is not None:
+ if deployment_type == 'origin':
+ version_gt_3_1_or_1_1 = LooseVersion(version) > LooseVersion('1.0.6')
+ else:
+ version_gt_3_1_or_1_1 = LooseVersion(version) > LooseVersion('3.0.2')
else:
- version_gt_3_1_or_1_1 = version_compare(version, '3.0.2', '>')
+ version_gt_3_1_or_1_1 = True
facts['common']['version_greater_than_3_1_or_1_1'] = version_gt_3_1_or_1_1
for role in ('master', 'node'):