Skip to content

Commit 3daa1de

Browse files
authored
Fix TypeError caused by giving more than 2 positional arguments to CobblerXMLRPCInterface.get_system_handle() (#10145)
* Update cobbler system module to also use new get_system_handle method definition * Add changelog for bug fix for cobbler system module
1 parent 786be88 commit 3daa1de

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
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 - fix bug with Cobbler >= 3.4.0 caused by giving more than 2 positional arguments to ``CobblerXMLRPCInterface.get_system_handle()`` (https://github.com/ansible-collections/community.general/issues/8506, https://github.com/ansible-collections/community.general/pull/10145).

plugins/modules/cobbler_system.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@
161161
from ansible_collections.community.general.plugins.module_utils.datetime import (
162162
now,
163163
)
164+
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
165+
164166

165167
IFPROPS_MAPPING = dict(
166168
bondingopts='bonding_opts',
@@ -278,7 +280,11 @@ def main():
278280

279281
if system:
280282
# Update existing entry
281-
system_id = conn.get_system_handle(name, token)
283+
system_id = None
284+
if LooseVersion(str(conn.version())) >= LooseVersion('3.4.0'):
285+
system_id = conn.get_system_handle(name)
286+
else:
287+
system_id = conn.get_system_handle(name, token)
282288

283289
for key, value in iteritems(module.params['properties']):
284290
if key not in system:

0 commit comments

Comments
 (0)