Merge "Remove bogus conditional from node_update"

This commit is contained in:
Jenkins 2015-06-03 13:47:21 +00:00 committed by Gerrit Code Review
commit f87bad418f
3 changed files with 1 additions and 26 deletions

View File

@ -313,11 +313,6 @@ class NodeInMaintenance(Invalid):
"%(node)s because it's in maintenance mode.")
class NodeInWrongPowerState(InvalidState):
message = _("Can not change instance association while node "
"%(node)s is in power state %(pstate)s.")
class ChassisNotEmpty(Invalid):
message = _("Cannot complete the requested action because chassis "
"%(chassis)s contains nodes.")

View File

@ -370,14 +370,10 @@ class ConductorManager(periodic_task.PeriodicTasks):
node_id = node_obj.uuid
LOG.debug("RPC update_node called for node %s." % node_id)
delta = node_obj.obj_what_changed()
if 'power_state' in delta:
raise exception.IronicException(_(
"Invalid method call: update_node can not change node state."))
# NOTE(jroll) clear maintenance_reason if node.update sets
# maintenance to False for backwards compatibility, for tools
# not using the maintenance endpoint.
delta = node_obj.obj_what_changed()
if 'maintenance' in delta and not node_obj.maintenance:
node_obj.maintenance_reason = None

View File

@ -789,22 +789,6 @@ class TestPatch(test_api_base.FunctionalTest):
self.assertEqual('application/json', response.content_type)
self.assertEqual(400, response.status_code)
def test_update_fails_bad_state(self):
fake_err = 'Fake Power State'
self.mock_update_node.side_effect = exception.NodeInWrongPowerState(
node=self.node.uuid, pstate=fake_err)
response = self.patch_json('/nodes/%s' % self.node.uuid,
[{'path': '/instance_uuid',
'value': 'aaaaaaaa-1111-bbbb-2222-cccccccccccc',
'op': 'replace'}],
expect_errors=True)
self.assertEqual('application/json', response.content_type)
self.assertEqual(409, response.status_code)
self.mock_update_node.assert_called_once_with(
mock.ANY, mock.ANY, 'test-topic')
def test_add_ok(self):
self.mock_update_node.return_value = self.node