mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 08:25:36 +00:00
Fix purge invocations of new singletons
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
dd972fd75e
commit
d2a7d3b965
@ -1,6 +1,9 @@
|
|||||||
import * as Bluebird from 'bluebird';
|
import * as Bluebird from 'bluebird';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { appNotFoundMessage } from '../lib/messages';
|
import { appNotFoundMessage } from '../lib/messages';
|
||||||
|
import * as logger from '../logger';
|
||||||
|
|
||||||
|
import * as volumes from '../compose/volume-manager';
|
||||||
|
|
||||||
export function doRestart(applications, appId, force) {
|
export function doRestart(applications, appId, force) {
|
||||||
const { _lockingIfNecessary, deviceState } = applications;
|
const { _lockingIfNecessary, deviceState } = applications;
|
||||||
@ -31,7 +34,7 @@ export function doRestart(applications, appId, force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function doPurge(applications, appId, force) {
|
export function doPurge(applications, appId, force) {
|
||||||
const { logger, _lockingIfNecessary, deviceState, volumes } = applications;
|
const { _lockingIfNecessary, deviceState } = applications;
|
||||||
|
|
||||||
logger.logSystemMessage(
|
logger.logSystemMessage(
|
||||||
`Purging data for app ${appId}`,
|
`Purging data for app ${appId}`,
|
||||||
@ -72,16 +75,17 @@ export function doPurge(applications, appId, force) {
|
|||||||
.finally(() => deviceState.triggerApplyTarget());
|
.finally(() => deviceState.triggerApplyTarget());
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.tap(() =>
|
.then(() =>
|
||||||
logger.logSystemMessage('Purged data', { appId }, 'Purge data success'),
|
logger.logSystemMessage('Purged data', { appId }, 'Purge data success'),
|
||||||
)
|
)
|
||||||
.tapCatch((err) =>
|
.catch((err) => {
|
||||||
logger.logSystemMessage(
|
logger.logSystemMessage(
|
||||||
`Error purging data: ${err}`,
|
`Error purging data: ${err}`,
|
||||||
{ appId, error: err },
|
{ appId, error: err },
|
||||||
'Purge data error',
|
'Purge data error',
|
||||||
),
|
);
|
||||||
);
|
throw err;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function serviceAction(action, serviceId, current, target, options) {
|
export function serviceAction(action, serviceId, current, target, options) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user