mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Change Proxmox `agent` argument to string.
* Add changelog entry.
* Pass boolean directly to `proxmoxer`.
(cherry picked from commit 0be7b6e7b9
)
Co-authored-by: Markus Reiter <me@reitermark.us>
This commit is contained in:
parent
a509c08b3a
commit
6cd2b4f93b
2 changed files with 15 additions and 3 deletions
2
changelogs/fragments/5107-proxmox-agent-argument.yaml
Normal file
2
changelogs/fragments/5107-proxmox-agent-argument.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- proxmox_kvm - allow ``agent`` argument to be a string (https://github.com/ansible-collections/community.general/pull/5107).
|
|
@ -25,7 +25,9 @@ options:
|
||||||
agent:
|
agent:
|
||||||
description:
|
description:
|
||||||
- Specify if the QEMU Guest Agent should be enabled/disabled.
|
- Specify if the QEMU Guest Agent should be enabled/disabled.
|
||||||
type: bool
|
- Since community.general 5.5.0, this can also be a string instead of a boolean.
|
||||||
|
This allows to specify values such as C(enabled=1,fstrim_cloned_disks=1).
|
||||||
|
type: str
|
||||||
args:
|
args:
|
||||||
description:
|
description:
|
||||||
- Pass arbitrary arguments to kvm.
|
- Pass arbitrary arguments to kvm.
|
||||||
|
@ -809,6 +811,7 @@ from ansible_collections.community.general.plugins.module_utils.proxmox import (
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
|
|
||||||
|
|
||||||
def parse_mac(netstr):
|
def parse_mac(netstr):
|
||||||
|
@ -960,7 +963,14 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
||||||
kwargs.update(kwargs[k])
|
kwargs.update(kwargs[k])
|
||||||
del kwargs[k]
|
del kwargs[k]
|
||||||
|
|
||||||
# Rename numa_enabled to numa. According the API documentation
|
try:
|
||||||
|
# The API also allows booleans instead of e.g. `enabled=1` for backward-compatibility.
|
||||||
|
kwargs['agent'] = boolean(kwargs['agent'], strict=True)
|
||||||
|
except TypeError:
|
||||||
|
# Not something that Ansible would parse as a boolean.
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Rename numa_enabled to numa, according the API documentation
|
||||||
if 'numa_enabled' in kwargs:
|
if 'numa_enabled' in kwargs:
|
||||||
kwargs['numa'] = kwargs['numa_enabled']
|
kwargs['numa'] = kwargs['numa_enabled']
|
||||||
del kwargs['numa_enabled']
|
del kwargs['numa_enabled']
|
||||||
|
@ -1040,7 +1050,7 @@ def main():
|
||||||
module_args = proxmox_auth_argument_spec()
|
module_args = proxmox_auth_argument_spec()
|
||||||
kvm_args = dict(
|
kvm_args = dict(
|
||||||
acpi=dict(type='bool'),
|
acpi=dict(type='bool'),
|
||||||
agent=dict(type='bool'),
|
agent=dict(type='str'),
|
||||||
args=dict(type='str'),
|
args=dict(type='str'),
|
||||||
autostart=dict(type='bool'),
|
autostart=dict(type='bool'),
|
||||||
balloon=dict(type='int'),
|
balloon=dict(type='int'),
|
||||||
|
|
Loading…
Reference in a new issue