Skip to content

Commit ce1dd0c

Browse files
umirukafelixfontein
authored andcommitted
Use StrictVersion class to avoid wrong version comparisons that happen in some cases using LooseVersion class which results in TypeError (#10178)
* 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
1 parent d922eae commit ce1dd0c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- 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).

plugins/modules/cobbler_system.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
)
164164
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
165165

166-
167166
IFPROPS_MAPPING = dict(
168167
bondingopts='bonding_opts',
169168
bridgeopts='bridge_opts',
@@ -280,8 +279,8 @@ def main():
280279

281280
if system:
282281
# Update existing entry
283-
system_id = None
284-
if LooseVersion(str(conn.version())) >= LooseVersion('3.4.0'):
282+
system_id = ''
283+
if LooseVersion(str(conn.version())) >= LooseVersion('3.4'):
285284
system_id = conn.get_system_handle(name)
286285
else:
287286
system_id = conn.get_system_handle(name, token)

0 commit comments

Comments
 (0)