Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-1186

Implement running of event scripts on client state change



    • Type: Task
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      Acceptance criteria:

      • Each one of the states in the script API (MEN-1174) must map to one of Mender's internal states.
        • It's permitted that not all internal states map to a state in the API. Use best judgment here, and think about what the public state API needs.
      • Each script should be located in the directory that is appropriate for that script group, according to the table under "Script locations" in MEN-1174.
      • Before executing any script in var/lib/mender/script, check that the version file in the same directory corresponds to a version the client understands. The same should not be done for scripts in /etc/mender/scripts (because there is no recovery path if it is wrong).
      • Upon entering a new state, but before carrying out any actions in that state, execute the corresponding <state>.Enter scripts, in ascending order of the two leading digits.
      • After script has returned 0, carry on with the normal actions for that state.
      • When entering a new state and thereby leaving the old one, execute the corresponding <state>.Leave scripts, in ascending order of the two leading digits.
      • For most states, a return code of 1 should make the client enter the ArtifactFailure state
        • Except: Idle, Rollback, RollbackReboot and ArtifactFailure should ignore return codes
        • Other non-zero return codes should also have the same behavior, but only error code 1 should be documented (to allow for more diverse behavior later)
        • If an Enter script fails, this will cause later Enter scripts in the same group not to be executed. However, if a Leave script fails, other Leave scripts will still execute.
      • Logs and return codes from each script must be kept on data partition so they can be submitted to server later
      • Deployment log is not sent to server until the ArtifactCommit.Enter script has completed, and after the normal actions for the Commit state have completed (necessary because the log report is the final verification step, and thus all the scripts must have finished by then).


          Issue Links



              a10053 Marcin Pasinski
              a10040 Kristian Amlie
              0 Vote for this issue
              1 Start watching this issue