Fix purge invocations of new singletons

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2020-07-20 18:17:01 +01:00
parent dd972fd75e
commit d2a7d3b965

View File

@ -1,6 +1,9 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import { appNotFoundMessage } from '../lib/messages';
import * as logger from '../logger';
import * as volumes from '../compose/volume-manager';
export function doRestart(applications, appId, force) {
const { _lockingIfNecessary, deviceState } = applications;
@ -31,7 +34,7 @@ export function doRestart(applications, appId, force) {
}
export function doPurge(applications, appId, force) {
const { logger, _lockingIfNecessary, deviceState, volumes } = applications;
const { _lockingIfNecessary, deviceState } = applications;
logger.logSystemMessage(
`Purging data for app ${appId}`,
@ -72,16 +75,17 @@ export function doPurge(applications, appId, force) {
.finally(() => deviceState.triggerApplyTarget());
}),
)
.tap(() =>
.then(() =>
logger.logSystemMessage('Purged data', { appId }, 'Purge data success'),
)
.tapCatch((err) =>
.catch((err) => {
logger.logSystemMessage(
`Error purging data: ${err}`,
{ appId, error: err },
'Purge data error',
),
);
);
throw err;
});
}
export function serviceAction(action, serviceId, current, target, options) {