File tree Expand file tree Collapse file tree 4 files changed +20
-15
lines changed
modules/Misc/Linux_Systemd_Rauc Expand file tree Collapse file tree 4 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -68,11 +68,13 @@ struct UpdateTransaction {
68
68
};
69
69
70
70
enum class HealthCheckStatus {
71
- Success,
72
- ScriptNotSet,
71
+ ScriptExitedWithError,
73
72
ScriptNotExecutable,
73
+ ScriptNotSet,
74
+ ScriptTerminatedBySignal,
74
75
SetupFailed,
75
- ScriptError
76
+ Success,
77
+ UnknownError
76
78
};
77
79
78
80
Operation string_to_operation (const std::string_view& s);
Original file line number Diff line number Diff line change @@ -222,19 +222,19 @@ rauc_messages::HealthCheckStatus RaucBase::check_system_health() {
222
222
return HealthCheckStatus::SetupFailed;
223
223
case everest::lib::system::CMD_TERMINATED:
224
224
EVLOG_error << " Health check script '" << verify_update_script_path << " ' terminated by signal: " << res.code ;
225
- return HealthCheckStatus::ScriptError ;
225
+ return HealthCheckStatus::ScriptTerminatedBySignal ;
226
226
case everest::lib::system::CMD_SUCCESS:
227
227
if (res.code == 0 ) {
228
228
EVLOG_debug << " Health check script '" << verify_update_script_path << " ' returned success" ;
229
229
return HealthCheckStatus::Success;
230
230
} else {
231
231
EVLOG_error << " Health check script '" << verify_update_script_path
232
232
<< " ' returned error code: " << res.code ;
233
- return HealthCheckStatus::ScriptError ;
233
+ return HealthCheckStatus::ScriptExitedWithError ;
234
234
}
235
235
}
236
236
// Should not reach here
237
- return HealthCheckStatus::ScriptError ;
237
+ return HealthCheckStatus::UnknownError ;
238
238
}
239
239
240
240
sdbus::PendingAsyncCall RaucBase::get_operation (property_cb handler) const {
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ std::string cmd_execution_status_to_string(const CommandExecutionStatus& status)
138
138
case CommandExecutionStatus::CMD_SETUP_FAILED:
139
139
return " CMD_SETUP_FAILED" ;
140
140
default :
141
- throw std::runtime_error ( " No known conversion for the given CommandExecutionStatus " ) ;
141
+ return " CMD_UNKNOWN_STATUS " ;
142
142
}
143
143
}
144
144
Original file line number Diff line number Diff line change @@ -115,14 +115,17 @@ bool Rauc::decide_if_good(const rauc_dbus::rauc_messages::UpdateTransaction& sav
115
115
// as reliable as hoped. A change in boot slot should be more reliable
116
116
// however prior to this change the boot slot wasn't saved
117
117
118
- bool result;
119
- if (saved.boot_slot .empty ()) {
120
- // use the previous approach
121
- EVLOG_warning << " OTA: fallback to using primary slot" ;
122
- result = saved.primary_slot == current.primary_slot ;
123
- } else {
124
- // use the new approach
125
- result = saved.boot_slot != current.boot_slot ;
118
+ bool result{false };
119
+
120
+ if (RaucBase::decide_if_good (saved, current)) {
121
+ if (saved.boot_slot .empty ()) {
122
+ // use the previous approach
123
+ EVLOG_warning << " OTA: fallback to using primary slot" ;
124
+ result = saved.primary_slot == current.primary_slot ;
125
+ } else {
126
+ // use the new approach
127
+ result = saved.boot_slot != current.boot_slot ;
128
+ }
126
129
}
127
130
return result;
128
131
}
You can’t perform that action at this time.
0 commit comments