From c74347562c741d7c34e672acdfa29e9aa1242e1c Mon Sep 17 00:00:00 2001 From: Maxim Babushkin Date: Mon, 19 Jan 2026 20:59:56 +0200 Subject: [PATCH] Fix yq expression syntax in configuration-converter The validate_spec_components function in configuration-converter.sh was failing with "Error: bad expression, please check expression syntax" on extracting "components" keys. The original command attempted to delete non-"enabled" keys using: del(.spec.components.[] | keys[] | select(. != "enabled")) This failed because: - `.spec.components.[]` incorrectly tries to iterate over object values - `keys[]` syntax doesn't work in this pipeline context in yq v4 - `select(. != "enabled")` references values instead of key names - No proper context management for applying deletions back to document Replaced with proper yq v4 syntax using the `with()` function. Signed-off-by: Maxim Babushkin --- tools/configuration-converter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configuration-converter.sh b/tools/configuration-converter.sh index 855ae9b4db..9c24524a54 100755 --- a/tools/configuration-converter.sh +++ b/tools/configuration-converter.sh @@ -117,7 +117,7 @@ function boolean_2_string(){ # Note that if there is an entry except spec.components..enabled: true/false converter will delete them and warn user function validate_spec_components(){ if [[ $(yq eval '.spec.components' "$OUTPUT") != "null" ]]; then - yq -i 'del(.spec.components.[] | keys[] | select(. != "enabled")) | .spec.values *= .spec.components | del (.spec.components)' "$OUTPUT" + yq -i 'with(.spec.components[]; del( .[] | select(key != "enabled") )) | .spec.values *= .spec.components | del(.spec.components)' "$OUTPUT" echo "Only values in the format spec.components..enabled: true/false are supported for conversion. For more details, refer to the documentation: https://github.com/istio-ecosystem/sail-operator/tree/main/docs#components-field" fi }