diff options
author | Wesley Hearn <wesley.s.hearn@gmail.com> | 2015-10-01 14:44:10 -0400 |
---|---|---|
committer | Wesley Hearn <wesley.s.hearn@gmail.com> | 2015-10-01 14:44:10 -0400 |
commit | 7082138eb6911a0322d222ba932218eccbff0c64 (patch) | |
tree | 4ab08f8e24d00ccccc22010521ce5eff9a1aa8e7 /roles/openshift_facts | |
parent | 7be731dd7a0a5cfb5949d53a896ebd282aa7303f (diff) | |
parent | ff3fb0b84b3177b813df91cbed3d96d084bcd72c (diff) | |
download | openshift-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/openshift_facts')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 14 |
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 |