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

plugin_options causes #446

Closed
Haennetz opened this issue Aug 12, 2022 · 5 comments · Fixed by #447
Closed

plugin_options causes #446

Haennetz opened this issue Aug 12, 2022 · 5 comments · Fixed by #447
Labels
bug Something isn't working

Comments

@Haennetz
Copy link

SUMMARY

If docker_plugins include plugin_options it crashes

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_plugin

ANSIBLE VERSION
ansible [core 2.13.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.5 (main, Aug  1 2022, 07:53:20) [GCC 12.1.0]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION

# /home/jo/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.docker 2.7.0  

# /home/jo/.local/lib/python3.10/site-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 2.7.0  
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
- hosts: localhost
  gather_facts: false

  tasks:
    -  community.docker.docker_plugin:
         plugin_name: mikebarkmin/glusterfs:latest
         alias: glusterfs
         plugin_options:
           SERVERS: "localhost"
           VOLNAME: "test"
         state: present
EXPECTED RESULTS

It installed and configured the plugin with the options.

ACTUAL RESULTS

ansible output

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'items'
fatal: [linux-debian-10-1]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1660280562.545966-1796551-25315625797197/AnsiballZ_docker_plugin.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1660280562.545966-1796551-25315625797197/AnsiballZ_docker_plugin.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1660280562.545966-1796551-25315625797197/AnsiballZ_docker_plugin.py\", line 48, in invoke_module\n    run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.7/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.7/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py\", line 375, in <module>\n  File \"/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py\", line 364, in main\n  File \"/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py\", line 178, in __init__\n  File \"/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py\", line 292, in present\n  File \"/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py\", line 248, in install_plugin\nAttributeError: 'list' object has no attribute 'items'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'items'

state on the docker host docker plugin inspect glusterfs

[
    {
        "Config": {
            "Args": {
                "Description": "",
                "Name": "",
                "Settable": null,
                "Value": null
            },
            "Description": "glusterFS plugin for Docker",
            "DockerVersion": "19.03.3",
            "Documentation": "https://github.com/mikebarkmin/docker-volume-glusterfs",
            "Entrypoint": [
                "/docker-volume-glusterfs"
            ],
            "Env": [
                {
                    "Description": "",
                    "Name": "DEBUG",
                    "Settable": [
                        "value"
                    ],
                    "Value": "0"
                },
                {
                    "Description": "",
                    "Name": "SERVERS",
                    "Settable": [
                        "value"
                    ],
                    "Value": ""
                },
                {
                    "Description": "",
                    "Name": "VOLNAME",
                    "Settable": [
                        "value"
                    ],
                    "Value": ""
                }
            ],
            "Interface": {
                "Socket": "glusterfs.sock",
                "Types": [
                    "docker.volumedriver/1.0"
                ]
            },
            "IpcHost": false,
            "Linux": {
                "AllowAllDevices": false,
                "Capabilities": [
                    "CAP_SYS_ADMIN"
                ],
                "Devices": [
                    {
                        "Description": "",
                        "Name": "",
                        "Path": "/dev/fuse",
                        "Settable": null
                    }
                ]
            },
            "Mounts": [
                {
                    "Description": "",
                    "Destination": "/mnt/state",
                    "Name": "state",
                    "Options": [
                        "rbind"
                    ],
                    "Settable": [
                        "source"
                    ],
                    "Source": "/var/lib/docker/plugins/",
                    "Type": "bind"
                }
            ],
            "Network": {
                "Type": "host"
            },
            "PidHost": false,
            "PropagatedMount": "/mnt/volumes",
            "User": {},
            "WorkDir": "",
            "rootfs": {
                "diff_ids": [
                    "sha256:51a2def78f634ebee6fcceef2c6ff83d6f94084172585035da609dee6dc46cc5"
                ],
                "type": "layers"
            }
        },
        "Enabled": false,
        "Id": "752dbf06e2fbe6a818affdebb563ed067fd60e0910658d89825001b7793b7ca5",
        "Name": "glusterfs:latest",
        "PluginReference": "docker.io/mikebarkmin/glusterfs:latest",
        "Settings": {
            "Args": [],
            "Devices": [
                {
                    "Description": "",
                    "Name": "",
                    "Path": "/dev/fuse",
                    "Settable": null
                }
            ],
            "Env": [
                "DEBUG=0",
                "SERVERS=",
                "VOLNAME="
            ],
            "Mounts": [
                {
                    "Description": "",
                    "Destination": "/mnt/state",
                    "Name": "state",
                    "Options": [
                        "rbind"
                    ],
                    "Settable": [
                        "source"
                    ],
                    "Source": "/var/lib/docker/plugins/",
                    "Type": "bind"
                }
            ]
        }
    }
]
@felixfontein
Copy link
Collaborator

The traceback in readable form:

Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1660280562.545966-1796551-25315625797197/AnsiballZ_docker_plugin.py", line 107, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1660280562.545966-1796551-25315625797197/AnsiballZ_docker_plugin.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1660280562.545966-1796551-25315625797197/AnsiballZ_docker_plugin.py", line 48, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py", line 375, in <module>
  File "/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py", line 364, in main
  File "/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py", line 178, in __init__
  File "/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py", line 292, in present
  File "/tmp/ansible_community.docker.docker_plugin_payload_qao3te07/ansible_community.docker.docker_plugin_payload.zip/ansible_collections/community/docker/plugins/modules/docker_plugin.py", line 248, in install_plugin
AttributeError: 'list' object has no attribute 'items'

@felixfontein
Copy link
Collaborator

The stack trace seems to belong to a community.docker 3.0.0 prerelease, not to 2.7.0. Are you sure that you are using community.docker 2.7.0 and seeing this stack trace?

@felixfontein
Copy link
Collaborator

A fix for the main branch (i.e. 3.0.0) is in #447. I don't think this bug can happen with 2.x.y and 1.x.y.

@felixfontein felixfontein added the bug Something isn't working label Aug 12, 2022
@Haennetz
Copy link
Author

oh sorry for that molcule installed 3.0.0-rc2 earlier to bootstrap the environment and continues using the 3.0.0-rc2 version in the play

@felixfontein
Copy link
Collaborator

It's still a bug in 3.0.0-rc2 then.

@felixfontein felixfontein reopened this Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants