summaryrefslogtreecommitdiff
path: root/morphlib/exts/openstack.check
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/exts/openstack.check')
-rwxr-xr-xmorphlib/exts/openstack.check15
1 files changed, 11 insertions, 4 deletions
diff --git a/morphlib/exts/openstack.check b/morphlib/exts/openstack.check
index edc37cc1..a6856c31 100755
--- a/morphlib/exts/openstack.check
+++ b/morphlib/exts/openstack.check
@@ -77,9 +77,16 @@ class OpenStackCheckExtension(morphlib.writeexts.WriteExtension):
'--os-password', password,
'--os-auth-url', auth_url,
'image-list']
- try:
- cliapp.runcmd(cmdline)
- except cliapp.AppException:
- raise cliapp.AppException('Wrong OpenStack credentals.')
+
+ exit, out, err = cliapp.runcmd_unchecked(cmdline)
+
+ if exit != 0:
+ if err.startswith('The request you have made requires ' \
+ 'authentication. (HTTP 401)'):
+ raise cliapp.AppException('Invalid OpenStack credentials.')
+ else:
+ raise cliapp.AppException(
+ 'Failed to connect to OpenStack instance at %s: %s' %
+ (auth_url, err))
OpenStackCheckExtension().run()