diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-12-10 12:34:21 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-12-10 12:34:21 +0000 |
commit | 68faa04ee19c5537bd911ff168c779fd88944d49 (patch) | |
tree | 42dcb97d0bd2f82025af6885cb8fadb55cfe17de | |
parent | 27fad50acbf9abe8d45e29574462edddd12937c1 (diff) | |
parent | c85536f9c236f9c696fc8715e9b09c08c7462c88 (diff) | |
download | definitions-68faa04ee19c5537bd911ff168c779fd88944d49.tar.gz |
Merge branch 'sam/fix-openstack-credentials-check'
Reviewed-By: Richard Ipsum <richard.ipsum@codethink.co.uk>
Reviewed-By: Francisco Redondo Marchena <francisco.marchena@codethink.co.uk>
-rwxr-xr-x | openstack.check | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/openstack.check b/openstack.check index edc37cc1..a6856c31 100755 --- a/openstack.check +++ b/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() |