keepalived: add indent param in config_section_open/close
authorRishabh <redacted>
Mon, 20 Apr 2026 16:21:37 +0000 (21:51 +0530)
committerFlorian Eckert <redacted>
Mon, 27 Apr 2026 12:28:04 +0000 (14:28 +0200)
Add a parameter for indent in config_section_open and
config_section_close. Previously you had to separately add indents
while parsing if a section was inside another section.
Now this is supported by these two functions.
You can specify how much indent you need to add before opening or closing
a section.

Signed-off-by: Rishabh <redacted>
net/keepalived/files/keepalived.init

index ac59c8103fe7f8db7920149f758dd028f59a56ea..5d2b42ae4eef23c0e48aeddb64a66e073698eb35 100644 (file)
@@ -16,13 +16,17 @@ INDENT_4="${INDENT_1}${INDENT_1}${INDENT_1}${INDENT_1}"
 config_section_open() {
        local tag="$1"
        local name="$2"
+       local indent="$3"
 
+       [ -n "$indent" ] && printf '%b' "$indent" >> "$KEEPALIVED_CONF"
        printf '%s' "$tag" >> "$KEEPALIVED_CONF"
        [ -n "$name" ] && printf ' %s' "$name" >> "$KEEPALIVED_CONF"
        printf ' {\n' >> "$KEEPALIVED_CONF"
 }
 
 config_section_close() {
+       local indent="$1"
+       [ -n "$indent" ] && printf '%b' "$indent" >> "$KEEPALIVED_CONF"
        printf '}\n\n' >> "$KEEPALIVED_CONF"
 }
 
git clone https://git.99rst.org/PROJECT