Skip to content

Commit

Permalink
Proxmox module refactoring (#9225)
Browse files Browse the repository at this point in the history
* proxmox: Refactor

This is a squash of the following commits for easier rebasing:

proxmox module_utils: make use of choose_first_if_multiple in get_vm

proxmox: refactor module

proxmox: add changelog

proxmox: fix deprecation message

proxmox: remove type hints

proxmox: remove spaces for keywords

proxmox: run formatter

proxmox: make compabtible with old python versions

proxmox: remove f-strings

proxmox: fix string formatting in build_volume

proxmox: revert disk size parameter to simple integer

proxmox: update changelog fragment

proxmox: fix argument spec

proxmox: fix size handling in build_volume

proxmox: fix formatting

proxmox: update changelog fragment

* proxmox: Fix changelog fragment, doc, and deprecation string formatting.

* proxmox: Fix formatting in imports

* proxmox: require one of `vmid` or `hostname`, simplify checks

* proxmox: apply check for supported features to entire module

* proxmox: move parameter conversions inside create and update functions
  • Loading branch information
Lithimlin authored Jan 26, 2025
1 parent 25a262b commit d71ba0f
Show file tree
Hide file tree
Showing 3 changed files with 1,045 additions and 630 deletions.
11 changes: 11 additions & 0 deletions changelogs/fragments/9225-proxmox-module-refactoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
minor_changes:
- proxmox - refactors the proxmox module (https://github.com/ansible-collections/community.general/pull/9225).

bugfixes:
- proxmox - fixes idempotency of template conversions (https://github.com/ansible-collections/community.general/pull/9225, https://github.com/ansible-collections/community.general/issues/8811).
- proxmox - fixes issues with disk_volume variable (https://github.com/ansible-collections/community.general/pull/9225, https://github.com/ansible-collections/community.general/issues/9065).
- proxmox - fixes incorrect parsing for bind-only mounts (https://github.com/ansible-collections/community.general/pull/9225, https://github.com/ansible-collections/community.general/issues/8982).
- proxmox module utils - fixes ignoring of ``choose_first_if_multiple`` argument in ``get_vmid`` (https://github.com/ansible-collections/community.general/pull/9225).

deprecated_features:
- proxmox - removes default value ``false`` of ``update`` parameter. This will be changed to a default of ``true`` in community.general 11.0.0 (https://github.com/ansible-collections/community.general/pull/9225).
2 changes: 1 addition & 1 deletion plugins/module_utils/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_vmid(self, name, ignore_missing=False, choose_first_if_multiple=False):
return None

self.module.fail_json(msg='No VM with name %s found' % name)
elif len(vms) > 1:
elif len(vms) > 1 and not choose_first_if_multiple:
self.module.fail_json(msg='Multiple VMs with name %s found, provide vmid instead' % name)

return vms[0]
Expand Down
Loading

0 comments on commit d71ba0f

Please sign in to comment.