Skip to content

Commit

Permalink
make recommended updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Trombly committed Oct 25, 2023
1 parent 072faed commit f839d7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions plugins/modules/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
state:
description:
- Indicate desired state of the instance
- V(template) was added in community.general 8.0.0.
type: str
choices: ['present', 'started', 'absent', 'stopped', 'restarted', 'template']
default: present
Expand Down Expand Up @@ -427,7 +428,7 @@
api_host: node1
state: template
- name: Convert container to template(stop container if running)
- name: Convert container to template (stop container if running)
community.general.proxmox:
vmid: 100
api_user: root@pam
Expand Down Expand Up @@ -819,8 +820,8 @@ def main():
try:
vm = proxmox.get_vm(vmid)

if proxmox.convert_to_template(vm, vmid, timeout, force=module.params['force']):
module.exit_json(changed=True, msg="VM %s is converted to template" % vmid)
proxmox.convert_to_template(vm, vmid, timeout, force=module.params['force'])
module.exit_json(changed=True, msg="VM %s is converted to template" % vmid)
except Exception as e:
module.fail_json(msg="conversion of VM %s to template failed with exception: %s" % (vmid, e))

Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,9 @@
description:
- Indicates desired state of the instance.
- If V(current), the current state of the VM will be fetched. You can access it with C(results.status)
- V(template) was added in community.general 8.0.0.
type: str
choices: ['present', 'started', 'absent', 'stopped', 'restarted', 'current']
choices: ['present', 'started', 'absent', 'stopped', 'restarted', 'current', 'template']
default: present
storage:
description:
Expand Down Expand Up @@ -1524,8 +1525,8 @@ def main():
if vm['status'] == 'stopped':
module.exit_json(changed=False, vmid=vmid, msg="VM %s is already stopped" % vmid, **status)

if proxmox.stop_vm(vm, force=module.params['force'], timeout=module.params['timeout']):
module.exit_json(changed=True, vmid=vmid, msg="VM %s is shutting down" % vmid, **status)
proxmox.stop_vm(vm, force=module.params['force'], timeout=module.params['timeout'])
module.exit_json(changed=True, vmid=vmid, msg="VM %s is shutting down" % vmid, **status)
except Exception as e:
module.fail_json(vmid=vmid, msg="stopping of VM %s failed with exception: %s" % (vmid, e), **status)

Expand Down

0 comments on commit f839d7f

Please sign in to comment.