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

Change the return key of k8s_facts #44446

Merged
merged 1 commit into from
Aug 29, 2018
Merged

Conversation

willthames
Copy link
Contributor

SUMMARY

items is a terrible return key for ansible as Jinja
will often think it refers to the items() function.

Even though you can typically work around this with
results['items'], sometimes even that doesn't work:

- name: Resources should exist
  assert:
    that: item.status.phase == 'Active'
  loop: "{{ k8s_namespaces['items'] }}"
fatal: [testhost]: FAILED! => {"msg": "Invalid data passed to 'loop', it
requires a list, got this instead: <built-in method items of dict object
at 0x109dc9c58>. Hint: If you passed a list/dict of just one element,
try adding wantlist=True to your lookup invocation or use q/query
instead of lookup."}

Change it now while we still can.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

k8s_facts

ANSIBLE VERSION
ansible 2.7.0.dev0 (devel 3921f34253) last updated 2018/08/20 20:53:37 (GMT +1000)
  config file = None
  configured module search path = [u'/Users/will/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/will/src/ansible/lib/ansible
  executable location = /Users/will/src/ansible/bin/ansible
  python version = 2.7.14 (default, Mar  9 2018, 23:57:12) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
ADDITIONAL INFORMATION

This will conflict with my other k8s_facts PR #44429 but I will resolve the conflicts after whichever gets merged first

@ansibot
Copy link
Contributor

ansibot commented Aug 21, 2018

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. small_patch support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Aug 21, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Aug 23, 2018
@Im0
Copy link
Contributor

Im0 commented Aug 27, 2018

@willthames LGTM. Seems like a no brainer.

`items` is a *terrible* return key for ansible as Jinja
will often think it refers to the `items()` function.

Even though you can typically work around this with
`results['items']`, sometimes even that doesn't work:

```
- name: Resources should exist
  assert:
    that: item.status.phase == 'Active'
  loop: "{{ k8s_namespaces['items'] }}"
```

```
fatal: [testhost]: FAILED! => {"msg": "Invalid data passed to 'loop', it
requires a list, got this instead: <built-in method items of dict object
at 0x109dc9c58>. Hint: If you passed a list/dict of just one element,
try adding wantlist=True to your lookup invocation or use q/query
instead of lookup."}
```

Change it now while we still can.
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 28, 2018
Copy link
Contributor

@gundalow gundalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore previous comment, this is a new module

@gundalow gundalow merged commit b35ac80 into ansible:devel Aug 29, 2018
@dagwieers dagwieers added the k8s label Feb 8, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. k8s module This issue/PR relates to a module. small_patch support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants