Skip to content

proxmox: Lack of error checking: "Cloning lxc VM 100 failed with exception: 'template'" #5372

Closed
@grinapo

Description

@grinapo

Summary

Cloning fails with cryptic arrors. Actually at a lof of places, some due to proxmoxer but some not. This is one of such places.

I am not sure what the original idea was, but this lacks error checking whatever it was:

--- /usr/lib/python3/dist-packages/ansible_collections/community/general/plugins/modules/cloud/misc/proxmox.py~ 2022-10-15 16:33:33.000000000 +0200
+++ /usr/lib/python3/dist-packages/ansible_collections/community/general/plugins/modules/cloud/misc/proxmox.py  2022-10-15 16:37:44.390779428 +0200
@@ -412,7 +412,9 @@
         """Check if the specified container is a template."""
         proxmox_node = self.proxmox_api.nodes(node)
         config = getattr(proxmox_node, VZ_TYPE)(vmid).config.get()
+        if 'template' in config:
+            return config['template']
+        return False
-         return config['template']
 
     def create_instance(self, vmid, node, disk, storage, cpus, memory, swap, timeout, clone, **kwargs):

Chokes when config doesn't contain "template". I left to the reader to determine when this happens.

Issue Type

Bug Report

Component Name

/usr/lib/python3/dist-packages/ansible_collections/community/general/plugins/modules/cloud/misc/proxmox.py

Ansible Version

ansible [core 2.13.4]

Community.general Version

community.general 5.6.0

Configuration

No response

OS / Environment

No response

Steps to Reproduce

configure/clone various PVE versions, observe some of the fail.

Expected Results

  1. error checking
  2. non-cryptic error messages (both API HTTP and data responses)

Actual Results

Haphazard results and lot of guesswork at configs.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugcloudmodulemodulepluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions