mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
use selectattr instead of json_query
Some tests were getting the following error:
```
Unexpected templating type error occurred on ({{
network_connections |
json_query('[*][ieee802_1x]') | flatten | count > 0 }}): 'NoneType'
object is not iterable"
```
In general it is better to avoid the use of `json_query` and use
the older built-in jinaj2 filters such as `selectattr`, unless you
need to perform a complex query of complex json data. In this
case, not sure what the problem was with the input json, but
using `selectattr` seems to have fixed it.
This commit is contained in:
parent
939772fdc1
commit
a9407a4803
1 changed files with 1 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ network_provider: "{{ network_provider_current }}"
|
|||
|
||||
# wpa_supplicant is required if any ieee802_1x connections are defined
|
||||
wpa_supplicant_required: "{{ network_connections |
|
||||
json_query('[*][ieee802_1x]') | flatten | count > 0 }}"
|
||||
selectattr('ieee802_1x', 'defined') | list | count > 0 }}"
|
||||
_network_packages_default_802_1x: ["{% if wpa_supplicant_required
|
||||
%}wpa_supplicant{% endif %}"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue