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
commitaaef5cfe335ebbe742b7eb1593ec51bbeeb4dc7c (patch)
tree72d2a2d957e9da02aa06f6c07e53fd125be8b02e
parenta6128e7c12baa6f9fc763dbda3988f402860c472 (diff)
downloaddefinitions-aaef5cfe335ebbe742b7eb1593ec51bbeeb4dc7c.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--writeexts.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/writeexts.py b/writeexts.py
index ab451d14..270cade9 100644
--- a/writeexts.py
+++ b/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)