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

Python API client for Mender device-side integration



    • Type: Epic
    • Status: Done
    • Priority: (None)
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      In some scenarios there is an existing update agent that is capable of installing software locally (in particular with the A/B image mechanism). It is some times desirable to start with Mender on a new product line, while also being able to update the older product lines using the existing local update agent with the Mender server: the existing update agent is difficult to replace with Mender completely for several reasons, including hardware support and risk of retrofitting Mender in a live environment.

      For these scenarios we propose a very simple Python client that calls the Mender Server's Device API and hands off all the installation logic to the existing local update agent.

      Note that this client is only responsible for the communication with the Mender server, meaning authentication with the server, transport security, reporting inventory, update check, status management, and reporting error logs.

      New Mender Artifacts are downloaded to a well-known location on the local device and the local update agent is solely responsible for it, for example ensuring the integrity and security (signatures) of any payloads are as expected, as well as performing any actions required to apply the update such as rebooting and rolling back in case of failure.

      User value (why)

      • One update system (Mender) covering all the devices, to simplify management and development workflows

      Acceptance criteria

      • The device authentication API is implemented
      • The update check API is implemented
      • The inventory API is implemented
      • It is possible to set the device type of the device and it is reported in relevant API calls (including the update check)
      • Once a new Artifact is downloaded to the device, the local update agent is run with a command to start the update process
      • Once the local update agent is started, the API clients stops and becomes idle (does nothing) until being-reenabled (see below)
      • If there is a failure during download the client will attempt to resume for a period of time
      • It is possible to call the Python API client to signal completion of the update:
        • Two update status reports are supported: Success or Failure and are reported back to the Mender server
        • A log is uploaded to the Mender server upon failure if it is present in a well-known location on the device
      • It is possible to start the API client again, intended to be done explicitly by the local update agent after an update is completed
      • Python daemon is managed by systemd


          Issue Links



              Unassigned Unassigned
              a10003 Eystein Maloy Stenberg
              0 Vote for this issue
              3 Start watching this issue