]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Use ctdb_get_all_pnns()
authorMartin Schwenke <martin@meltin.net>
Mon, 16 Sep 2019 09:08:11 +0000 (19:08 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 17 Sep 2019 04:35:26 +0000 (04:35 +0000)
The nested, arbitrary use of onnode can cause messages from ssh on
stderr to appear in the node list:

  Getting list of nodes...
  Output of "onnode -pq all ctdb pnn | grep '^[0-9][0-9]*$'":
  Warning: Permanently added '10.0.0.72' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.75' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.73' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.74' (RSA) to the list of known hosts.^M
  1
  0
  3
  2
  Create/wipe test database rec_test.tdb
  Failed to execute "Permanently added '10.0.0.72' (RSA) to the list of known hosts.^M ctdb attach rec_test.tdb" on node(s) "Warning:"
  Invalid <nodespec>

Avoid that by using an existing function that does not nest ssh uses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/simple/69_recovery_resurrect_deleted.sh

index f6c72c59f2af1b7a88895cfc3811b2917b9b0b85..e5615cddb86a38d4961906fe07992b9843eb2bd2 100755 (executable)
@@ -18,11 +18,11 @@ cluster_is_healthy
 testdb="rec_test.tdb"
 
 echo "Getting list of nodes..."
-try_command_on_node -v any "onnode -pq all ctdb pnn | grep '^[0-9][0-9]*$'"
+ctdb_get_all_pnns
 
-first=$(sed -n -e '1p' "$outfile")
-second=$(sed -n -e '2p' "$outfile")
-notfirst=$(tail -n +2 "$outfile")
+first=$(echo "$all_pnns" | sed -n -e '1p')
+second=$(echo "$all_pnns" | sed -n -e '2p')
+notfirst=$(echo "$all_pnns" | tail -n +2)
 
 echo "Create/wipe test database ${testdb}"
 try_command_on_node $first $CTDB attach "$testdb"