summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kurilin <akurilin@mirantis.com>2015-08-11 18:52:50 +0300
committerAndrey Kurilin <akurilin@mirantis.com>2015-08-11 18:52:50 +0300
commite28f2a0d205d0bd50e13ee6085f7f6774276fc7b (patch)
tree39e31325c63856d6cbd4d216a3ae630909245168
parentd0af5f5e981ee60bf3d10afc40a971a020611b0e (diff)
downloadpython-novaclient-e28f2a0d205d0bd50e13ee6085f7f6774276fc7b.tar.gz
Add ability to use default major version
If user specify os-compute-api-version=None, default major version (currently 2.0) will be used. Change-Id: Ie3fc31f4537cb17ed3c0cb97c91c04a9518fbb72
-rw-r--r--novaclient/shell.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/novaclient/shell.py b/novaclient/shell.py
index c3e8c17c..69ad6735 100644
--- a/novaclient/shell.py
+++ b/novaclient/shell.py
@@ -51,6 +51,7 @@ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils
+DEFAULT_MAJOR_OS_COMPUTE_API_VERSION = "2.0"
DEFAULT_OS_COMPUTE_API_VERSION = "2.latest"
DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL'
DEFAULT_NOVA_SERVICE_TYPE = "compute"
@@ -565,8 +566,12 @@ class OpenStackComputeShell(object):
# Discover available auth plugins
novaclient.auth_plugin.discover_auth_systems()
- api_version = api_versions.get_api_version(
- args.os_compute_api_version)
+ if not args.os_compute_api_version:
+ api_version = api_versions.get_api_version(
+ DEFAULT_MAJOR_OS_COMPUTE_API_VERSION)
+ else:
+ api_version = api_versions.get_api_version(
+ args.os_compute_api_version)
os_username = args.os_username
os_user_id = args.os_user_id