Skip to content

Commit b480974

Browse files
committed
Improve regexp to use \s (space).
This would not trip over tabs. Sidenote: Real YAML parsing would be a lot safer, but would require a package like shyaml or yq which both tend to be not installed and an additional burden. Signed-off-by: Kurt Garloff <kurt@garloff.de>
1 parent 7eb7a9b commit b480974

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

04-cloud-secret.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ kubectl create namespace "$CS_NAMESPACE" || true
2020
# - The cloud should be called openstack
2121
# - We will detect a cacert in there and pass it to the helper chart
2222
if ! test -r "$CLOUDS_YAML"; then echo "clouds.yaml $CLOUDS_YAML not readable"; exit 2; fi
23-
CA=$(grep -A12 "^ *$OS_CLOUD: *$" $CLOUDS_YAML | grep 'cacert:' | head -n1 | sed 's/^ *cacert: //')
23+
CA=$(grep -A12 "^\s\s*$OS_CLOUD: *$" $CLOUDS_YAML | grep 'cacert:' | head -n1 | sed 's/^ *cacert: //')
2424
OS_CACERT=${OS_CACERT:-$CA}
2525
if test -n "$OS_CACERT"; then
2626
echo "Found CA cert file configured to be $OS_CACERT"

0 commit comments

Comments
 (0)