diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2016-06-10 10:21:19 -0300 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2016-06-10 10:42:07 -0300 |
commit | 755a48c4ebf1061ce19892e5378fba769027bfc1 (patch) | |
tree | 182db7335a8e6c0182d19f23a00ce7f871c9569e /roles/openshift_facts/library | |
parent | bcf414e8b559d35909f26420d9e7dec3cd0a1897 (diff) | |
download | openshift-755a48c4ebf1061ce19892e5378fba769027bfc1.tar.gz openshift-755a48c4ebf1061ce19892e5378fba769027bfc1.tar.bz2 openshift-755a48c4ebf1061ce19892e5378fba769027bfc1.tar.xz openshift-755a48c4ebf1061ce19892e5378fba769027bfc1.zip |
Fix version unset bug, and set common ver fact on containerized nodes.
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 856dcbdb8..9d7705af7 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1139,11 +1139,21 @@ def get_openshift_version(facts): _, output, _ = module.run_command(['/usr/local/bin/openshift', 'version']) version = parse_openshift_version(output) elif 'node' in facts and 'common' in facts and 'is_containerized' in facts['common']: - _, output, _ = module.run_command(['docker', 'run', '--rm', facts['common']['cli_image'], 'version']) - version = parse_openshift_version(output) + version = get_containerized_node_openshift_version(facts) return version +def get_containerized_node_openshift_version(facts): + node_svc = "%s-node" % facts['common']['service_type'] + rc, _, _ = module.run_command(['systemctl', 'is-active', node_svc]) + if rc > 0: + # Node service not running or doesn't exist: + return None + # Node service running, exec in and get the version: + _, output, _ = module.run_command(['docker', 'exec', '-ti', node_svc, 'openshift', 'version']) + return parse_openshift_version(output) + + def parse_openshift_version(output): """ Apply provider facts to supplied facts dict |