Bug 1642361 - openshift-ansible check prerequisite.yml fails prerequisite ansible version
Summary: openshift-ansible check prerequisite.yml fails prerequisite ansible version
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.11.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.11.z
Assignee: Antoni Segura Puimedon
QA Contact: Weihua Meng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-24 08:58 UTC by jliberma@redhat.com
Modified: 2018-12-12 14:16 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: OpenShift-Ansible's version check was using alphanumeric order instead of semantic versioning order. Consequence: 2.5.10 would be considered not to meet a requirement for a version newer than 2.5.6. Fix: Do semantic versioning check. Result: 2.5.10 is rightly recognized as newer than 2.5.6
Clone Of:
Environment:
Last Closed: 2018-12-12 14:15:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift openshift-ansible pull 10484 0 None None None 2018-10-24 10:38:39 UTC
Red Hat Product Errata RHBA-2018:3743 0 None None None 2018-12-12 14:16:01 UTC

Description jliberma@redhat.com 2018-10-24 08:58:52 UTC
Description of problem:

openshift-ansible fails prerequisite check for Ansible version because it uses a string compare instead of strict_checking.

For example, if the requirement is version 5.7 or higher, and you have version 5.10, the check will fail because the string value of 5.10 is less than 5.7.

Version-Release number of the following components:
rpm -q openshift-ansible
openshift-ansible-3.11.22-1.git.1.c4bb7a6.el7.noarch
rpm -q ansible
ansible-2.5.10-1.el7ae.noarch
ansible --version
ansible 2.5.10
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, May 31 2018, 09:41:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

How reproducible:

Every time

Steps to Reproduce:
1. Install Ansible 5.10
2. Install OpenShift-Ansible 
3. ansible-playbook --user openshift -i /usr/share/ansible/openshift-ansible/playbooks/openstack/inventory.py -i inventory /usr/share/ansible/openshift-ansible/playbooks/openstack/openshift-cluster/prerequisites.yml

Actual results:

FATAL: Current Ansible version (2.5.10) is not supported. Supported versions: 2.5.7 or newer

Expected results:

(works)

Additional info:

To fix: (/usr/share/ansible/openshift-ansible/roles/lib_utils/callback_plugins/aa_version_requirement.py)

diff --git a/roles/lib_utils/callback_plugins/aa_version_requirement.py b/roles/lib_utils/callback_plugins/aa_version_requirement.py
index 175c99f91..fc594df60 100644
--- a/roles/lib_utils/callback_plugins/aa_version_requirement.py
+++ b/roles/lib_utils/callback_plugins/aa_version_requirement.py
@@ -7,6 +7,8 @@ The plugin is named with leading `aa_` to ensure this plugin is loaded
 first (alphanumerically) by Ansible.
 """
 import sys
+from distutils import version
+
 from ansible import __version__
 
 if __version__ < '2.0':
@@ -29,13 +31,13 @@ else:
  
 # Set to minimum required Ansible version
-REQUIRED_VERSION = '2.5.7'
+REQUIRED_VERSION = version.StrictVersion('2.5.7')
 DESCRIPTION = "Supported versions: %s or newer" % REQUIRED_VERSION
 
 def version_requirement(version):
     """Test for minimum required version"""
-    return version >= REQUIRED_VERSION
+    return version.StrictVersion(version) >= REQUIRED_VERSION

Comment 1 Luis Tomas Bolivar 2018-10-24 10:39:46 UTC
Solution for the problem is on this PR: https://github.com/openshift/openshift-ansible/pull/10484

Comment 5 Weihua Meng 2018-11-28 06:58:53 UTC
Fixed.

openshift-ansible-3.11.44-1.git.0.11d174e.el7.noarch

ansible-2.5.10-1.el7ae.noarch
ansible-2.5.11-1.el7ae.noarch

Comment 7 errata-xmlrpc 2018-12-12 14:15:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3743


Note You need to log in before you can comment on or make changes to this bug.