v2 'help' behaviour depends on (a) credentials/local environment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance Client |
Fix Released
|
Medium
|
Flavio Percoco |
Bug Description
This works fine if no credentials are set:
$ glance --debug --os-image-
usage: glance image-create [--architecture <ARCHITECTURE>]
Optional arguments:
--architecture <ARCHITECTURE>
--protected [True|False]
--name <NAME> Descriptive name for the image
but if any arguments are set the v1 help is shown, even though the user clearly wants the v2 help:
$ OS_AUTH_URL=blah glance --debug --os-image-
WARNING: The client is falling back to v1 because the accessing to v2 failed. This behavior will be removed in future versions
usage: glance image-create [--id <IMAGE_ID>] [--name <NAME>] [--store <STORE>]
Optional arguments:
--id <IMAGE_ID> ID of image to reserve.
--name <NAME> Name of image.
--store <STORE> Store to upload image to.
--disk-format <DISK_FORMAT>
If they have a full set of valid credentials then either:
1) the v2 help will be displayed if the glance service is up
2) the v1 help will be displayed if the glance service happens to be offline
It should never be necessary to authenticate with the server in order to display the help page.
summary: |
- Cannot display v2 help cloud is offline + v2 'help' behaviour depends on (a) credentials/local environment and (b) + current state of server |
tags: | added: 1.0.0-potential |
summary: |
- v2 'help' behaviour depends on (a) credentials/local environment and (b) - current state of server + v2 'help' behaviour depends on (a) credentials/local environment |
Changed in python-glanceclient: | |
assignee: | nobody → Stuart McLaren (stuart-mclaren) |
Changed in python-glanceclient: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in python-glanceclient: | |
milestone: | none → 1.1.0 |
status: | Fix Committed → Fix Released |
It looks like the behaviour just depends on having all the usual credentials set -- there's no attempt to contact the server.
I'd guess the:
force_auth=True
below is what's causing _cache_schema to fail, which causes us to revert to v1.
def _cache_ schemas( self, options, home_dir= '~/.glanceclien t'): expanduser( home_dir) os_auth_ url:
hash_ host = hashlib. sha1(options. os_auth_ url.encode( 'utf-8' ))
path_ prefix = os.path. join(path_ prefix, hash_host. hexdigest( )) exists( path_prefix) :
os.makedirs( path_prefix)
print( encodeutils. safe_decode( msg), file=sys.stderr) namespace' , 'metadefs/ resource_ type']
schema_ file_paths = [os.path. join(path_ prefix, x + '_schema.json')
for x in ['image', 'namespace', 'resource_type']]
homedir = os.path.
path_prefix = homedir
if options.
if not os.path.
try:
except OSError as e:
# This avoids glanceclient to crash if it can't write to
# ~/.glanceclient, which may happen on some env (for me,
# it happens in Jenkins, as Glanceclient can't write to
# /var/lib/jenkins).
msg = '%s' % e
resources = ['image', 'metadefs/
client = None
failed_ download_ schema = 0 exists( schema_ file_path) ) or options.get_schema:
try:
if not client:
client = self._get_ versioned_ client( '2', options,
force_ auth=True)
for resource, schema_file_path in zip(resources, schema_file_paths):
if (not os.path.