Add check Identity validate when get schemas

Glance client don't check Identity validate when get schemas.
So when you exec "glance image-create" with invalid credentials in
glance-api.conf, it returns "unrecognized arguments: --foo".
It is difficult to debug such message.

This change makes invalid credentials error clear.

Change-Id: Ib641333cd8d51f459df70306a1eeda250ada5ca1
Closes-Bug: 1467719
This commit is contained in:
Takeaki Matsumoto 2015-06-22 19:17:25 +09:00
parent ec0f2dfd85
commit b9eee5ee32

@ -577,6 +577,9 @@ class OpenStackImagesShell(object):
with open(schema_file_path, 'w') as f:
f.write(json.dumps(schema.raw()))
except exc.Unauthorized:
raise exc.CommandError(
"Invalid OpenStack Identity credentials.")
except Exception:
# NOTE(esheffield) do nothing here, we'll get a message
# later if the schema is missing