Azure / iot-hub-device-update

Device Update for IoT Hub agent
MIT License
51 stars 36 forks source link

Is_Installed Step runs multiple times in swupdatev2 handler #631

Open agreentree-dmc opened 1 month ago

agreentree-dmc commented 1 month ago

I am using ADU v1.1.0 with the swupdatev2 handler, with a deployment script, based heavily on the provided example script.

The update agent invokes the script with the argument --action-is-installed several times when the is installed step reports a 901 (ADUC_Result_IsInstalled_NotInstalled) result code. When the is installed action reports a 900 (ADUC_Result_IsInstalled_Installed) result code, the action does not repeat. You can see the handler invoke the script multiple times with the --action-is-installed argument in the logs section below.

Expected Behavior

Is invoking it multiple times expected behavior? I would expected the script is invoked with the --action-is-installed argument only once regardless of if the result code is 900 or 901 and would consider this a bug. If this is expected, is there any documentation available so I can better understand how many times each action is invoked based on the result codes?

Current Behavior

Swupdatev2 handler invokes the install script with the argument --action-is-installed multiple times if the result code is 901.

Steps to Reproduce

  1. Install ADU v1.1.0 with swupdate step handler enabled.
  2. Run an update that invokes a script which runs a function when the --action-is-installed argument is passed. Return a 901 result code from the function.
  3. Observe the function is executed multiple times.

Device Information

Logs

Shown here is the example of deploying an update where the installed criteria is not met. You can see the script is called multiple times (distinct process ids) with the --action-is-installed argument. This is all for a single run of the update. image

agreentree-dmc commented 2 weeks ago

@eshashah-msft Curious if you had time to take a look at this? Were you able to reproduce this issue?