Skip to content

Commit

Permalink
Fix setting Status parameter value (#103)
Browse files Browse the repository at this point in the history
Co-authored-by: Madelen Andersson <madelen.andersson@axis.com>
Co-authored-by: madelen-at-work <madelen-at-work@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 12, 2024
1 parent b56e9ea commit eabf0a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ Following are the possible values of `Status`:
0 RUNNING The application is started and dockerd is running.
1 TLS CERT MISSING Use TLS is selected but there but certificates are missing on the device.
The application is running but dockerd is stopped.
Upload certificates and restart the application.
Upload certificates and restart the application or de-select Use TLS.
2 NO SOCKET Neither TCP Socket or IPC Socket are selected.
The application has stopped.
Select one or both sockets and start the application.
The application is running but dockerd is stopped.
Select one or both sockets.
3 NO SD CARD Use SD Card is selected but no SD Card is mounted in the device.
The application is running but dockerd is stopped.
Insert and mount a SD Card.
Expand All @@ -289,7 +289,12 @@ Following are the possible values of `Status`:
permissions to use it.
The application is running but dockerd is stopped.
Make sure no directories with the wrong user permissions are left on the
SD Card.
SD Card. Then restart the application.
6 SD CARD MIGRATION FAILED Use SD Card is selected but migrating data from the old data root location to the
new one has failed.
The application is running but dockerd is stopped.
Manually back up and remove either the old data root folder, or the new
data root folder, from the SD card. Then restart the application.
```

## Building the Docker Compose ACAP
Expand Down
6 changes: 5 additions & 1 deletion app/dockerdwrapperwithcompose.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ typedef enum {
STATUS_NO_SD_CARD,
STATUS_SD_CARD_WRONG_FS,
STATUS_SD_CARD_WRONG_PERMISSION,
STATUS_SD_CARD_MIGRATION_FAILED,
STATUS_CODE_COUNT,
} status_code_t;

Expand All @@ -56,7 +57,8 @@ static const char* const status_code_strs[STATUS_CODE_COUNT] = {"-1 NOT STARTED"
"2 NO SOCKET",
"3 NO SD CARD",
"4 SD CARD WRONG FS",
"5 SD CARD WRONG PERMISSION"};
"5 SD CARD WRONG PERMISSION",
"6 SD CARD MIGRATION FAILED"};

struct settings {
char* data_root;
Expand Down Expand Up @@ -351,6 +353,7 @@ static bool setup_sdcard(AXParameter* param_handle, const char* data_root) {

if (!migrate_from_old_sdcard_setup(data_root)) {
log_error("Failed to migrate data from old data-root");
set_status_parameter(param_handle, STATUS_SD_CARD_MIGRATION_FAILED);
return false;
}

Expand Down Expand Up @@ -381,6 +384,7 @@ static char* prepare_data_root(AXParameter* param_handle, const char* sd_card_ar
if (is_parameter_yes(param_handle, PARAM_SD_CARD_SUPPORT)) {
if (!sd_card_area) {
log_error("SD card was requested, but no SD card is available at the moment.");
set_status_parameter(param_handle, STATUS_NO_SD_CARD);
return NULL;
}
char* data_root = g_strdup_printf("%s/data", sd_card_area);
Expand Down

0 comments on commit eabf0a6

Please sign in to comment.