Set OSC default baremetal api version as in ironicclient

Update OSC plugin DEFAULT_BAREMETAL_API_VERSION to be
equal with ironicclient DEFAULT_VER.

Change-Id: Ic35b2b4d8e26aa3110af57e612bcad4d0f8eb024
Closes-Bug: #1632655
This commit is contained in:
Kyrylo Romanenko 2016-10-12 13:28:21 +03:00
parent 23e1a53570
commit b03a22d059
2 changed files with 9 additions and 4 deletions

View File

@ -16,11 +16,11 @@
import logging import logging
from ironicclient.common import http
from osc_lib import utils from osc_lib import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
DEFAULT_BAREMETAL_API_VERSION = '1.6'
API_VERSION_OPTION = 'os_baremetal_api_version' API_VERSION_OPTION = 'os_baremetal_api_version'
API_NAME = 'baremetal' API_NAME = 'baremetal'
LAST_KNOWN_API_VERSION = 20 LAST_KNOWN_API_VERSION = 20
@ -28,7 +28,7 @@ API_VERSIONS = {
'1.%d' % i: 'ironicclient.v1.client.Client' '1.%d' % i: 'ironicclient.v1.client.Client'
for i in range(1, LAST_KNOWN_API_VERSION + 1) for i in range(1, LAST_KNOWN_API_VERSION + 1)
} }
API_VERSIONS['1'] = API_VERSIONS[DEFAULT_BAREMETAL_API_VERSION] API_VERSIONS['1'] = API_VERSIONS[http.DEFAULT_VER]
def make_client(instance): def make_client(instance):
@ -38,6 +38,7 @@ def make_client(instance):
instance._api_version[API_NAME], instance._api_version[API_NAME],
API_VERSIONS) API_VERSIONS)
LOG.debug('Instantiating baremetal client: %s', baremetal_client_class) LOG.debug('Instantiating baremetal client: %s', baremetal_client_class)
LOG.debug('Baremetal API version: %s', http.DEFAULT_VER)
client = baremetal_client_class( client = baremetal_client_class(
os_ironic_api_version=instance._api_version[API_NAME], os_ironic_api_version=instance._api_version[API_NAME],
@ -55,8 +56,8 @@ def build_option_parser(parser):
metavar='<baremetal-api-version>', metavar='<baremetal-api-version>',
default=utils.env( default=utils.env(
'OS_BAREMETAL_API_VERSION', 'OS_BAREMETAL_API_VERSION',
default=DEFAULT_BAREMETAL_API_VERSION), default=http.DEFAULT_VER),
help='Baremetal API version, default=' + help='Baremetal API version, default=' +
DEFAULT_BAREMETAL_API_VERSION + http.DEFAULT_VER +
' (Env: OS_BAREMETAL_API_VERSION)') ' (Env: OS_BAREMETAL_API_VERSION)')
return parser return parser

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixes the OpenStackClient plugin so that it uses the same
default API version as the Ironic CLI (1.9 instead of 1.6).