Reset error_type if problem with ip was resolved
Also revert detecting error status by error_type, because there is no gurarantee that error_type is reseted in all places. need to prepare proper fix for error_type Change-Id: I6de0b99eced36fa011f1fb45cf56c895b9fa3372 Closes-bug: 1617193
This commit is contained in:
parent
5a89e0370b
commit
4f49abcaf5
|
@ -89,9 +89,6 @@ class Node(NailgunObject):
|
|||
return consts.NODE_STATUSES.provisioning
|
||||
return consts.NODE_STATUSES.deploying
|
||||
|
||||
# if error_type is set, the node is treated as in error state
|
||||
if instance.error_type:
|
||||
return consts.NODE_STATUSES.error
|
||||
return instance.status
|
||||
|
||||
@classmethod
|
||||
|
@ -813,6 +810,9 @@ class Node(NailgunObject):
|
|||
instance.status = data_status
|
||||
else:
|
||||
instance.status = consts.NODE_STATUSES.discover
|
||||
|
||||
if data_status != consts.NODE_STATUSES.error:
|
||||
instance.error_type = None
|
||||
else:
|
||||
data.pop('status', None)
|
||||
return cls.update(instance, data)
|
||||
|
|
|
@ -328,6 +328,7 @@ class TestHandlers(BaseIntegrationTest):
|
|||
|
||||
self.assertEqual(node.ip, ipaddress)
|
||||
self.assertEqual(node.status, consts.NODE_STATUSES.error)
|
||||
self.assertEqual(node.error_type, consts.NODE_ERRORS.discover)
|
||||
notif = self.db.query(Notification).filter_by(
|
||||
node_id=node.id,
|
||||
topic='error'
|
||||
|
@ -346,6 +347,7 @@ class TestHandlers(BaseIntegrationTest):
|
|||
|
||||
self.assertEqual(node.ip, ipaddress)
|
||||
self.assertEqual(node.status, consts.NODE_STATUSES.discover)
|
||||
self.assertIsNone(node.error_type)
|
||||
|
||||
def test_update_node_with_none_ip(self):
|
||||
node = self.env.create_node(api=False, ip='10.20.0.2')
|
||||
|
|
|
@ -2093,7 +2093,7 @@ class TestNodeStatus(BaseTestCase):
|
|||
|
||||
def test_error_state(self):
|
||||
node = self.node
|
||||
node.status = consts.NODE_STATUSES.ready
|
||||
node.status = consts.NODE_STATUSES.error
|
||||
node.error_type = consts.NODE_ERRORS.deploy
|
||||
self.assertEqual(
|
||||
consts.NODE_STATUSES.error, objects.Node.get_status(node)
|
||||
|
|
|
@ -122,7 +122,7 @@ class TestNodeForRedeploy(BaseUnitTest):
|
|||
self.assertTrue(
|
||||
manager._is_node_for_redeploy(mock.MagicMock(
|
||||
pending_addition=False, error_type=consts.NODE_ERRORS.deploy,
|
||||
progress=0, status=consts.NODE_STATUSES.ready
|
||||
progress=0, status=consts.NODE_STATUSES.error
|
||||
))
|
||||
)
|
||||
self.assertTrue(
|
||||
|
|
Loading…
Reference in New Issue