I think the documentation is not entirely corrent in some places.
From the documentation on Mender 2.5:
State scripts can either be run as we transition into a state; “Enter”, or out from a state, “Leave”. Most of the states also have an “Error” transition which is run when some error occurs while executing any action inside the given state (including execution of Enter and Leave scripts).
Are you really sure that’s true? I don’t have any logs on hand to support this, but I think I observed that errors in the Enter and Leave scripts lead to different consequences. That would make sense to me, because when there’s an error in the Leave script, whatever was done within the state likely has to be reverted. That’s not the case when there’s an error in the Enter script.
Additionally, I observed the following:
- Errors in ArtifactInstall_Leave will trigger a transition to ArtifactRollback. I couldn’t see this in the docs.
- Errors in ArtifactCommit_Leave lead to the artifact being marked as _INCONSISTENT. There is a seperate page on that issue, but I think the page on the state scripts would benefit from carrying this information as well, or at least linking to that page.
Best regards,
Manuel