Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxmox module refactoring #9225

Merged

Conversation

Lithimlin
Copy link
Contributor

SUMMARY

This pull request refactors the historically grown proxmox module.
The control flow was very opaque with some redundant checks and - most recently - features that were only introduced in parts of the module when they intended to target the whole module (see #9065).
This refactor aims to make the module more readable and more easily extendable.

Additionally, this request contains various bug fixes:

ISSUE TYPE
  • Bugfix Pull Request
  • Refactoring Pull Request
COMPONENT NAME

proxmox

ADDITIONAL INFORMATION

The following playbook should run correctly on both the old and refactored versions of this module, but the template creation will not be idempotent on the old version:

---
- name: Check proxmox LXC module
  hosts: pve
  become: false
  gather_facts: false
  tasks:
    - name: Create LXC
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        ostemplate: local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst
        disk: local-lvm:8
        tags: test1,test3,debian
      register: create_res

    - name: Sleep for 5 seconds and continue with play
      ansible.builtin.wait_for:
        timeout: 5
      delegate_to: localhost

    - name: Check Creation Idempotency
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        ostemplate: local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst
        disk: local-lvm:8
        tags: test1,test3,debian
      register: check_res
      failed_when: check_res.changed

    - name: Update LXC config [new - create volumes]
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        cores: 1
        vmid: "{{ create_res.vmid | int }}"
        disk_volume:
          storage: local-lvm
          size: 14
        mount_volumes:
          - id: mp0
            storage: local-lvm
            size: 3
            mountpoint: /mnt/test
        update: true

    - name: Update LXC config [new - explicit volumes]
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        cores: 1
        vmid: "{{ create_res.vmid }}"
        disk_volume:
          storage: local-lvm
          volume: "vm-{{ create_res.vmid }}-disk-0"
          size: 14
        mount_volumes:
          - id: mp0
            storage: local-lvm
            volume: "vm-{{ create_res.vmid }}-disk-1"
            size: 3
            mountpoint: /mnt/test
        update: true

    - name: Update LXC config [old - implicit volumes]
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        cores: 1
        vmid: "{{ create_res.vmid }}"
        disk: local-lvm:14
        mounts: '{"mp0":"local-lvm:3,mp=/mnt/test"}'
        update: true

    - name: Update LXC config [old - explicit volumes]
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        cores: 1
        vmid: "{{ create_res.vmid }}"
        disk: "local-lvm:vm-{{ create_res.vmid }}-disk-0,size=14G"
        mounts: '{"mp0":"local-lvm:vm-{{ create_res.vmid }}-disk-1,size=3G,mp=/mnt/test"}'
        update: true

    - name: Update LXC config [tags]
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node
        cores: 1
        vmid: "{{ create_res.vmid }}"
        disk: "local-lvm:vm-{{ create_res.vmid }}-disk-0,size=14G"
        mounts: '{"mp0":"local-lvm:vm-{{ create_res.vmid }}-disk-1,size=3G,mp=/mnt/test"}'
        tags: test1,test2,debian
        update: true

    - name: Start LXC
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: started

    - name: Check Starting Idempotency
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: started
      retries: 1
      delay: 10
      register: check_res
      failed_when: check_res.changed

    - name: Restart LXC
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: restarted

    - name: Stop LXC
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: stopped

    - name: Check Stopping Idempotency
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: stopped
      retries: 1
      delay: 10
      register: check_res
      failed_when: check_res.changed

    - name: Convert LXC to Template
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: template

    - name: Check Template Idempotency
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: template
      retries: 1
      delay: 10
      register: check_res
      failed_when: check_res.changed

    - name: Remove LXC
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: absent

    - name: Check Removal Idempotency
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        vmid: "{{ create_res.vmid }}"
        state: absent
      retries: 1
      delay: 10
      register: check_res
      failed_when: check_res.changed

    - name: Create new LXC [With storage + disk] (should fail)
      community.general.proxmox:
        api_host: "{{ proxmox_api_host }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_token_id }}"
        api_token_secret: "{{ proxmox_api_token_secret }}"
        node: node01
        hostname: test-node-2
        ostemplate: local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst
        cores: 1
        disk: 6
        storage: local-lvm
      ignore_errors: true

@ansibullbot
Copy link
Collaborator

@Lithimlin this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug merge_commit This PR contains at least one merge commit. Please resolve! module module needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Dec 6, 2024
@Lithimlin Lithimlin force-pushed the proxmox-module-fixing branch from 6fcef97 to c2ffd98 Compare December 6, 2024 13:52
@ansibullbot

This comment was marked as resolved.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI module_utils module_utils needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR plugins plugin (any type) and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Dec 6, 2024
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Lithimlin thanks for your contribution!

I would recommend breaking this PR into smaller pieces, as it seems to contain both bugfixes as well as new features. Additionally, we must not use type hints, as Ansible still provides support for Python 2.7 - it's quite a nuisance, but that should be the case until that support is dropped, I want to say end of next year but I am not sure right now.

changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Show resolved Hide resolved
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch labels Dec 8, 2024
@bcoca
Copy link
Contributor

bcoca commented Dec 9, 2024

Ansible still provides support for Python 2.7 - it's quite a nuisance, but that should be the case until that support is dropped, I want to say end of next year but I am not sure right now.

The last 2 versions of core already dropped support for 2.7 and 2.16 will be EOL in May 2025
https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix

@russoz
Copy link
Collaborator

russoz commented Dec 10, 2024

Ansible still provides support for Python 2.7 - it's quite a nuisance, but that should be the case until that support is dropped, I want to say end of next year but I am not sure right now.

The last 2 versions of core already dropped support for 2.7 and 2.16 will be EOL in May 2025 docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix

Yes, but community.general still supports ansible-core 2.15. Felix mentioned the deadline more than once but it will be late next year - far enough into the future to be forgotten. Until then, in the collection, we must support Python 2.7.

@ansibullbot

This comment was marked as resolved.

@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Dec 10, 2024
@ansibullbot

This comment was marked as resolved.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI labels Dec 10, 2024
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I had approved it before, but will mark it "Request changes" to prevent other maintainers from accidentally merging it as-is now. Also, on second thought, this is quite a big revamp, so it would benefit from a more thorough examination before we merge it. I approved it before (and I should not, because the changelog needed fixing) and, days later, I cannot recall what I have seen here or not. I'm writing this to manage the expectations - this PR might take a tad longer to be merged - but please bear with us.

changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
@ansibullbot ansibullbot removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jan 6, 2025
@felixfontein
Copy link
Collaborator

It looks like there's anohter conflict now (I guess due to #9524). Sorry for the hassle :( I hope this was the last reformat...

@ansibullbot ansibullbot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jan 8, 2025
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
@Lithimlin Lithimlin force-pushed the proxmox-module-fixing branch from edab74c to 0c87d71 Compare January 9, 2025 10:00
@ansibullbot ansibullbot removed the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jan 9, 2025
changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
changelogs/fragments/9225-proxmox-module-refactoring.yml Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Lithimlin

I have spent more time looking into it and made it through state=present. Got some comments on it. Cheers

plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Outdated Show resolved Hide resolved
Comment on lines +1599 to +1600
if not vmid and not hostname:
self.module.fail_json(msg="Either VMID or hostname must be provided.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not something that should be guaranteed by the module required_* arguments? It seems that all the module states call get_lxc_resource(), so I reckon it would make more sense to add a required_one_of with ("vmid", "hostname") and remove this check from here, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add the required_one_of, but this is more a check in place for the function itself so it is not misused.

Copy link
Collaborator

@russoz russoz Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions within this file are not meant to be imported elsewhere, so in theory if not in practice, the only misuse that can happen is in this file as well. If you could guarantee that is not the case, then this check could be removed.

It already has a required_one_of vmid hostname, so possibly that part is already done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that means I should properly document all functions in this module as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, actually, I remember why I did it this way: This is preparation for being able to safely use this function in the module_utils.

Comment on lines +1616 to +1624
def get_lxc_resource_by_id(self, vmid):
vms = self.get_vm_resources()

if (proxmox.stop_instance(vm, vmid, timeout, force=module.params['force']) and
proxmox.start_instance(vm, vmid, timeout)):
module.exit_json(changed=True, vmid=vmid, msg="VM %s is restarted" % vmid)
vms = [vm for vm in vms if vm["vmid"] == vmid]
if len(vms) == 0:
raise LookupError("VM with VMID %d does not exist in cluster." % vmid)

return vms[0]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method plus the get_vm_resources() one below seem to do almost the exact same thing as ProxmoxAnsible.get_vm(), defined in plugin/module_utils/proxmox.py:152-164.

The module_utils' code seems to have more checks and safety around types (the vmid parameter is an int in the module options, the PR code does not seem to deal with that, comparing int to str, for example), but the PR code does use a more specific exception (LookupError), which is usually a good thing.

Is there any compelling reason to have two new methods that do almost the same thing as existing code? If yes, please expand, else, please remove the new ones and make any improvements you feel necessary on the existing ones so that other modules may benefit from them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhere down the line I'd love to put get_vm_resources() and get_lxc_resource_by_id() into the utils module, but I didn't want to replace it there as that would require me to check all other modules for functionality as well. I have neither the setup nor the time to do that unfortunately.

What I could do is add both of these new functions to the utils module so they can be used down the line and possibly deprecate the old one, but I'm not sure how good of an idea that is.

Comment on lines +1640 to 1648
def get_vm_resources(self):
try:
return self.proxmox_api.cluster.resources.get(type="vm")
except Exception as e:
module.fail_json(vmid=vmid, msg="restarting of VM %s failed with exception: %s" % (vmid, e))
self.module.fail_json(
msg="Unable to retrieve list of %s VMs from cluster resources: %s"
% (self.VZ_TYPE, e)
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed would be better placed in the module_utils, and methods get_vmid() and get_vm() (the ones on my screen at the moment, may others as well but not searching right now) could be refactored and benefit from it.

plugins/modules/proxmox.py Outdated Show resolved Hide resolved
vm = proxmox.get_vm(vmid)
if getattr(proxmox.proxmox_api.nodes(vm['node']), VZ_TYPE)(vmid).status.current.get()['status'] == 'running':
module.exit_json(changed=False, vmid=vmid, msg="VM %s is already running" % vmid)
lxc = self.get_lxc_resource(vmid, hostname)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the module claims to work with both lxc and openvz VMs, it might be more neutral to call this variable vm instead of lxc.

Suggested change
lxc = self.get_lxc_resource(vmid, hostname)
vm = self.get_lxc_resource(vmid, hostname)

Actually, the method also could have a more neutral name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While that is true, this ties into the discussion of dropping openvz support since it's from a Proxmox version that is way past its EOL.

plugins/modules/proxmox.py Outdated Show resolved Hide resolved
plugins/modules/proxmox.py Show resolved Hide resolved
@ansibullbot ansibullbot added stale_ci CI is older than 7 days, rerun before merging stale_review labels Jan 20, 2025
@ansibullbot ansibullbot removed stale_ci CI is older than 7 days, rerun before merging stale_review labels Jan 21, 2025
Comment on lines +1163 to +1167
self.module.fail_json(
vmid=vmid,
msg="VM %s does not exist but neither clone nor ostemplate were specified!"
% identifier,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this case ever going to happen? Line 742 (required_if state present) guarantee at least one of update (in which case this method new_lxc_instance() does not get called), clone or ostemplate is passed. Please double check, if sure it won't happen, please remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible for the LXC to not exist, but update being set to true, in which case neither clone nor ostemplate need to be set according to the module definition.

@felixfontein
Copy link
Collaborator

@russoz @Lithimlin what's the current state of the PR? Is everyone happy so we can merge this for 10.3.0? I guess we won't get more feedback from users of the module here, unless it ends up in a release...

Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm approving on the basis that it seems to have been carefully tailored, but I have not really examined all the logic paths. Again, this PR is way too big - it would have been better to create a number of smaller ones.
@Lithimlin I understand/assume you have tested this thoroughly and I am approving based on that.

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jan 26, 2025
@felixfontein felixfontein merged commit d71ba0f into ansible-collections:main Jan 26, 2025
138 checks passed
Copy link

patchback bot commented Jan 26, 2025

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/d71ba0fae80c4b47074c2472c96a086fa39f595a/pr-9225

Backported as #9634

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 26, 2025
* 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

(cherry picked from commit d71ba0f)
@felixfontein
Copy link
Collaborator

@Lithimlin thanks a lot for your contribution!
@russoz @bcoca thanks a lot for reviewing this!

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 26, 2025
felixfontein pushed a commit that referenced this pull request Jan 26, 2025
…9634)

Proxmox module refactoring (#9225)

* 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

(cherry picked from commit d71ba0f)

Co-authored-by: JL Euler <Lithimlin@users.noreply.github.com>
@Lithimlin Lithimlin deleted the proxmox-module-fixing branch January 27, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug module_utils module_utils module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants