Merge "inspect_utils, handle bracketed IPv6 redfish addr"
This commit is contained in:
commit
bc1c89d993
@ -342,6 +342,9 @@ def _get_bmc_addresses(node):
|
||||
if '//' in address:
|
||||
address = urllib.parse.urlparse(address).hostname
|
||||
|
||||
# Strip brackets in case used on IPv6 address.
|
||||
address = address.strip('[').strip(']')
|
||||
|
||||
try:
|
||||
addrinfo = socket.getaddrinfo(address, None, proto=socket.SOL_TCP)
|
||||
except socket.gaierror as exc:
|
||||
|
@ -442,6 +442,12 @@ class GetBMCAddressesTestCase(db_base.DbTestCase):
|
||||
driver_info={'redfish_address': 'https://192.0.2.1/redfish'})
|
||||
self.assertEqual({'192.0.2.1'}, utils._get_bmc_addresses(node))
|
||||
|
||||
def test_normal_ipv6_as_url(self):
|
||||
node = obj_utils.create_test_node(
|
||||
self.context,
|
||||
driver_info={'redfish_address': 'https://[2001:db8::42]/redfish'})
|
||||
self.assertEqual({'2001:db8::42'}, utils._get_bmc_addresses(node))
|
||||
|
||||
@mock.patch.object(socket, 'getaddrinfo', autospec=True)
|
||||
def test_resolved_host(self, mock_getaddrinfo):
|
||||
mock_getaddrinfo.return_value = [
|
||||
@ -474,6 +480,12 @@ class GetBMCAddressesTestCase(db_base.DbTestCase):
|
||||
mock_getaddrinfo.assert_called_once_with(
|
||||
'example.com', None, proto=socket.SOL_TCP)
|
||||
|
||||
def test_redfish_bmc_address_ipv6_brackets_no_scheme(self):
|
||||
node = obj_utils.create_test_node(
|
||||
self.context,
|
||||
driver_info={'redfish_address': '[2001:db8::42]'})
|
||||
self.assertEqual({'2001:db8::42'}, utils._get_bmc_addresses(node))
|
||||
|
||||
|
||||
class LookupCacheTestCase(db_base.DbTestCase):
|
||||
|
||||
|
6
releasenotes/notes/bug-2036455-edd0e97335579684.yaml
Normal file
6
releasenotes/notes/bug-2036455-edd0e97335579684.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue where inspection would fail if an IPv6 address wrapped in
|
||||
brackets is used for the redfish BMC address. See bug:
|
||||
`2036455 <https://bugs.launchpad.net/ironic/+bug/2036455>`_.
|
Loading…
Reference in New Issue
Block a user