Custom IoT Job for OTA update - how to get Rejected status?

0

Hello,

We are using the golang sdk v2 to perform ota updates for device firmware. In order to get access to retries and scheduling config, we do not use the CreateOTAUpdate api but rather create the job directly (and signing job and stream). Everything is working fine - we have been able to get the devices to update firmware via this method. However there is one difference - when deploying a version less than or equal to the version running on the device, the jobs created through CreateOTAUpdate will get updated to "Rejected" status, but the jobs created directly get updated to "Failed" status. How can we mimic the OTA Update behavior and get the jobs to have a "Rejected" status in this scenario.

Thanks.

已提問 8 個月前檢視次數 266 次
1 個回答
0

Hi. Are you referring to the job execution status? I believe so: https://docs.aws.amazon.com/iot/latest/apireference/API_JobExecution.html#iot-Type-JobExecution-status

Are you using the OTA library from the embedded C SDK? The version check is performed on the device: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/243786d1aa5db0aca537b24287498c8723beaca4/source/ota.c#L1969

Leading to here: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/243786d1aa5db0aca537b24287498c8723beaca4/source/ota.c#L2219

And eventually here: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/243786d1aa5db0aca537b24287498c8723beaca4/source/ota.c#L708-L712

Per the comment there, the status should be FAILED not REJECTED. This is seemingly confirmed by this: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/main/source/include/ota.h#L191. Searching on jobStatusRejected, it's not used in the library at all.

So as far as I know, REJECTED is not an expected outcome. Can you examine device logs for the two different scenarios?

profile pictureAWS
專家
Greg_B
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南