Skip to content

Commit 7eb7a9b

Browse files
committed
Ensure we only read the first cert. Output name and test access.
Signed-off-by: Kurt Garloff <kurt@garloff.de>
1 parent 7d7bcde commit 7eb7a9b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

04-cloud-secret.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ 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:' | sed 's/^ *cacert: //')
23+
CA=$(grep -A12 "^ *$OS_CLOUD: *$" $CLOUDS_YAML | grep 'cacert:' | head -n1 | sed 's/^ *cacert: //')
2424
OS_CACERT=${OS_CACERT:-$CA}
2525
if test -n "$OS_CACERT"; then
26+
echo "Found CA cert file configured to be $OS_CACERT"
27+
if test ! -r "$OS_CACERT"; then echo "... but could not access it. FATAL."; exit 3; fi
2628
# Call the helm helper chart now
2729
helm upgrade -i openstack-secrets -n "$CS_NAMESPACE" --create-namespace https://github.com/SovereignCloudStack/openstack-csp-helper/releases/latest/download/openstack-csp-helper.tgz -f $CLOUDS_YAML --set cacert="$(cat $OS_CACERT)"
2830
else

0 commit comments

Comments
 (0)