From 9062811d10f2ab660ce38f9bd20be9c52daa9479 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 20 Nov 2013 18:02:09 -0600 Subject: Expand support for command extensions Allows client libraries to have complete access to the rest of the OSC ClientManager. In addition, extension libraries can define global options (for API version options/env vars) and define versioned API entry points similar to the in-repo commands. The changes to ClientManager exposed some issues in the existing object api tests that needed to be cleaned up. Change-Id: Ic9662edf34c5dd130a2f1a69d2454adefc1f8a95 --- openstackclient/volume/client.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'openstackclient/volume') diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py index 626b23f1..e04e8cd7 100644 --- a/openstackclient/volume/client.py +++ b/openstackclient/volume/client.py @@ -20,6 +20,8 @@ from openstackclient.common import utils LOG = logging.getLogger(__name__) +DEFAULT_VOLUME_API_VERSION = '1' +API_VERSION_OPTION = 'os_volume_api_version' API_NAME = "volume" API_VERSIONS = { "1": "cinderclient.v1.client.Client" @@ -45,3 +47,17 @@ def make_client(instance): ) return client + + +def build_option_parser(parser): + """Hook to add global options""" + parser.add_argument( + '--os-volume-api-version', + metavar='', + default=utils.env( + 'OS_VOLUME_API_VERSION', + default=DEFAULT_VOLUME_API_VERSION), + help='Volume API version, default=' + + DEFAULT_VOLUME_API_VERSION + + ' (Env: OS_VOLUME_API_VERSION)') + return parser -- cgit v1.2.1