From 35f49f403534e174578dcd1b9ab33daf6f14c3e8 Mon Sep 17 00:00:00 2001 From: Daniel Abad Date: Fri, 19 Oct 2018 15:22:33 +0200 Subject: [PATCH] Fix ironic client ironic_url deprecation warning 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: https://github.com/openstack/python-ironicclient/commit/58c39b7a80583dd54165cf292ae5dc621e9da361 Change-Id: I1b3ce1955622c40b780c0b15ec7e09be3e8ace72 --- lower-constraints.txt | 2 +- nova/api/openstack/compute/baremetal_nodes.py | 2 +- nova/tests/unit/virt/ironic/test_client_wrapper.py | 10 +++++----- nova/virt/ironic/client_wrapper.py | 2 +- test-requirements.txt | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 8181030bb61a..4a979125b8e9 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -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 diff --git a/nova/api/openstack/compute/baremetal_nodes.py b/nova/api/openstack/compute/baremetal_nodes.py index 139932ba717f..e47f1122792b 100644 --- a/nova/api/openstack/compute/baremetal_nodes.py +++ b/nova/api/openstack/compute/baremetal_nodes.py @@ -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 diff --git a/nova/tests/unit/virt/ironic/test_client_wrapper.py b/nova/tests/unit/virt/ironic/test_client_wrapper.py index a726530c39ee..3c806fb1964d 100644 --- a/nova/tests/unit/virt/ironic/test_client_wrapper.py +++ b/nova/tests/unit/virt/ironic/test_client_wrapper.py @@ -77,7 +77,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase): 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, @@ -87,7 +87,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase): '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) @@ -102,7 +102,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase): 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, @@ -113,7 +113,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase): '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') @@ -131,7 +131,7 @@ class IronicClientWrapperTestCase(test.NoDBTestCase): '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') diff --git a/nova/virt/ironic/client_wrapper.py b/nova/virt/ironic/client_wrapper.py index ca1ebf888ec4..89525e59e344 100644 --- a/nova/virt/ironic/client_wrapper.py +++ b/nova/virt/ironic/client_wrapper.py @@ -122,7 +122,7 @@ class IronicClientWrapper(object): 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. diff --git a/test-requirements.txt b/test-requirements.txt index 19f0828f44f2..1d867c381503 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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