Skip to content

Commit 9f32579

Browse files
committed
Addressed requested changes
Signed-off-by: Piet Gömpel <[email protected]>
1 parent 05dc72b commit 9f32579

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

lib/everest/system/include/everest/system/rauc-dbus-base.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ struct UpdateTransaction {
6868
};
6969

7070
enum class HealthCheckStatus {
71-
Success,
72-
ScriptNotSet,
71+
ScriptExitedWithError,
7372
ScriptNotExecutable,
73+
ScriptNotSet,
74+
ScriptTerminatedBySignal,
7475
SetupFailed,
75-
ScriptError
76+
Success,
77+
UnknownError
7678
};
7779

7880
Operation string_to_operation(const std::string_view& s);

lib/everest/system/src/rauc-dbus-base.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,19 @@ rauc_messages::HealthCheckStatus RaucBase::check_system_health() {
222222
return HealthCheckStatus::SetupFailed;
223223
case everest::lib::system::CMD_TERMINATED:
224224
EVLOG_error << "Health check script '" << verify_update_script_path << "' terminated by signal: " << res.code;
225-
return HealthCheckStatus::ScriptError;
225+
return HealthCheckStatus::ScriptTerminatedBySignal;
226226
case everest::lib::system::CMD_SUCCESS:
227227
if (res.code == 0) {
228228
EVLOG_debug << "Health check script '" << verify_update_script_path << "' returned success";
229229
return HealthCheckStatus::Success;
230230
} else {
231231
EVLOG_error << "Health check script '" << verify_update_script_path
232232
<< "' returned error code: " << res.code;
233-
return HealthCheckStatus::ScriptError;
233+
return HealthCheckStatus::ScriptExitedWithError;
234234
}
235235
}
236236
// Should not reach here
237-
return HealthCheckStatus::ScriptError;
237+
return HealthCheckStatus::UnknownError;
238238
}
239239

240240
sdbus::PendingAsyncCall RaucBase::get_operation(property_cb handler) const {

lib/everest/system/src/safe-system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ std::string cmd_execution_status_to_string(const CommandExecutionStatus& status)
138138
case CommandExecutionStatus::CMD_SETUP_FAILED:
139139
return "CMD_SETUP_FAILED";
140140
default:
141-
throw std::runtime_error("No known conversion for the given CommandExecutionStatus");
141+
return "CMD_UNKNOWN_STATUS";
142142
}
143143
}
144144

modules/Misc/Linux_Systemd_Rauc/rauc-dbus.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,17 @@ bool Rauc::decide_if_good(const rauc_dbus::rauc_messages::UpdateTransaction& sav
115115
// as reliable as hoped. A change in boot slot should be more reliable
116116
// however prior to this change the boot slot wasn't saved
117117

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+
}
126129
}
127130
return result;
128131
}

0 commit comments

Comments
 (0)