Repository navigation
Conversation
Python test results2 558 tests +21 2 553 ✅ +21 1m 43s ⏱️ -13s Results for commit d8e3b9e. ± Comparison against base commit 7f3639a. This pull request removes 2 and adds 23 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
f998723 to
ab8ff17
Compare
ab8ff17 to
d8e3b9e
Compare
| return str(node.uuid) | ||
| except Exception as exc: | ||
| try: | ||
| ironic_node.set_maintenance(node, maintenance_reason(exc)) |
There was a problem hiding this comment.
This also fires when the failure is just our own wait running out of time. If cleaning after provide runs past NODE_STATE_TIMEOUT_SECS, wait_for_provision_state raises while the node is still in clean wait, and we put it into maintenance mid-operation. Ironic doesn't act on agent heartbeats from a node in maintenance (_heartbeat_in_maintenance either logs "not taking any action" or, with allow_provisioning_in_maintenance=False, aborts cleaning), so the node never reaches available. A re-run can't recover it either, because clean wait isn't in ENROLLABLE_STATES, so someone has to abort and clear maintenance by hand. Before this change that node would have finished on its own.
Please re-fetch the node here and skip setting maintenance when it's still in a * wait or otherwise in-progress state, and add a test for the timeout path.
| # Enrollment is a deliberate operator action, so clear maintenance | ||
| # before touching the node. Ironic refuses manual cleaning (runbooks) | ||
| # in maintenance and pauses automated cleaning until it is cleared. | ||
| if node.maintenance: |
There was a problem hiding this comment.
Not a requirement, but what do you think about only clearing maintenance when maintenance_reason starts with MAINTENANCE_REASON_PREFIX? As written, a re-enroll also clears maintenance an operator set for an unrelated reason (e.g. "bad DIMM, do not use"), and that reason only survives in the log. If it isn't ours we could refuse and tell the operator to clear it first. Would you agree with that?
|
|
||
| def maintenance_reason(exc: Exception) -> str: | ||
| """Format an enrollment failure as an Ironic maintenance reason.""" | ||
| message = str(exc) or f"failed with {type(exc).__name__}" |
There was a problem hiding this comment.
We need to make sure this can never put the BMC password on the node. maintenance_reason is readable by anyone with node read access, and this is the raw exception text with none of the redaction we do in _redact_patches / _redact_updates. update_ironic_node sends driver_info/redfish_password, so if Ironic or ironicclient rejects that patch with an error that echoes the patch back, the password ends up here. Please scrub the BMC credentials out of the message (or use a generic reason for failures coming out of the update), and add a test that feeds an exception containing the password through this and asserts it doesn't come out.
The enrol workflow now puts the Ironic node into maintenance mode when enrolment fails. The failure goes into the maintenance reason with an "enroll: " prefix, cut to 200 characters.
I tried not to change the existing behaviour, although I did deliberately change the "success" message which now reads "Enroll successful for node {uuid} {name} {ip_address}"