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: Lack of error checking: "Cloning lxc VM 100 failed with exception: 'template'" #5372

Closed
1 task done
grinapo opened this issue Oct 15, 2022 · 3 comments · Fixed by #6838
Closed
1 task done
Labels
bug This issue/PR relates to a bug cloud module module plugins plugin (any type)

Comments

@grinapo
Copy link

grinapo commented Oct 15, 2022

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
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug cloud module module plugins plugin (any type) labels Oct 15, 2022
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug cloud module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants