Message ID | 20201006160048.114379-1-sava.jakovljev@teufel.de |
---|---|
State | Accepted |
Headers | show |
Series | [v2] Suricatta: Fix activation IPC behavior when Hawkbit is not accessible | expand |
On 06.10.20 18:00, Sava Jakovljev wrote: > * Stop further processing of activation IPC request when Hawkbit > is not reachable, and return NACK to the caller. > > Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de> > --- > suricatta/server_hawkbit.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c > index c9911f1..dbe18a0 100644 > --- a/suricatta/server_hawkbit.c > +++ b/suricatta/server_hawkbit.c > @@ -1883,7 +1883,15 @@ static server_op_res_t server_activation_ipc(ipc_message *msg) > result = > server_get_deployment_info(server_hawkbit.channel, &channel_data, &server_action_id); > > - server_op_res_t response = SERVER_OK; > + if (result != SERVER_OK && result != SERVER_UPDATE_AVAILABLE && > + result != SERVER_NO_UPDATE_AVAILABLE && > + result != SERVER_UPDATE_CANCELED && result != SERVER_ID_REQUESTED) { > + DEBUG("Hawkbit is not accessible, bailing out (%d)", result); > + result = SERVER_EERR; > + goto cleanup; > + } > + > + server_op_res_t response = SERVER_OK; > > if (result == SERVER_UPDATE_CANCELED) { > DEBUG("Acknowledging cancelled update."); > @@ -1920,6 +1928,7 @@ static server_op_res_t server_activation_ipc(ipc_message *msg) > > msg->data.instmsg.len = 0; > > +cleanup: > free(details); > > return result; > Applied to -master, thanks ! Best regards, Stefano Babic
diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index c9911f1..dbe18a0 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -1883,7 +1883,15 @@ static server_op_res_t server_activation_ipc(ipc_message *msg) result = server_get_deployment_info(server_hawkbit.channel, &channel_data, &server_action_id); - server_op_res_t response = SERVER_OK; + if (result != SERVER_OK && result != SERVER_UPDATE_AVAILABLE && + result != SERVER_NO_UPDATE_AVAILABLE && + result != SERVER_UPDATE_CANCELED && result != SERVER_ID_REQUESTED) { + DEBUG("Hawkbit is not accessible, bailing out (%d)", result); + result = SERVER_EERR; + goto cleanup; + } + + server_op_res_t response = SERVER_OK; if (result == SERVER_UPDATE_CANCELED) { DEBUG("Acknowledging cancelled update."); @@ -1920,6 +1928,7 @@ static server_op_res_t server_activation_ipc(ipc_message *msg) msg->data.instmsg.len = 0; +cleanup: free(details); return result;
* Stop further processing of activation IPC request when Hawkbit is not reachable, and return NACK to the caller. Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de> --- suricatta/server_hawkbit.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)