Use StrictVersion class to avoid wrong version comparisons that happen in some cases using LooseVersion class which results in TypeError (#10178)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.16) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled

* Use StrictVersion class to avoid wrong version comparisons that happen in some cases using LooseVersion class

* Refactor code

* Add changelog for PR number 10178

* Update changelog to be more precise

* Use LooseVersion instead of StrictVersion to check cobbler's version in cobbler system module

* Update PR 10178 changelog description to be more accurate
This commit is contained in:
umiruka 2025-06-02 20:42:33 +02:00 committed by Felix Fontein
parent d922eaebce
commit ce1dd0c78f
2 changed files with 4 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- cobbler_system - update minimum version number to avoid wrong comparisons that happen in some cases using LooseVersion class which results in TypeError (https://github.com/ansible-collections/community.general/issues/8506, https://github.com/ansible-collections/community.general/pull/10145, https://github.com/ansible-collections/community.general/pull/10178).

View file

@ -163,7 +163,6 @@ from ansible_collections.community.general.plugins.module_utils.datetime import
) )
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
IFPROPS_MAPPING = dict( IFPROPS_MAPPING = dict(
bondingopts='bonding_opts', bondingopts='bonding_opts',
bridgeopts='bridge_opts', bridgeopts='bridge_opts',
@ -280,8 +279,8 @@ def main():
if system: if system:
# Update existing entry # Update existing entry
system_id = None system_id = ''
if LooseVersion(str(conn.version())) >= LooseVersion('3.4.0'): if LooseVersion(str(conn.version())) >= LooseVersion('3.4'):
system_id = conn.get_system_handle(name) system_id = conn.get_system_handle(name)
else: else:
system_id = conn.get_system_handle(name, token) system_id = conn.get_system_handle(name, token)