summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-04-14 12:35:26 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-04-15 12:03:51 +0300
commit7223d97177b570020941562c9c054584d41c5d7c (patch)
treea5700c6f8bd00ceeb457328df94b3aeb881a4105
parent0328bdbf7c3d2def974ca3279fe8732f6f8fa968 (diff)
downloaddefinitions-7223d97177b570020941562c9c054584d41c5d7c.tar.gz
deploy: Share SSH connectivity check in the common writeexts.py code
Also, change it to log the real error message in morph.log before raising a more general exception to the user.
-rwxr-xr-xkvm.check5
-rwxr-xr-xnfsboot.check7
2 files changed, 2 insertions, 10 deletions
diff --git a/kvm.check b/kvm.check
index 04c25069..6ce52e7e 100755
--- a/kvm.check
+++ b/kvm.check
@@ -40,10 +40,7 @@ class KvmPlusSshCheckExtension(morphlib.writeexts.WriteExtension):
location = args[0]
ssh_host, vm_name, vm_path = self.check_and_parse_location(location)
- try:
- cliapp.ssh_runcmd(ssh_host, ['true'])
- except cliapp.AppException:
- raise cliapp.AppException('Unable to SSH to %s' % ssh_host)
+ self.check_ssh_connectivity(ssh_host)
def check_and_parse_location(self, location):
'''Check and parse the location argument to get relevant data.'''
diff --git a/nfsboot.check b/nfsboot.check
index f84f187f..806e560a 100755
--- a/nfsboot.check
+++ b/nfsboot.check
@@ -56,12 +56,7 @@ class NFSBootCheckExtension(morphlib.writeexts.WriteExtension):
version_label, location))
def test_good_server(self, server):
- # Can be ssh'ed into
- try:
- cliapp.ssh_runcmd('root@%s' % server, ['true'])
- except cliapp.AppException:
- raise cliapp.AppException('You are unable to ssh into server %s'
- % server)
+ self.check_ssh_connectivity(server)
# Is an NFS server
try: