Skip to content
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

composeappmanager: Stop apps only if rootfs update is expected #362

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/composeappmanager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,19 @@ data::InstallationResult ComposeAppManager::install(const Uptane::Target& target
// the subsequent "sync target" process will restart the apps (excluding those removed from the configuration).
stopDisabledComposeApps(target);

// Stopping the Apps that is about to be updated so they are not started automatically by dockerd just after reboot.
// If ostree is not updated then the updated Apps will be started in this context.
// If ostree is updated and a device is suddenly rebooted before Apps installation, then
// it ensures that the previous version Apps are not automatically started on boot.
// If an installation failure happens, then the following "sync target" process will re-start
// the stopped Apps (app only rollback).
for (const auto& pair : cur_apps_to_fetch_and_update_) {
LOG_INFO << "Stopping App before updating it; " << pair.first << " -> " << pair.second;
auto& non_const_app_engine = (const_cast<ComposeAppManager*>(this))->app_engine_;
non_const_app_engine->stop({pair.first, pair.second});
if (getCurrent().sha256Hash() != target.sha256Hash()) {
// If this ostree + apps update, then stop the Apps that is about to be updated
// so they are not started automatically by dockerd just after reboot.
// If ostree is not updated then the updated Apps will be started in this context.
// If ostree is updated and a device is suddenly rebooted before Apps installation, then
// it ensures that the previous version Apps are not automatically started on boot.
// If an installation failure happens, then the following "sync target" process will re-start
// the stopped Apps (app only rollback).
for (const auto& pair : cur_apps_to_fetch_and_update_) {
LOG_INFO << "Stopping App before updating it; " << pair.first << " -> " << pair.second;
auto& non_const_app_engine = (const_cast<ComposeAppManager*>(this))->app_engine_;
non_const_app_engine->stop({pair.first, pair.second});
}
}

data::InstallationResult res{RootfsTreeManager::install(target)};
Expand Down
Loading