Merge "Return serialized node to the ramdisk"

This commit is contained in:
Jenkins 2014-12-05 16:17:20 +00:00 committed by Gerrit Code Review
commit 472537d213
3 changed files with 13 additions and 4 deletions

View File

@ -201,7 +201,12 @@ Change Log
v1.0.0
~~~~~~
* ``/v1/continue`` is now sync and errors are returned.
* ``/v1/continue`` is now sync:
* Errors are properly returned to the caller
* This call now returns value in form of ``{'node': <node dict>}`` on
success
* Option ``power_off_after_discovery`` controls whether to force power off
after the successful discovery, and is ``False`` by default.
* Discovery now times out by default.

View File

@ -81,7 +81,8 @@ def process(node_info):
raise utils.DiscoveryFailed('Node %s is not on discovery' % uuid,
code=403)
_process_node(ironic, node, node_info, valid_macs)
updated = _process_node(ironic, node, node_info, valid_macs)
return {'node': updated.to_dict()}
def _process_node(ironic, node, node_info, valid_macs):
@ -133,7 +134,7 @@ def _process_node(ironic, node, node_info, valid_macs):
patch = [{'op': 'add', 'path': '/extra/newly_discovered', 'value': 'true'},
{'op': 'remove', 'path': '/extra/on_discovery'}]
ironic.node.update(node.uuid, patch)
return ironic.node.update(node.uuid, patch)
def discover(uuids):

View File

@ -100,8 +100,11 @@ class TestProcess(BaseTest):
cli.node.get.return_value = self.node
post_mock.return_value = (['fake patch', 'fake patch 2'],
{'11:22:33:44:55:66': ['port patch']})
self.node.to_dict.return_value = self.data
cli.node.update.side_effect = [None, self.node]
discoverd.process(self.data)
res = discoverd.process(self.data)
self.assertEqual({'node': self.data}, res)
pop_mock.assert_called_once_with(**self.attributes)
cli.node.get.assert_called_once_with(self.node.uuid)