added difference and symetric difference filters
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
This commit is contained in:
parent
07b59da996
commit
afe30a6633
1 changed files with 9 additions and 1 deletions
|
@ -126,6 +126,12 @@ def unique(a):
|
||||||
def intersect(a, b):
|
def intersect(a, b):
|
||||||
return set(a).intersection(b)
|
return set(a).intersection(b)
|
||||||
|
|
||||||
|
def difference(a, b):
|
||||||
|
return set(a).difference(b)
|
||||||
|
|
||||||
|
def symetric_difference(a, b):
|
||||||
|
return set(a).symetric_difference(b)
|
||||||
|
|
||||||
class FilterModule(object):
|
class FilterModule(object):
|
||||||
''' Ansible core jinja2 filters '''
|
''' Ansible core jinja2 filters '''
|
||||||
|
|
||||||
|
@ -183,5 +189,7 @@ class FilterModule(object):
|
||||||
# list
|
# list
|
||||||
'unique' : unique,
|
'unique' : unique,
|
||||||
'intersect': intersect,
|
'intersect': intersect,
|
||||||
|
'difference': difference,
|
||||||
|
'symetric_difference': symetric_difference,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue