mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-22 00:57:24 +00:00
Simplify doRestart and doPurge actions
The actions now work by passing an intermediate state to the state engine. - doPurge first removes the user app from the target state and passes that to the state engine for purging. Since intermediate state doesn't remove images, this will have the effect of basically re-installing the app. - doRestart modifies the target state by first removing only the services from the current state but keeping volumes and networks. This has the same effect as before where services were stopped one by one Change-type: patch
This commit is contained in:
@ -123,6 +123,7 @@ export async function getRequiredSteps(
|
||||
currentApps: InstancedAppState,
|
||||
targetApps: InstancedAppState,
|
||||
keepImages?: boolean,
|
||||
keepVolumes?: boolean,
|
||||
): Promise<CompositionStep[]> {
|
||||
// get some required data
|
||||
const [downloading, availableImages, { localMode, delta }] =
|
||||
@ -139,11 +140,15 @@ export async function getRequiredSteps(
|
||||
keepImages = localMode;
|
||||
}
|
||||
|
||||
if (keepVolumes == null) {
|
||||
keepVolumes = localMode;
|
||||
}
|
||||
|
||||
return await inferNextSteps(currentApps, targetApps, {
|
||||
// Images are not removed while in local mode to avoid removing the user app images
|
||||
keepImages,
|
||||
// Volumes are not removed when stopping an app when going to local mode
|
||||
keepVolumes: localMode,
|
||||
keepVolumes,
|
||||
delta,
|
||||
downloading,
|
||||
availableImages,
|
||||
|
Reference in New Issue
Block a user