Merge "eDeploy: Store all of the facts collected by edeploy in Ironic DB"
This commit is contained in:
commit
91fd4d79e8
|
@ -74,6 +74,7 @@ class eDeployHook(base.ProcessingHook):
|
||||||
node_info['bios_settings'] = var.pop('bios_settings')
|
node_info['bios_settings'] = var.pop('bios_settings')
|
||||||
|
|
||||||
node_info['hardware'] = var
|
node_info['hardware'] = var
|
||||||
|
node_info['edeploy_facts'] = hw_items
|
||||||
|
|
||||||
except Exception as excpt:
|
except Exception as excpt:
|
||||||
LOG.warning(_LW(
|
LOG.warning(_LW(
|
||||||
|
@ -124,6 +125,11 @@ class eDeployHook(base.ProcessingHook):
|
||||||
'path': '/properties/capabilities',
|
'path': '/properties/capabilities',
|
||||||
'value': utils.dict_to_capabilities(capabilities_dict)})
|
'value': utils.dict_to_capabilities(capabilities_dict)})
|
||||||
|
|
||||||
|
patches.append(
|
||||||
|
{'op': 'add',
|
||||||
|
'path': '/extra/edeploy_facts',
|
||||||
|
'value': node_info['edeploy_facts']})
|
||||||
|
|
||||||
if 'target_raid_configuration' in node_info:
|
if 'target_raid_configuration' in node_info:
|
||||||
patches.append(
|
patches.append(
|
||||||
{'op': 'add',
|
{'op': 'add',
|
||||||
|
|
|
@ -54,6 +54,9 @@ class TestEdeploy(test_base.NodeTest):
|
||||||
self.assertEqual('192.168.100.12', node_info['hardware']['ipv4'])
|
self.assertEqual('192.168.100.12', node_info['hardware']['ipv4'])
|
||||||
self.assertEqual('99:99:99:99:99:99',
|
self.assertEqual('99:99:99:99:99:99',
|
||||||
node_info['interfaces']['eth0']['mac'])
|
node_info['interfaces']['eth0']['mac'])
|
||||||
|
self.assertEqual([('network', 'eth0', 'serial', '99:99:99:99:99:99'),
|
||||||
|
('network', 'eth0', 'ipv4', '192.168.100.12')],
|
||||||
|
node_info['edeploy_facts'])
|
||||||
node_patches, _ = hook.before_update(self.node, None, node_info)
|
node_patches, _ = hook.before_update(self.node, None, node_info)
|
||||||
self.assertEqual('/extra/configdrive_metadata',
|
self.assertEqual('/extra/configdrive_metadata',
|
||||||
node_patches[0]['path'])
|
node_patches[0]['path'])
|
||||||
|
@ -63,11 +66,15 @@ class TestEdeploy(test_base.NodeTest):
|
||||||
node_patches[1]['path'])
|
node_patches[1]['path'])
|
||||||
self.assertEqual('profile:hw1',
|
self.assertEqual('profile:hw1',
|
||||||
node_patches[1]['value'])
|
node_patches[1]['value'])
|
||||||
|
self.assertEqual('/extra/edeploy_facts',
|
||||||
|
node_patches[2]['path'])
|
||||||
|
self.assertEqual(('network', 'eth0', 'serial', '99:99:99:99:99:99'),
|
||||||
|
node_patches[2]['value'][0])
|
||||||
|
|
||||||
def test_hook_multiple_capabilities(self):
|
def test_hook_multiple_capabilities(self):
|
||||||
hook = edeploy.eDeployHook()
|
hook = edeploy.eDeployHook()
|
||||||
self.node.properties['capabilities'] = 'cat:meow,profile:robin'
|
self.node.properties['capabilities'] = 'cat:meow,profile:robin'
|
||||||
node_info = {'hardware': {'profile': 'batman'}}
|
node_info = {'hardware': {'profile': 'batman'}, 'edeploy_facts': []}
|
||||||
node_patches, _ = hook.before_update(self.node, None, node_info)
|
node_patches, _ = hook.before_update(self.node, None, node_info)
|
||||||
self.assertIn('cat:meow', node_patches[1]['value'])
|
self.assertIn('cat:meow', node_patches[1]['value'])
|
||||||
self.assertIn('profile:batman', node_patches[1]['value'])
|
self.assertIn('profile:batman', node_patches[1]['value'])
|
||||||
|
@ -113,7 +120,7 @@ class TestEdeploy(test_base.NodeTest):
|
||||||
|
|
||||||
node_patches, _ = hook.before_update(self.node, None, node_info)
|
node_patches, _ = hook.before_update(self.node, None, node_info)
|
||||||
self.assertEqual('/extra/target_raid_configuration',
|
self.assertEqual('/extra/target_raid_configuration',
|
||||||
node_patches[2]['path'])
|
node_patches[3]['path'])
|
||||||
|
|
||||||
@mock.patch.object(cmdb, 'load_cmdb')
|
@mock.patch.object(cmdb, 'load_cmdb')
|
||||||
def test_bios_configuration_passed(self, mock_load_cmdb):
|
def test_bios_configuration_passed(self, mock_load_cmdb):
|
||||||
|
@ -130,4 +137,4 @@ class TestEdeploy(test_base.NodeTest):
|
||||||
|
|
||||||
node_patches, _ = hook.before_update(self.node, None, node_info)
|
node_patches, _ = hook.before_update(self.node, None, node_info)
|
||||||
self.assertEqual('/extra/bios_settings',
|
self.assertEqual('/extra/bios_settings',
|
||||||
node_patches[2]['path'])
|
node_patches[3]['path'])
|
||||||
|
|
Loading…
Reference in New Issue