File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
ansible/roles/config-diff-vars/filter_plugins Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
import jinja2
2
2
from ansible import errors
3
+ # NOTE: jinja2 3.1.0 dropped contextfilter in favour of pass_context.
4
+ try :
5
+ from jinja2 import pass_context
6
+ except ImportError :
7
+ from jinja2 import contextfilter as pass_context
3
8
4
9
5
10
def _get_hostvar (context , var_name , inventory_hostname = None ):
@@ -56,7 +61,7 @@ def dummy_facts_prefix(facts, inject_facts):
56
61
def interface_string (interface ):
57
62
return "\" {{ lookup('vars', inventory_hostname | replace('-', '_') ~ '_' ~ '" + interface + "') }}\" "
58
63
59
- @jinja2 . contextfilter
64
+ @pass_context
60
65
def ip_mappings (context , hosts ):
61
66
hosts = set (hosts )
62
67
result = {}
@@ -74,7 +79,7 @@ def ip_mappings(context, hosts):
74
79
})
75
80
return result
76
81
77
- @jinja2 . contextfilter
82
+ @pass_context
78
83
def dummy_facts_interfaces (context , host ):
79
84
result = {}
80
85
mappings = ip_mappings (context , [host ]).get (host , [])
You can’t perform that action at this time.
0 commit comments