Skip to content

Commit a86482e

Browse files
committed
Fix cloud-init quoting issue by using sed instead of awk
1 parent b3fb317 commit a86482e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/user_data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ runcmd:
4343
GALAXY_VALUES_FILES_LIST=$(curl -s -f "http://metadata.google.internal/computeMetadata/v1/instance/attributes/galaxy-values-files" -H "Metadata-Flavor: Google" 2>/dev/null || echo "values/values.yml")
4444
4545
# Convert semicolon-separated values files to JSON array for Ansible
46-
GALAXY_VALUES_FILES_JSON=$(echo "$GALAXY_VALUES_FILES_LIST" | awk -F';' '"'"'{printf "["; for(i=1; i<=NF; i++) {if(i>1) printf ","; printf "\"%s\"", $i} printf "]"}'"'"')
46+
GALAXY_VALUES_FILES_JSON=$(echo "$GALAXY_VALUES_FILES_LIST" | sed -e 's/;/","/g' -e 's/^/["/' -e 's/$/"]/')
4747
4848
mkdir -p /tmp/ansible-inventory
4949
cat > /tmp/ansible-inventory/localhost << EOF

0 commit comments

Comments
 (0)