summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src
diff options
context:
space:
mode:
authorSteve Milner <smilner@redhat.com>2017-06-19 15:00:09 -0400
committerSteve Milner <smilner@redhat.com>2017-06-19 16:48:45 -0400
commit7964f0382135910df70f0475f62a4018c4a570ab (patch)
tree6c162042f05d9994127cf85628ffa068ee66dd4d /roles/lib_openshift/src
parentf6de39e8f38d77565481bc9709ec0be5d9d4c6ab (diff)
downloadopenshift-7964f0382135910df70f0475f62a4018c4a570ab.tar.gz
openshift-7964f0382135910df70f0475f62a4018c4a570ab.tar.bz2
openshift-7964f0382135910df70f0475f62a4018c4a570ab.tar.xz
openshift-7964f0382135910df70f0475f62a4018c4a570ab.zip
oc_atomic_container: Require 1.17.2
The oc_atomic_container module requires features only available in atomic versions 1.17.2+. Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1461662
Diffstat (limited to 'roles/lib_openshift/src')
-rw-r--r--roles/lib_openshift/src/ansible/oc_atomic_container.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/roles/lib_openshift/src/ansible/oc_atomic_container.py b/roles/lib_openshift/src/ansible/oc_atomic_container.py
index 1a5ab6869..16848e9c6 100644
--- a/roles/lib_openshift/src/ansible/oc_atomic_container.py
+++ b/roles/lib_openshift/src/ansible/oc_atomic_container.py
@@ -1,8 +1,11 @@
# pylint: skip-file
# flake8: noqa
-# pylint: disable=wrong-import-position,too-many-branches,invalid-name
+# pylint: disable=wrong-import-position,too-many-branches,invalid-name,no-name-in-module, import-error
import json
+
+from distutils.version import StrictVersion
+
from ansible.module_utils.basic import AnsibleModule
@@ -127,9 +130,15 @@ def main():
)
# Verify that the platform supports atomic command
- rc, _, err = module.run_command('atomic -v', check_rc=False)
+ rc, version_out, err = module.run_command('atomic -v', check_rc=False)
if rc != 0:
module.fail_json(msg="Error in running atomic command", err=err)
+ # This module requires atomic version 1.17.2 or later
+ atomic_version = StrictVersion(version_out.replace('\n', ''))
+ if atomic_version < StrictVersion('1.17.2'):
+ module.fail_json(
+ msg="atomic version 1.17.2+ is required",
+ err=str(atomic_version))
try:
core(module)