Skip to content

Commit 8fc8efd

Browse files
authored
[Airgap] extend yq support in the airgap script (#898)
The airgap script used to work with the Mike Farah's yq. Anyway, it was incompatible with the Andrey Kislyuk's yq version (which is the main python3 version you would get via pip). Drop the eval arg from yq in the airgap script to make it compatible with both. Also check the yaml keys are there before trying recursion (which would led to error out with some yq parsers) Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
1 parent 97db17d commit 8fc8efd

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/elemental-airgap.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ get_chart_val() {
207207
local local_fail=${3:-"true"}
208208
local local_condition="[[ \"\$$local_var\" == \"null\" ]]"
209209

210-
eval $local_var='$(helm show values $CHART_NAME_OPERATOR | eval yq eval '.${local_val}' | sed s/\"//g 2>&1)'
210+
eval $local_var='$(helm show values $CHART_NAME_OPERATOR | eval yq '.${local_val}' | sed s/\"//g 2>&1)'
211211
if eval $local_condition; then
212212
if [[ "$local_fail" == "false" ]]; then
213213
log_debug "cannot find $local_val in $CHART_NAME_OPERATOR"
@@ -373,7 +373,10 @@ build_os_channel() {
373373

374374
# defaultChannels has been introduced in 1.7 version
375375
# we can directly add the images in channel_list
376-
get_chart_val channel_list "defaultChannels.*.image" "false"
376+
get_chart_val channel_list "defaultChannels" "false"
377+
if [ -n "$channel_list" ]; then
378+
get_chart_val channel_list "defaultChannels[].image" "false"
379+
fi
377380

378381
if [[ -z "$channel_list" ]]; then
379382
# v1.4+ chart

0 commit comments

Comments
 (0)