Add warning message if unknown version supplied
Print a warning message if an unknown api version is supplied. An attempt will be made to run the command anyway. Change-Id: Idec8e88fe9621f10ec4b7eecd90708fb3730f56f
This commit is contained in:
parent
d5f2c50c0f
commit
a0fe37e189
@ -30,6 +30,9 @@ LOG = logging.getLogger(__name__)
|
||||
DEFAULT_COMPUTE_API_VERSION = '2'
|
||||
API_VERSION_OPTION = 'os_compute_api_version'
|
||||
API_NAME = 'compute'
|
||||
API_VERSIONS = {
|
||||
"2": "novaclient.client",
|
||||
}
|
||||
|
||||
|
||||
def make_client(instance):
|
||||
|
@ -247,6 +247,11 @@ class OpenStackShell(app.App):
|
||||
if version_opt:
|
||||
api = mod.API_NAME
|
||||
self.api_version[api] = version_opt
|
||||
if version_opt not in mod.API_VERSIONS:
|
||||
self.log.warning(
|
||||
"The %s version <%s> is not in supported versions <%s>"
|
||||
% (api, version_opt,
|
||||
', '.join(mod.API_VERSIONS.keys())))
|
||||
# Command groups deal only with major versions
|
||||
version = '.v' + version_opt.replace('.', '_').split('_')[0]
|
||||
cmd_group = 'openstack.' + api.replace('-', '_') + version
|
||||
|
Loading…
Reference in New Issue
Block a user