Browse Source

Merge "baremetal node: 'error' is a failed state" into stable/train

tags/0.36.1^0
Zuul 1 month ago
parent
commit
50c989891e
2 changed files with 14 additions and 1 deletions
  1. +2
    -1
      openstack/baremetal/v1/node.py
  2. +12
    -0
      openstack/tests/unit/baremetal/v1/test_node.py

+ 2
- 1
openstack/baremetal/v1/node.py View File

@@ -487,7 +487,8 @@ class Node(_common.ListMixin, resource.Resource):
elif not abort_on_failed_state:
return False

if self.provision_state.endswith(' failed'):
if (self.provision_state.endswith(' failed') or
self.provision_state == 'error'):
raise exceptions.ResourceFailure(
"Node %(node)s reached failure state \"%(state)s\"; "
"the last error is %(error)s" %

+ 12
- 0
openstack/tests/unit/baremetal/v1/test_node.py View File

@@ -183,6 +183,18 @@ class TestNodeWaitForProvisionState(base.TestCase):
self.node.wait_for_provision_state,
self.session, 'manageable')

def test_failure_error(self, mock_fetch):
def _get_side_effect(_self, session):
self.node.provision_state = 'error'
self.assertIs(session, self.session)

mock_fetch.side_effect = _get_side_effect

self.assertRaisesRegex(exceptions.ResourceFailure,
'failure state "error"',
self.node.wait_for_provision_state,
self.session, 'manageable')

def test_enroll_as_failure(self, mock_fetch):
def _get_side_effect(_self, session):
self.node.provision_state = 'enroll'

Loading…
Cancel
Save