Finalize ironicclient removal

Completely remove dependency from ironicclient in favor of
openstacksdk.

Change-Id: I9b98ddb05fe867a0d3884f736a2edd7b4d61b00c
This commit is contained in:
Riccardo Pittau 2020-03-24 10:18:09 +01:00
parent 3accdfbbc6
commit 4eefb42550
8 changed files with 20 additions and 14 deletions

View File

@ -16,8 +16,8 @@
import binascii
from construct import core
from ironicclient import exceptions
import netaddr
from openstack import exceptions
from oslo_config import cfg
from oslo_utils import netutils
@ -160,7 +160,7 @@ class GenericLocalLinkConnectionHook(base.ProcessingHook):
try:
node_info.patch_port(port, patches)
except exceptions.BadRequest as e:
except exceptions.BadRequestException as e:
LOG.warning("Failed to update port %(uuid)s: %(error)s",
{'uuid': port.uuid, 'error': e},
node_info=node_info)

View File

@ -11,8 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ironicclient import exceptions
import mock
from openstack import exceptions
from oslo_config import cfg
from ironic_inspector import node_cache
@ -224,8 +224,8 @@ class TestGenericLocalLinkConnectionHook(test_base.NodeTest):
}
}
mock_patch.side_effect = exceptions.BadRequest('invalid data')
mock_patch.side_effect = exceptions.BadRequestException('invalid data')
self.hook.before_update(self.data, self.node_info)
log_msg = ("Failed to update port %(uuid)s: %(error)s")
log_msg = "Failed to update port %(uuid)s: %(error)s"
mock_log.warning.assert_called_with(log_msg, mock.ANY,
node_info=mock.ANY)

View File

@ -11,9 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ironicclient.v1 import node
from keystonemiddleware import auth_token
import mock
from openstack.baremetal.v1 import node
from oslo_config import cfg
from ironic_inspector.common import context
@ -87,7 +87,7 @@ class TestProcessingLogger(base.BaseTest):
utils.processing_logger_prefix())
def test_prefix_only_uuid(self):
node_info = node.Node(mock.Mock(), dict(uuid='NNN'))
node_info = mock.Mock(uuid='NNN', spec=node.Node)
self.assertEqual('[node: NNN]',
utils.processing_logger_prefix(node_info=node_info))
@ -102,7 +102,7 @@ class TestProcessingLogger(base.BaseTest):
utils.processing_logger_prefix(data=data))
def test_prefix_everything(self):
node_info = node.Node(mock.Mock(), dict(uuid='NNN'))
node_info = mock.Mock(uuid='NNN', spec=node.Node)
data = {'boot_interface': '01-aa-bb-cc-dd-ee-ff',
'inventory': {'bmc_address': '1.2.3.4'}}
self.assertEqual('[node: NNN MAC aa:bb:cc:dd:ee:ff BMC 1.2.3.4]',
@ -110,7 +110,7 @@ class TestProcessingLogger(base.BaseTest):
data=data))
def test_prefix_uuid_not_str(self):
node_info = node.Node(mock.Mock(), dict(uuid=None))
node_info = mock.Mock(uuid=None, spec=node.Node)
self.assertEqual('[node: None]',
utils.processing_logger_prefix(node_info=node_info))
@ -125,7 +125,7 @@ class TestProcessingLogger(base.BaseTest):
utils.processing_logger_prefix(node_info=node_info))
def test_adapter_with_bmc(self):
node_info = node.Node(mock.Mock(), dict(uuid='NNN'))
node_info = mock.Mock(uuid='NNN', spec=node.Node)
data = {'boot_interface': '01-aa-bb-cc-dd-ee-ff',
'inventory': {'bmc_address': '1.2.3.4'}}
logger = utils.getProcessingLogger(__name__)

View File

@ -15,8 +15,8 @@ import datetime
import logging as pylog
import futurist
from ironicclient.v1 import node
from keystonemiddleware import auth_token
from openstack.baremetal.v1 import node
from oslo_config import cfg
from oslo_log import log
from oslo_middleware import cors as cors_middleware
@ -203,6 +203,7 @@ def check_auth(request, rule=None, target=None):
:param request: Flask request
:param rule: policy rule to check the request against
:param target: dict-like structure to check rule against
:raises: utils.Error if access is denied
"""
if CONF.auth_strategy == 'noauth':

View File

@ -37,7 +37,6 @@ oslotest==3.2.0
oslo.utils==3.33.0
pbr==2.0.0
pymemcache==1.2.9
python-ironicclient==2.3.0
pytz==2013.6
reno==2.5.0
retrying==1.2.3

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The python-ironicclient package has been removed as a dependency in favor
of openstacksdk.
Third party modules and plugins will require an update if they previously
invoked ironicclient.

View File

@ -15,7 +15,6 @@ keystoneauth1>=3.14.0 # Apache-2.0
keystonemiddleware>=4.18.0 # Apache-2.0
netaddr>=0.7.18 # BSD
pbr!=2.1.0,>=2.0.0 # Apache-2.0
python-ironicclient!=2.5.2,!=2.7.1,!=3.0.0,>=2.3.0 # Apache-2.0
pytz>=2013.6 # MIT
openstacksdk>=0.40.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0

View File

@ -76,7 +76,7 @@ import-order-style = pep8
application-import-names = ironic_inspector
[hacking]
import_exceptions = ironicclient.exceptions,ironic_inspector.common.i18n
import_exceptions = ironic_inspector.common.i18n
[testenv:docs]
setenv = PYTHONHASHSEED=0