Merge "Raise exception when no IPs found" into stable/queens
This commit is contained in:
commit
67dd88c04d
|
@ -210,6 +210,9 @@ class TripleoInventory(object):
|
|||
for n in names]
|
||||
# Create a group per hostname to map hostname to IP
|
||||
ips = role_net_ip_map[role][self.host_network]
|
||||
if not ips:
|
||||
raise Exception("No IPs found for %s role on %s network"
|
||||
% (role, self.host_network))
|
||||
hosts = {}
|
||||
for idx, name in enumerate(shortnames):
|
||||
hosts[name] = {}
|
||||
|
|
|
@ -154,6 +154,12 @@ class TestInventory(base.TestCase):
|
|||
self.assertTrue(self.hclient.called_once_with('overcloud',
|
||||
'KeystoneURL'))
|
||||
|
||||
def test_no_ips(self):
|
||||
for output in self.outputs_data['outputs']:
|
||||
if output['output_key'] == 'RoleNetIpMap':
|
||||
output['output_value'] = dict(Controller=dict(ctlplane=[]))
|
||||
self.assertRaises(Exception, self.inventory.list) # noqa: H202
|
||||
|
||||
def test_outputs_invalid_key_raises_keyerror(self):
|
||||
self.assertRaises(KeyError, lambda: self.outputs['Invalid'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue