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

'dict' lookup does not work explicitly, i.e. with lookup('dict', ...) #32067

Closed
kwohlfahrt opened this issue Oct 24, 2017 · 1 comment · Fixed by #32080
Closed

'dict' lookup does not work explicitly, i.e. with lookup('dict', ...) #32067

kwohlfahrt opened this issue Oct 24, 2017 · 1 comment · Fixed by #32080
Assignees
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@kwohlfahrt
Copy link
Contributor

ISSUE TYPE
  • Bug Report
COMPONENT NAME

dict plugin

ANSIBLE VERSION

devel-9d6fd4ebcc10188274eca5971e9ac2ec0d806676

ansible 2.5.0
  config file = /mnt/delphi/kwohlfahrt/computer_setup/ansible.cfg
  configured module search path = ['/mnt/delphi/kwohlfahrt/computer_setup/library']
  ansible python module location = /home/kwohlfahrt/.pip/lib/python3.5/site-packages/ansible
  executable location = /home/kwohlfahrt/.pip/bin/ansible
  python version = 3.5.4 (default, Aug 12 2017, 14:08:14) [GCC 7.1.0]
CONFIGURATION
DEFAULT_HOST_LIST(/mnt/delphi/kjw53/computer_setup/ansible.cfg) = ['/mnt/delphi/kwohlfahrt/computer_setup/hosts
DEFAULT_MODULE_PATH(/mnt/delphi/kjw53/computer_setup/ansible.cfg) = ['/mnt/delphi/kwohlfahrt/computer_setup/library
OS / ENVIRONMENT

N/A

SUMMARY

When called with the lookup function, 'dict' plugin errors.

STEPS TO REPRODUCE
ansible localhost -m debug -a msg="{{ lookup('dict', {'foo': 'bar', 'thing': 'other'}) }}"
EXPECTED RESULTS

Something like the example below, so it can work with the loop keyword.

localhost | SUCCESS => {
    "changed": false,
    "msg": [
        {
            "key": "foo",
            "value": "bar"
        }, {
            "key": "thing",
            "value": "other"
        }
    ]
}
ACTUAL RESULTS

Output is below. Some more debugging here shows the parameter is passed as a list containing the dict as its only element.

localhost | FAILED! => {
    "msg": "An unhandled exception occurred while running the lookup plugin 'dict'. Error was a <class 'ansible.errors.AnsibleError'>, original message: with_dict expects a dict, not <class 'list'> ([{'foo': 'bar'}])"
}
@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug_report needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 24, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 24, 2017
@bcoca bcoca self-assigned this Oct 24, 2017
@bcoca
Copy link
Member

bcoca commented Oct 24, 2017

It seems dict never worked as a direct lookup(), should be fixed in PR above

bcoca added a commit to bcoca/ansible that referenced this issue Oct 25, 2017
bcoca added a commit that referenced this issue Oct 30, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants