diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-03-19 13:04:00 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-03-19 13:04:19 +0000 |
commit | aaef5cfe335ebbe742b7eb1593ec51bbeeb4dc7c (patch) | |
tree | 72d2a2d957e9da02aa06f6c07e53fd125be8b02e | |
parent | a6128e7c12baa6f9fc763dbda3988f402860c472 (diff) | |
download | definitions-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.py | 6 |
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) |