Fix exception when `agent` argument is not specified. (#5194)

pull/5199/head
Markus Reiter 2022-08-28 12:03:27 +02:00 committed by GitHub
parent 8e59e52525
commit 82d69bb871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- "proxmox_kvm - fix exception when no ``agent`` argument is specified (https://github.com/ansible-collections/community.general/pull/5194)."

View File

@ -963,12 +963,13 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
kwargs.update(kwargs[k]) kwargs.update(kwargs[k])
del kwargs[k] del kwargs[k]
try: if 'agent' in kwargs:
# The API also allows booleans instead of e.g. `enabled=1` for backward-compatibility. try:
kwargs['agent'] = boolean(kwargs['agent'], strict=True) # The API also allows booleans instead of e.g. `enabled=1` for backward-compatibility.
except TypeError: kwargs['agent'] = boolean(kwargs['agent'], strict=True)
# Not something that Ansible would parse as a boolean. except TypeError:
pass # Not something that Ansible would parse as a boolean.
pass
# Rename numa_enabled to numa, according the API documentation # Rename numa_enabled to numa, according the API documentation
if 'numa_enabled' in kwargs: if 'numa_enabled' in kwargs: