summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-03-19 13:04:00 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-03-19 13:04:19 +0000
commit5be813e9e1eab3ca289bac901dab40548bba42fe (patch)
treede99852ad665ea98466910df24e9af5b075797b2
parent11559bbbd24c218d512d503df27157668b37bdc9 (diff)
downloadmorph-5be813e9e1eab3ca289bac901dab40548bba42fe.tar.gz
deploy: Tighten SSH connectivity check
I accidentally tried to deploy a Baserock upgrade to a Fedora cloud machine. Every SSH command that Morph ran got the following output: Please login as the user "fedora" rather than the user "root". The existing implementation of check_ssh_connectivity() didn't raise an exception, leading to confusing errors further down. The new implementation produces this error: ERROR: Unexpected output from remote machine: Please login as the user "fedora" rather than the user "root". Change-Id: Ida5a82b25d759167aa842194b0d833d0565b4acf
-rw-r--r--morphlib/writeexts.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py
index ab451d14..270cade9 100644
--- a/morphlib/writeexts.py
+++ b/morphlib/writeexts.py
@@ -605,12 +605,16 @@ class WriteExtension(cliapp.Application):
def check_ssh_connectivity(self, ssh_host):
try:
- cliapp.ssh_runcmd(ssh_host, ['true'])
+ output = cliapp.ssh_runcmd(ssh_host, ['echo', 'test'])
except cliapp.AppException as e:
logging.error("Error checking SSH connectivity: %s", str(e))
raise cliapp.AppException(
'Unable to SSH to %s: %s' % (ssh_host, e))
+ if output.strip() != 'test':
+ raise cliapp.AppException(
+ 'Unexpected output from remote machine: %s' % output.strip())
+
def is_device(self, location):
try:
st = os.stat(location)