summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorWesley Hearn <wesley.s.hearn@gmail.com>2015-10-01 14:44:10 -0400
committerWesley Hearn <wesley.s.hearn@gmail.com>2015-10-01 14:44:10 -0400
commit7082138eb6911a0322d222ba932218eccbff0c64 (patch)
tree4ab08f8e24d00ccccc22010521ce5eff9a1aa8e7 /roles
parent7be731dd7a0a5cfb5949d53a896ebd282aa7303f (diff)
parentff3fb0b84b3177b813df91cbed3d96d084bcd72c (diff)
downloadopenshift-7082138eb6911a0322d222ba932218eccbff0c64.tar.gz
openshift-7082138eb6911a0322d222ba932218eccbff0c64.tar.bz2
openshift-7082138eb6911a0322d222ba932218eccbff0c64.tar.xz
openshift-7082138eb6911a0322d222ba932218eccbff0c64.zip
Merge pull request #646 from smunilla/master
openshift_facts.py: Ansible fact for openshift version
Diffstat (limited to 'roles')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 3ab3663de..aeab7152c 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -474,6 +474,7 @@ def set_deployment_facts_if_unset(facts):
if deployment_type in ['enterprise', 'online']:
data_dir = '/var/lib/openshift'
facts['common']['data_dir'] = data_dir
+ facts['common']['version'] = get_openshift_version()
for role in ('master', 'node'):
if role in facts:
@@ -598,6 +599,19 @@ def get_current_config(facts):
return current_config
+def get_openshift_version():
+ """ Get current version of openshift on the host
+
+ Returns:
+ version: the current openshift version
+ """
+ if os.path.isfile('/usr/bin/openshift'):
+ _, output, _ = module.run_command(['/usr/bin/openshift', 'version'])
+ versions = dict(e.split(' v') for e in output.splitlines())
+ version = versions.get('openshift', '')
+
+ #TODO: acknowledge the possility of a containerized install
+ return version
def apply_provider_facts(facts, provider_facts):
""" Apply provider facts to supplied facts dict