From d24ac5b8b08cf5f26067f79fba6c3f02eab12475 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 8 Sep 2021 16:53:12 +0200 Subject: [PATCH 1/3] 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 (cherry picked from commit 530e8d4b9e47601b88e20bcaefa2d502efcebe60) --- ctdb/config/events/legacy/10.interface.script | 3 ++- ctdb/config/functions | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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" } -- 2.30.2 From 9969dbeac380abf37c11609f975c2956c31617ac Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 12 Oct 2021 12:19:27 +1100 Subject: [PATCH 2/3] ctdb-tests: Fix typo in ctdb stub comment matching BUG: https://bugzilla.samba.org/show_bug.cgi?id=14826 Signed-off-by: Martin Schwenke Reviewed-by: Ralph Boehme (cherry picked from commit 5426c104f5090751c1ea02f0c0667d8d071a4a83) --- ctdb/tests/UNIT/eventscripts/stubs/ctdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb b/ctdb/tests/UNIT/eventscripts/stubs/ctdb index 12627de16a5..fc7bd4fdd84 100755 --- a/ctdb/tests/UNIT/eventscripts/stubs/ctdb +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb @@ -425,7 +425,7 @@ ctdb_ifaces() # Assume -Y. echo "|Name|LinkStatus|References|" while read _ip _iface ; do - case "_$ip" in + case "$_ip" in \#*) : ;; *) _status=1 -- 2.30.2 From c94058bd83080c3518c8caa25f3cda532d61cb1a Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 8 Oct 2021 05:58:37 +0200 Subject: [PATCH 3/3] ctdb-tests: add a comment to the generated public_addresses file used by eventscript UNIT tests test stub code has been updated to handle this, so now let's put it to work. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14826 RN: Correctly ignore comments in CTDB public addresses file Signed-off-by: Ralph Boehme Reviewed-by: Martin Schwenke (cherry picked from commit 4e3676cb3c4d24cd4c287703d2cd812a2a8c36ff) --- ctdb/tests/UNIT/eventscripts/scripts/local.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ctdb/tests/UNIT/eventscripts/scripts/local.sh b/ctdb/tests/UNIT/eventscripts/scripts/local.sh index 0f78fcb3845..7460bf9748e 100644 --- a/ctdb/tests/UNIT/eventscripts/scripts/local.sh +++ b/ctdb/tests/UNIT/eventscripts/scripts/local.sh @@ -282,6 +282,7 @@ setup_public_addresses () echo "Setting up public addresses in ${_f}" cat >"$_f" <