Skip to content

Commit af6124c

Browse files
authored
Merge pull request #12 from SovereignCloudStack/fix/handle-auth-not-at-end
Graft clouds.yaml correctly even if we need to insert in the middle.
2 parents 0247fd7 + 6e6aab8 commit af6124c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

04-cloud-secret.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fi
6262
echo "# Generating ~/tmp/clouds-$OS_CLOUD.yaml ..."
6363
OLD_UMASK=$(umask)
6464
umask 0177
65-
APPEND="$SECRETS" RMVCOMMENT=1 REMOVE=cacert extract_yaml clouds.$OS_CLOUD < $CLOUDS_YAML | sed "s/^\\(\\s*\\)\\($OS_CLOUD\\):/\\1openstack:/" > ~/tmp/clouds-$OS_CLOUD.yaml
65+
INJECTSUB="$SECRETS" INJECTSUBKWD="auth" RMVCOMMENT=1 REMOVE=cacert extract_yaml clouds.$OS_CLOUD < $CLOUDS_YAML | sed "s/^\\(\\s*\\)\\($OS_CLOUD\\):/\\1openstack:/" > ~/tmp/clouds-$OS_CLOUD.yaml
6666
umask $OLD_UMASK
6767
# FIXME: We will provide more settings in cluster-settings.env later, hardcode it for now
6868
#if test "$CS_CCMLB=octavia-ovn"; then OCTOVN="--set octavia_ovn=true"; else unset OCTOVN; fi

yaml_parse.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ islinecomment()
5151
# Environment to pass special functions
5252
# $RMVTREE nonempty: Do not output yaml path leading to this section
5353
# $INSERT and $APPEND is text injected in the outputted block (at beginning and end resp.)
54+
# $INJECTSUB and $INJECTSUBKWD: inject text $INJECTSUB after the subsection $INJECTSUBKWD has been found
5455
# $REMOVE is a tag to filter out
5556
# $RMVCOMMTENT nonempty: Strip comments
5657
#
@@ -95,6 +96,10 @@ extract_yaml_rec()
9596
if test -z "$REMOVE" || ! startswith "$previndent$more$REMOVE:" "$line"; then
9697
echo "$line"
9798
fi
99+
if test -n "$INJECTSUB" -a -n "$INJECTSUBKWD" && startswith "$previndent$more$INJECTSUBKWD:" "$line"; then
100+
echo "$INJECTSUB"
101+
unset INJECTSUB
102+
fi
98103
continue
99104
fi
100105
# b2: Search for the keyword

0 commit comments

Comments
 (0)