From 22db498ea1d02119d7662f566e299d04a09e9ae5 Mon Sep 17 00:00:00 2001 From: Jan Horstmann Date: Fri, 30 Aug 2019 11:42:27 +0200 Subject: [PATCH] Fix typo in handling of exception FailedToGetIPAddressOnPort Function create_pxe_config in ironic/common/pxe_utils.py tried to handle exception FailedToGetIPaddressesOnPort. However, the raised exception is called FailedToGetIPAddressOnPort. Change-Id: I33e51f064daa0a0d70dd87e163d401c0e7b922bc Story: 2006478 Task: 36419 --- ironic/common/pxe_utils.py | 2 +- ironic/tests/unit/common/test_pxe_utils.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py index ddbfdc004f..e77191b685 100644 --- a/ironic/common/pxe_utils.py +++ b/ironic/common/pxe_utils.py @@ -308,7 +308,7 @@ def create_pxe_config(task, pxe_options, template=None, ipxe_enabled=False): # dhcp_provider interface is set to none. This will result # in the MAC addresses and DHCP files being written, and # we can remove IP address creation for the grub use. - except exception.FailedToGetIPaddressesOnPort as e: + except exception.FailedToGetIPAddressOnPort as e: if CONF.dhcp.dhcp_provider != 'none': with excutils.save_and_reraise_exception(): LOG.error('Unable to create boot config, IP address ' diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index 1085a978b3..c84ac21042 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -492,8 +492,9 @@ class TestPXEUtils(db_base.DbTestCase): # TODO(TheJulia): We should... like... fix the template to # enable mac address usage..... grub_tmplte = "ironic/drivers/modules/pxe_grub_config.template" - link_ip_configs_mock.side_efect = exception.FailedToGetIPAddressOnPort( - port_id='blah') + self.config(dhcp_provider='none', group='dhcp') + link_ip_configs_mock.side_effect = \ + exception.FailedToGetIPAddressOnPort(port_id='blah') with task_manager.acquire(self.context, self.node.uuid) as task: task.node.properties['capabilities'] = 'boot_mode:uefi' pxe_utils.create_pxe_config(task, self.pxe_options,