Extending union filter for dictionaries #10483

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
@jtyr
Contributor

jtyr commented Mar 17, 2015

This patch allows to use the union filter for dictionaries. The possible use case is as follows:

my_var1:
  option1: val1
  option2: val2

my_var2:
  option3: val3

my_var3: "{{ my_var1 | union(my_var2) }}"
@mingfang

This comment has been minimized.

Show comment
Hide comment

+1

@amenonsen

This comment has been minimized.

Show comment
Hide comment
@amenonsen

amenonsen Jul 28, 2015

Contributor

See also PR #7872 that provides equivalent functionality using a filter named hash_merge. I like the idea of using union more, but don't know what to do about hash_replace in that case. It's also possible that hash_merge more clearly expresses the actual behaviour (i.e. that later keys replace earlier ones).

Contributor

amenonsen commented Jul 28, 2015

See also PR #7872 that provides equivalent functionality using a filter named hash_merge. I like the idea of using union more, but don't know what to do about hash_replace in that case. It's also possible that hash_merge more clearly expresses the actual behaviour (i.e. that later keys replace earlier ones).

@amenonsen

This comment has been minimized.

Show comment
Hide comment
@amenonsen

amenonsen Jul 29, 2015

Contributor

OK, this should be closed in favour of #10489, which (takes this commit and) extends it to support other set operations on dicts as well.

Contributor

amenonsen commented Jul 29, 2015

OK, this should be closed in favour of #10489, which (takes this commit and) extends it to support other set operations on dicts as well.

@bcoca

This comment has been minimized.

Show comment
Hide comment
@bcoca

bcoca Aug 24, 2015

Member

closing this in favor of a more complete solution in one of the 2 linked PRs

Member

bcoca commented Aug 24, 2015

closing this in favor of a more complete solution in one of the 2 linked PRs

@bcoca bcoca closed this Aug 24, 2015

@jtyr jtyr deleted the jtyr:union_filter branch Sep 10, 2015

@ansibot ansibot added feature and removed feature_pull_request labels Mar 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment