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

community.general.one_vm: creating fails with "Parse error: syntax error" #6225

Closed
1 task done
salfers opened this issue Mar 23, 2023 · 3 comments · Fixed by #6294
Closed
1 task done

community.general.one_vm: creating fails with "Parse error: syntax error" #6225

salfers opened this issue Mar 23, 2023 · 3 comments · Fixed by #6294
Labels
bug This issue/PR relates to a bug cloud module module plugins plugin (any type)

Comments

@salfers
Copy link

salfers commented Mar 23, 2023

Summary

When we try to create a VM in our OpenNebula environment using an Ansible task it fails with an error message.
Notably this worked before on community.general 6.2.0 or lower and thus is a regression.

We suspect that the bug appeared in 8818a6f, especially since it relates to new ONE features (we are still on an old ONE version).

Issue Type

Bug Report

Component Name

one_vm

Ansible Version

ansible [core 2.14.3]
  config file = /root/projects/server-automation/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.13 (main, Nov 16 2022, 10:51:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)] (/usr/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

# /root/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 6.4.0

Configuration

no special configuration

OS / Environment

OpenNebula installation: version 6.0.0.2

Steps to Reproduce

  - community.general.one_vm:
      api_url: "{{ one_api }}"
      api_username: "{{ one_user }}"
      api_password: "{{ one_token }}" 
      template_id: 577
      disk_size: "5 GB"
      memory: "2048 MB"
      cpu: 1
      vcpu: 1
      networks:
        - NETWORK_ID: 6
      attributes:
        name: "testvm123"
        HYPERVISOR: kvm

Expected Results

VM in OpenNebula successfully created

Actual Results

TASK [community.general.one_vm] ****************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "[one.template.instantiate] Parse error: syntax error, unexpected VARIABLE, expecting EQUAL or EQUAL_EMPTY at line 32643, columns 735:739"}

Depending on which vm template is used, there is sometimes a different error:

TASK [community.general.one_vm] ****************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "[one.template.instantiate] Error allocating a new virtual machine template. Wrong OS/BOOT value: \"None\" should be a comma-separated list of disk# or nic#"}

In either case the exact same playbook worked before.

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 Mar 23, 2023
@felixfontein
Copy link
Collaborator

CC @sk4zuzu @russoz

nilsding added a commit to nilsding/community.general that referenced this issue Apr 6, 2023
with more complex templates that make use of quoted strings the new
"render" method fails to produce a template that is accepted by
OpenNebula.  ==> escape double quotes in strings to make OpenNebula
happy again.

I also tested whether newlines need to be escaped, looks like they are
fine as they are.

Fixes ansible-collections#6225
nilsding added a commit to nilsding/community.general that referenced this issue Apr 11, 2023
with more complex templates that make use of quoted strings the new
"render" method fails to produce a template that is accepted by
OpenNebula.  ==> escape double quotes in strings to make OpenNebula
happy again.

I also tested whether newlines need to be escaped, looks like they are
fine as they are.

Fixes ansible-collections#6225
felixfontein pushed a commit that referenced this issue Apr 16, 2023
…te (#6294)

* one_vm: fix syntax error when creating VMs with a more complex template

with more complex templates that make use of quoted strings the new
"render" method fails to produce a template that is accepted by
OpenNebula.  ==> escape double quotes in strings to make OpenNebula
happy again.

I also tested whether newlines need to be escaped, looks like they are
fine as they are.

Fixes #6225

* module_utils/opennebula: skip empty values in render
patchback bot pushed a commit that referenced this issue Apr 16, 2023
…te (#6294)

* one_vm: fix syntax error when creating VMs with a more complex template

with more complex templates that make use of quoted strings the new
"render" method fails to produce a template that is accepted by
OpenNebula.  ==> escape double quotes in strings to make OpenNebula
happy again.

I also tested whether newlines need to be escaped, looks like they are
fine as they are.

Fixes #6225

* module_utils/opennebula: skip empty values in render

(cherry picked from commit cb3ca05)
felixfontein pushed a commit that referenced this issue Apr 16, 2023
…creating VMs with a more complex template (#6342)

one_vm: fix syntax error when creating VMs with a more complex template (#6294)

* one_vm: fix syntax error when creating VMs with a more complex template

with more complex templates that make use of quoted strings the new
"render" method fails to produce a template that is accepted by
OpenNebula.  ==> escape double quotes in strings to make OpenNebula
happy again.

I also tested whether newlines need to be escaped, looks like they are
fine as they are.

Fixes #6225

* module_utils/opennebula: skip empty values in render

(cherry picked from commit cb3ca05)

Co-authored-by: Georg Gadinger <nilsding@nilsding.org>
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.

3 participants