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

lxd_container: v9.4.0 breaks module #8888

Open
1 task done
anthonyra opened this issue Sep 20, 2024 · 5 comments
Open
1 task done

lxd_container: v9.4.0 breaks module #8888

anthonyra opened this issue Sep 20, 2024 · 5 comments
Labels
bug This issue/PR relates to a bug module module traceback

Comments

@anthonyra
Copy link
Contributor

Summary

When trying to use lxd_container it fails

Issue Type

Bug Report

Component Name

Looks like the dictionary comprehension update broke the module

#8814

Ansible Version

ansible [core 2.17.4]
  config file = /home/nerdnode/culper-ring-push/ansible.cfg
  configured module search path = ['/home/nerdnode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/nerdnode/.local/pipx/venvs/ansible-core/lib/python3.11/site-packages/ansible
  ansible collection location = /home/nerdnode/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/nerdnode/.local/bin/ansible
  python version = 3.11.6 (main, Apr 10 2024, 17:26:07) [GCC 13.2.0] (/home/nerdnode/.local/pipx/venvs/ansible-core/bin/python)
  jinja version = 3.1.4
  libyaml = True

Community.general Version

Collection        Version
----------------- -------
community.general 9.4.0 

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

- name: Create VM
  delegate_to: localhost
  community.general.lxd_container:

Expected Results

Ran without errors.

Actual Results

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'items'
fatal: [vm-9541 -> localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/nerdnode/.ansible/tmp/ansible-tmp-1726833636.5554516-274325-21926886816507/AnsiballZ_lxd_container.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/nerdnode/.ansible/tmp/ansible-tmp-1726833636.5554516-274325-21926886816507/AnsiballZ_lxd_container.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/nerdnode/.ansible/tmp/ansible-tmp-1726833636.5554516-274325-21926886816507/AnsiballZ_lxd_container.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.lxd_container', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.lxd_container', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_community.general.lxd_container_payload_wii3zqjo/ansible_community.general.lxd_container_payload.zip/ansible_collections/community/general/plugins/modules/lxd_container.py\", line 901, in <module>\n  File \"/tmp/ansible_community.general.lxd_container_payload_wii3zqjo/ansible_community.general.lxd_container_payload.zip/ansible_collections/community/general/plugins/modules/lxd_container.py\", line 897, in main\n  File \"/tmp/ansible_community.general.lxd_container_payload_wii3zqjo/ansible_community.general.lxd_container_payload.zip/ansible_collections/community/general/plugins/modules/lxd_container.py\", line 771, in run\nAttributeError: 'NoneType' object has no attribute 'items'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

self.old_sections = {
section: adjust_content(content)
for section, content in self.old_instance_json.get('metadata', {}).items()
if section in set(CONFIG_PARAMS) - set(CONFIG_CREATION_PARAMS)
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:
None

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 ansibullbot added bug This issue/PR relates to a bug traceback labels Sep 20, 2024
@felixfontein
Copy link
Collaborator

Yep, it should have been for k, v in data.get('network', {}).items() and not for k, v in (data.get('network') or {}).items(). These have slightly different semantics.

CC @russoz

@felixfontein
Copy link
Collaborator

!component =plugins/modules/lxd_container.py

@felixfontein
Copy link
Collaborator

(There's a similar change in the same module that has the same semantics change.)

@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 ansibullbot added the module module label Sep 20, 2024
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 module module traceback
Projects
None yet
Development

No branches or pull requests

3 participants