fix(bootstrap): carry auth_source tables with spaced or quoted headers
A re-run copies the operator's [[auth_source]] tables from the existing felis toml into the new one. The awk program that finds them matched only the literal header [[auth_source]], so a table written as [[ auth_source ]], [["auth_source"]] or [['auth_source']], all valid TOML, was taken for some other section and dropped from the config. Each section header now decides afresh whether it opens an auth_source table, through one regex that allows inner whitespace and a single- or double-quoted key. The single quote is spelled \047, which gawk and mawk both honour inside a bracket expression. The harness carries each spelling and checks that the table still stops at the next section.
This commit is contained in:
2 files changed
+16
-2
No files matched your search
+3
-2
@@ -1947,8 +1947,9 @@ persisted_auth_source_blocks() {
|
||||
for f in "${STATE_DIR}/felis.host.toml" "${STATE_DIR}/felis.pod.toml"; do
|
||||
[ -r "$f" ] || continue
|
||||
# Every [[auth_source]] table, up to (not including) the next other section header.
|
||||
awk '/^[[:space:]]*\[\[auth_source\]\]/ { f=1 }
|
||||
f && /^[[:space:]]*\[/ && !/^[[:space:]]*\[\[auth_source\]\]/ { f=0 }
|
||||
# TOML also accepts [[ auth_source ]] and a quoted key; a header this does not
|
||||
# recognise would silently drop that table.
|
||||
awk '/^[[:space:]]*\[/ { f = /^[[:space:]]*\[\[[[:space:]]*["\047]?auth_source["\047]?[[:space:]]*\]\]/ }
|
||||
f { print }' "$f"
|
||||
return 0
|
||||
done
|
||||
|
||||
Reference in new issue
Block a user