Skip to content

Commit 520cae6

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add warning message if unknown version supplied"
2 parents e60bf28 + a0fe37e commit 520cae6

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎openstackclient/compute/client.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
DEFAULT_COMPUTE_API_VERSION = '2'
3131
API_VERSION_OPTION = 'os_compute_api_version'
3232
API_NAME = 'compute'
33+
API_VERSIONS = {
34+
"2": "novaclient.client",
35+
}
3336

3437

3538
def make_client(instance):

‎openstackclient/shell.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ def initialize_app(self, argv):
247247
if version_opt:
248248
api = mod.API_NAME
249249
self.api_version[api] = version_opt
250+
if version_opt not in mod.API_VERSIONS:
251+
self.log.warning(
252+
"The %s version <%s> is not in supported versions <%s>"
253+
% (api, version_opt,
254+
', '.join(mod.API_VERSIONS.keys())))
250255
# Command groups deal only with major versions
251256
version = '.v' + version_opt.replace('.', '_').split('_')[0]
252257
cmd_group = 'openstack.' + api.replace('-', '_') + version

0 commit comments

Comments
 (0)