-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fail deployment on spontaneous reboot #175
base: main
Are you sure you want to change the base?
chore: fail deployment on spontaneous reboot #175
Conversation
6621c64
to
27d6250
Compare
See motivation for this change: - https://docs.mender.io/artifact-creation/state-scripts#power-loss A spontaneous reboot / power loss is detected when the stored state is something other than `MENDER_UPDATE_STATE_VERIFY_REBOOT` or `MENDER_UPDATE_STATE_ROLLBACK_VERIFY_REBOOT`. Ticket: MEN-8197 Signed-off-by: Daniel Skinstad Drabitzius <[email protected]>
27d6250
to
89ebbfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I don't think it's a good idea to use a negative condition in one place (not one of these two states) and then add handling of the case based on a positive condition (is one of these states). I'd prefer using the same condition in both places -- client initialization and the work function. And I'd probably even do it before the while-switch block.
spontaneous_reboot = false; | ||
ret = MENDER_FAIL; | ||
NEXT_STATE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the REBOOT
state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs say Power loss is allowed to happen within any Reboot state, since it may be indistinguishable from a normal reboot
/* Check for a spontaneous reboot */ | ||
mender_update_state_t update_state; | ||
if (MENDER_OK == (ret = mender_deployment_data_get_state(mender_client_deployment_data, &update_state))) { | ||
if ((MENDER_UPDATE_STATE_VERIFY_REBOOT != update_state) && (MENDER_UPDATE_STATE_ROLLBACK_VERIFY_REBOOT != update_state)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOWNLOAD
state should be ok, right?
See motivation for this change:
A spontaneous reboot / power loss is detected when the stored state is something other than
MENDER_UPDATE_STATE_VERIFY_REBOOT
orMENDER_UPDATE_STATE_ROLLBACK_VERIFY_REBOOT
.Ticket: MEN-8197