Skip to content

Commit 4a0cb68

Browse files
author
Slavek Kabrda
authored
Fix version comparison task when using ansible-core RC version (#446)
1 parent f6dca2a commit 4a0cb68

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tasks/pkg-redhat.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
fail:
44
msg: "The installation of the Agent on RedHat family systems using yum is not compatible with Python 3 with older Ansible versions.
55
To run this role, use a Python 2 interpreter on hosts running CentOS / RHEL < 8 or upgrade Ansible to version 2.11+"
6+
# We can't compare ansible_version.full with 2.11 in the condition below, because ansible's
7+
# `semver` and `strict` version_type don't recognize it as a valid version and the `loose`
8+
# version_type considers it to be a post-release. It seems that the best course of action
9+
# is to explicitly use just major.minor for comparison with 2.11.
10+
# See https://github.com/ansible/ansible/issues/78288
611
when: (not datadog_ignore_old_centos_python3_error)
7-
and (ansible_version.full is version("2.11", operator="lt", strict=True))
12+
and ("{}.{}".format(ansible_version.major, ansible_version.minor) is version("2.11", operator="lt", strict=True))
813
and (ansible_pkg_mgr == "yum")
914
and (ansible_facts.python.version.major | int >= 3)
1015

0 commit comments

Comments
 (0)