mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 18:56:24 +00:00
Allow host config patch regardless of running applications
Host config shouldn't be tied to applications in the first place, but needs to be done so because it uses update locks to determine when it's safe to patch host config, and update locks are tied to apps. Change-type: patch Signed-off-by: Christina Wang <christina@balena.io>
This commit is contained in:
parent
dc8b75485c
commit
0fc79e87d9
@ -8,7 +8,7 @@ import * as config from './config';
|
||||
import * as applicationManager from './compose/application-manager';
|
||||
import * as constants from './lib/constants';
|
||||
import * as dbus from './lib/dbus';
|
||||
import { ENOENT, InternalInconsistencyError } from './lib/errors';
|
||||
import { ENOENT } from './lib/errors';
|
||||
import { mkdirp, unlinkAll } from './lib/fs-utils';
|
||||
import { writeToBoot } from './lib/host-utils';
|
||||
import * as updateLock from './lib/update-lock';
|
||||
@ -220,10 +220,9 @@ export function get(): Bluebird<HostConfig> {
|
||||
export async function patch(conf: HostConfig, force: boolean): Promise<void> {
|
||||
const apps = await applicationManager.getCurrentApps();
|
||||
const appIds = Object.keys(apps).map((strId) => parseInt(strId, 10));
|
||||
if (!appIds.length) {
|
||||
throw new InternalInconsistencyError('Could not find an appId');
|
||||
}
|
||||
|
||||
// It's possible for appIds to be an empty array, but patch shouldn't fail
|
||||
// as it's not dependent on there being any running user applications.
|
||||
return updateLock.lock(appIds, { force }, () => {
|
||||
const promises: Array<Promise<void>> = [];
|
||||
if (conf != null && conf.network != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user