mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
test: Use yq for yaml2json when available
Signed-off-by: Ricardo Branco <rbranco@suse.de>
This commit is contained in:
parent
ec0f63c6e5
commit
476ca11994
2 changed files with 6 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ The test currently depend on:
|
|||
- tar
|
||||
- docker
|
||||
- systemd/systemctl
|
||||
- yq
|
||||
|
||||
Most of these are only required for a few tests so it is not a big issue if not everything is installed. Only a few test should fail then.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ capabilities='{"drop":["CAP_FOWNER","CAP_SETFCAP"]}'
|
|||
|
||||
# filter: convert yaml to json, because bash+yaml=madness
|
||||
function yaml2json() {
|
||||
python3 -c 'import yaml
|
||||
if command -v yq >/dev/null; then
|
||||
yq -p yaml -o json
|
||||
else
|
||||
python3 -c 'import yaml
|
||||
import json
|
||||
import sys
|
||||
json.dump(yaml.safe_load(sys.stdin), sys.stdout)'
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue