diff options
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/client.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py index 4d3b1b71..4ccb2f6d 100644 --- a/openstackclient/compute/client.py +++ b/openstackclient/compute/client.py @@ -19,6 +19,8 @@ from openstackclient.common import utils LOG = logging.getLogger(__name__) +DEFAULT_COMPUTE_API_VERSION = '2' +API_VERSION_OPTION = 'os_compute_api_version' API_NAME = 'compute' API_VERSIONS = { '1.1': 'novaclient.v1_1.client.Client', @@ -60,3 +62,17 @@ def make_client(instance): client.client.service_catalog = instance._service_catalog client.client.auth_token = instance._token return client + + +def build_option_parser(parser): + """Hook to add global options""" + parser.add_argument( + '--os-compute-api-version', + metavar='<compute-api-version>', + default=utils.env( + 'OS_COMPUTE_API_VERSION', + default=DEFAULT_COMPUTE_API_VERSION), + help='Compute API version, default=' + + DEFAULT_COMPUTE_API_VERSION + + ' (Env: OS_COMPUTE_API_VERSION)') + return parser |
