tools: check for yq before using it

as get_from_kata_deps may be called from scripts that
does not install_yq

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
This commit is contained in:
Snir Sheriber 2022-02-03 15:17:06 +02:00
parent a31cde1224
commit 496bc10de2

View File

@ -36,6 +36,7 @@ get_from_kata_deps() {
local dependency="$1"
versions_file="${this_script_dir}/../../../versions.yaml"
command -v yq &> /dev/null || die 'yq command is not in your $PATH'
result=$("yq" read -X "$versions_file" "$dependency")
[ "$result" = "null" ] && result=""
echo "$result"