Merge "Fix: ignore resolve error while looking up node"
This commit is contained in:
commit
2be064c715
@ -137,11 +137,8 @@ def get_ipmi_address(node):
|
||||
elif family == socket.AF_INET6:
|
||||
ipv6 = ip
|
||||
except socket.gaierror:
|
||||
msg = _('Failed to resolve the hostname (%(value)s)'
|
||||
' for node %(uuid)s')
|
||||
raise utils.Error(msg % {'value': value,
|
||||
'uuid': node.id},
|
||||
node_info=node)
|
||||
LOG.warning('Failed to resolve the hostname (%s)'
|
||||
' for node %s', value, node.id, node_info=node)
|
||||
|
||||
return (value, ipv4, ipv6) if ipv4 or ipv6 else none_address
|
||||
return none_address
|
||||
|
@ -71,14 +71,6 @@ class TestGetIpmiAddress(base.BaseTest):
|
||||
mock_socket.assert_called_once_with(self.ipmi_address, None, 0, 0,
|
||||
socket.SOL_TCP)
|
||||
|
||||
@mock.patch('socket.getaddrinfo', autospec=True)
|
||||
def test_bad_hostname_errors(self, mock_socket):
|
||||
node = mock.Mock(spec=['driver_info', 'uuid'],
|
||||
driver_info={'ipmi_address': 'meow'},
|
||||
id='uuid1')
|
||||
mock_socket.side_effect = socket.gaierror('Boom')
|
||||
self.assertRaises(utils.Error, ir_utils.get_ipmi_address, node)
|
||||
|
||||
def test_additional_fields(self):
|
||||
node = mock.Mock(spec=['driver_info', 'uuid'],
|
||||
driver_info={'foo': self.ipmi_ipv4})
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
No longer throws an exception if an address of some node cannot be
|
||||
resolved, but just logs a warning instead. This fixes the issue that
|
||||
if an address of any other node is not resolvable, no new node can be
|
||||
registered, even if its own address is resolvable.
|
Loading…
Reference in New Issue
Block a user