From: Ralph Boehme Date: Wed, 8 Sep 2021 14:53:12 +0000 (+0200) Subject: ctdb-scripts: filter out comments in public_addresses file X-Git-Tag: ldb-2.5.0~488 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=530e8d4b9e47601b88e20bcaefa2d502efcebe60;p=thirdparty%2Fsamba.git ctdb-scripts: filter out comments in public_addresses file Note that order of sed expressions matters: the expression to delete comment lines must come first as the second expression would transform # comment to comment BUG: https://bugzilla.samba.org/show_bug.cgi?id=14826 Signed-off-by: Ralph Boehme Reviewed-by: Martin Schwenke --- diff --git a/ctdb/config/events/legacy/10.interface.script b/ctdb/config/events/legacy/10.interface.script index 72e0c101d47..d87f6c52c58 100755 --- a/ctdb/config/events/legacy/10.interface.script +++ b/ctdb/config/events/legacy/10.interface.script @@ -25,7 +25,8 @@ fi get_all_interfaces () { # Get all the interfaces listed in the public_addresses file - all_interfaces=$(sed -e 's/^[^\t ]*[\t ]*//' \ + all_interfaces=$(sed -e '/^#.*/d' \ + -e 's/^[^\t ]*[\t ]*//' \ -e 's/,/ /g' \ -e 's/[\t ]*$//' "$ctdb_public_addresses") diff --git a/ctdb/config/functions b/ctdb/config/functions index 2395d8d4dc8..a4e73ad0594 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -611,6 +611,9 @@ drop_all_public_ips () # _x is intentionally ignored # shellcheck disable=SC2034 while read _ip _x ; do + case "$_ip" in + \#*) continue ;; + esac drop_ip "$_ip" done <"${CTDB_BASE}/public_addresses" }