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

Add the key_name/value_name options to the dict2items filter #45550

Merged
merged 4 commits into from
Sep 17, 2018
Merged

Add the key_name/value_name options to the dict2items filter #45550

merged 4 commits into from
Sep 17, 2018

Conversation

rwanyoike
Copy link
Contributor

@rwanyoike rwanyoike commented Sep 12, 2018

SUMMARY

As with the items2dict filter, allow users to configure the key/value name for dict2items.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

dict2items

ANSIBLE VERSION
ansible 2.6.2
  config file = <redacted>
  configured module search path = ['<redacted>', '/usr/share/ansible/plugins/modules']
  ansible python module location = <redacted>
  executable location = <redacted>
  python version = 3.7.0 (default, Aug  1 2018, 17:14:57) [Clang 9.0.0 (clang-900.0.39.2)]
ADDITIONAL INFORMATION
N/A

As with items2dict, allow users to configure the key/value name for dict2items
As with items2dict, allow users to configure the key/value name for dict2items
@ansibot
Copy link
Contributor

ansibot commented Sep 12, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 docs This issue/PR relates to or includes documentation. feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 12, 2018
@rwanyoike rwanyoike changed the title Add the key_name/value_name options to dict2items Add the key_name/value_name options to the dict2items filter Sep 12, 2018
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Sep 12, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Sep 13, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Sep 13, 2018
@bcoca
Copy link
Member

bcoca commented Sep 13, 2018

what is the use case for this? FYI the filter was created to act like the dict lookup.

@rwanyoike
Copy link
Contributor Author

rwanyoike commented Sep 13, 2018

@bcoca a happy misuse of dict2items:

A workflow to turn:

foobar:
  boss: /tmp/su99
  noop: /tmp/3311

into a to_json ready list:

- file: boss
  path: /tmp/su99
- file: noop
  path: /tmp/3311

would require extra step(s) to remap the key/value from dict2items's output:

{{ dict | dict2items }}

... it comes so close.

@bcoca
Copy link
Member

bcoca commented Sep 13, 2018

make that the example and also note 'version added' in docs

@ansibot ansibot added the support:community This issue/PR relates to code supported by the Ansible community. label Sep 14, 2018
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Sep 17, 2018
@acozine acozine added this to To do in OLD Ansible Documentation via automation Sep 17, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Sep 17, 2018
@acozine acozine merged commit c41632f into ansible:devel Sep 17, 2018
@acozine acozine moved this from To do to Done in OLD Ansible Documentation Sep 17, 2018
@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.8 This issue/PR affects Ansible v2.8 docs This issue/PR relates to or includes documentation. feature This issue/PR relates to a feature request. new_contributor This PR is the first contribution by a new community member. 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
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants