ctdb-tests: More debug on SSH failure
authorMartin Schwenke <martin@meltin.net>
Wed, 3 Dec 2014 01:09:12 +0000 (12:09 +1100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 10 Dec 2014 19:56:10 +0000 (20:56 +0100)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 3a2c8bb906fac4e2611a28ead6b4290ddc93de54)

ctdb/tests/complex/42_failover_ssh_hostname.sh

index a74c63207aee26b6f8f52f2e8a2abe8e97a003e8..8c0ac10500e55d589a267cb51ba1917b4fc58d2a 100755 (executable)
@@ -51,8 +51,9 @@ echo "Removing ${test_ip} from the local neighbor table..."
 ip neigh flush "$test_prefix" >/dev/null 2>&1 || true
 
 echo "SSHing to ${test_ip} and running hostname..."
-original_hostname=$(ssh -o "StrictHostKeyChecking no" $test_ip hostname)
-[ $? -eq 0 ]
+if ! original_hostname=$(ssh -o "StrictHostKeyChecking no" $test_ip hostname) ; then
+    die "Failed to get original hostname via SSH..."
+fi
 
 echo "Hostname is: ${original_hostname}"
 
@@ -65,8 +66,12 @@ wait_until_node_has_status $test_node disabled
 gratarp_sniff_wait_show
 
 echo "SSHing to ${test_ip} and running hostname (again)..."
-new_hostname=$(ssh -o "StrictHostKeyChecking no" $test_ip hostname)
-[ $? -eq 0 ]
+if ! new_hostname=$(ssh -o "StrictHostKeyChecking no" $test_ip hostname) ; then
+    echo "Failed to get new hostname via SSH..."
+    echo "DEBUG:"
+    ip neigh show
+    exit 1
+fi
 
 echo "Hostname is: ${new_hostname}"