-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MEN-7804 - handle no files in artifact #131
base: main
Are you sure you want to change the base?
Conversation
ee43856
to
b4efb25
Compare
f7aea99
to
3aeaa60
Compare
Didn't find a better/simpler way to check if the artifact had a file - lmk if you have a better solution |
3aeaa60
to
fbf1f55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me either way.
@@ -136,6 +139,12 @@ mender_zephyr_image_set_pending_image(MENDER_NDEBUG_UNUSED mender_update_state_t | |||
assert(MENDER_UPDATE_STATE_INSTALL == state); | |||
mender_err_t ret; | |||
|
|||
if (!artifact_has_payload) { | |||
mender_log_error("No file in artifact"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No payload in artifact, maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@@ -29,6 +29,8 @@ | |||
*/ | |||
static void *mcu_boot_flash_handle = NULL; | |||
|
|||
static bool artifact_has_payload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually name this artifact_had_payload
as that reflects that it's only valid after an artifact was processed.
Setting the update module when preparing the data is too late - and it can lead to unexpected behaviour in the state machine if the artifact doesn't contain files. Changelog: None Ticket: MEN-7804 Signed-off-by: Daniel Skinstad Drabitzius <[email protected]>
Check if the aritfact has a payload file by adding a boolean that's set when the download artifact flash callback is called. Ticket: MEN-7804 Signed-off-by: Daniel Skinstad Drabitzius <[email protected]>
fbf1f55
to
7e84363
Compare
Due to
artifact_read_data_prepare
not being called when an artifact doesn't have any files, the update module might be NULL aftermender_http_artifact_download
returns MENDER_OK.Add an explicit check to ensure this is caught.
Changelog: None
Ticket: MEN-7804