Skip to content

Commit

Permalink
Fix ironic client ironic_url deprecation warning
Browse files Browse the repository at this point in the history
In preparation for stein, use 'endpoint' instead of 'ironic_url'
when calling get_client in order to remove the following warning:

WARNING ironicclient.client The argument "ironic_url" passed to
get_client is deprecated and will be removed in Stein release,
please use "endpoint" instead.

For reference:
In the python-ironicclient code, in the ironicclient/client.py#L24
TODO(vdrok): remove in Stein
[...]
  ('ironic_url',): 'endpoint',

Introduced in commit:
openstack/python-ironicclient@58c39b7

Change-Id: I1b3ce1955622c40b780c0b15ec7e09be3e8ace72
  • Loading branch information
Daniel Abad committed Oct 24, 2018
1 parent d7e76f8 commit 35f49f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lower-constraints.txt
Expand Up @@ -128,7 +128,7 @@ python-cinderclient==3.3.0
python-dateutil==2.5.3
python-editor==1.0.3
python-glanceclient==2.8.0
python-ironicclient==2.3.0
python-ironicclient==2.4.0
python-keystoneclient==3.15.0
python-mimeparse==1.6.0
python-neutronclient==6.7.0
Expand Down
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/baremetal_nodes.py
Expand Up @@ -56,7 +56,7 @@ def _get_ironic_client():
'os_service_type': 'baremetal',
'os_endpoint_type': 'public',
'insecure': 'true',
'ironic_url': CONF.ironic.api_endpoint}
'endpoint': CONF.ironic.api_endpoint}
# NOTE(mriedem): The 1 api_version arg here is the only valid value for
# the client, but it's not even used so it doesn't really matter. The
# ironic client wrapper in the virt driver actually uses a hard-coded
Expand Down
10 changes: 5 additions & 5 deletions nova/tests/unit/virt/ironic/test_client_wrapper.py
Expand Up @@ -77,7 +77,7 @@ def test__get_client_session(self, mock_ir_cli, mock_session):
ironicclient = client_wrapper.IronicClientWrapper()
# dummy call to have _get_client() called
ironicclient.call("node.list")
# With no api_endpoint in the conf, ironic_url is retrieved from
# With no api_endpoint in the conf, endpoint is retrieved from
# nova.utils.get_ksa_adapter().get_endpoint()
self.get_ksa_adapter.assert_called_once_with(
'baremetal', ksa_auth=self.get_auth_plugin.return_value,
Expand All @@ -87,7 +87,7 @@ def test__get_client_session(self, mock_ir_cli, mock_session):
'max_retries': CONF.ironic.api_max_retries,
'retry_interval': CONF.ironic.api_retry_interval,
'os_ironic_api_version': ['1.38', '1.37'],
'ironic_url':
'endpoint':
self.get_ksa_adapter.return_value.get_endpoint.return_value}
mock_ir_cli.assert_called_once_with(1, **expected)

Expand All @@ -102,7 +102,7 @@ def test__get_client_session_service_not_found(self, mock_ir_cli,
ironicclient = client_wrapper.IronicClientWrapper()
# dummy call to have _get_client() called
ironicclient.call("node.list")
# With no api_endpoint in the conf, ironic_url is retrieved from
# With no api_endpoint in the conf, endpoint is retrieved from
# nova.utils.get_endpoint_data
self.get_ksa_adapter.assert_called_once_with(
'baremetal', ksa_auth=self.get_auth_plugin.return_value,
Expand All @@ -113,7 +113,7 @@ def test__get_client_session_service_not_found(self, mock_ir_cli,
'max_retries': CONF.ironic.api_max_retries,
'retry_interval': CONF.ironic.api_retry_interval,
'os_ironic_api_version': ['1.38', '1.37'],
'ironic_url': None}
'endpoint': None}
mock_ir_cli.assert_called_once_with(1, **expected)

@mock.patch.object(keystoneauth1.session, 'Session')
Expand All @@ -131,7 +131,7 @@ def test__get_client_session_legacy(self, mock_ir_cli, mock_session):
'max_retries': CONF.ironic.api_max_retries,
'retry_interval': CONF.ironic.api_retry_interval,
'os_ironic_api_version': ['1.38', '1.37'],
'ironic_url': endpoint}
'endpoint': endpoint}
mock_ir_cli.assert_called_once_with(1, **expected)

@mock.patch.object(client_wrapper.IronicClientWrapper, '_multi_getattr')
Expand Down
2 changes: 1 addition & 1 deletion nova/virt/ironic/client_wrapper.py
Expand Up @@ -122,7 +122,7 @@ def _get_client(self, retry_on_conflict=True):

try:
cli = ironic.client.get_client(IRONIC_API_VERSION[0],
ironic_url=ironic_url,
endpoint=ironic_url,
session=sess, **kwargs)
# Cache the client so we don't have to reconstruct and
# reauthenticate it every time we need it.
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Expand Up @@ -11,7 +11,7 @@ mox3>=0.20.0 # Apache-2.0
psycopg2>=2.6.2 # LGPL/ZPL
PyMySQL>=0.7.6 # MIT License
python-barbicanclient>=4.5.2 # Apache-2.0
python-ironicclient>=2.3.0 # Apache-2.0
python-ironicclient>=2.4.0 # Apache-2.0
requests-mock>=1.2.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
Expand Down

0 comments on commit 35f49f4

Please sign in to comment.