Fix check for preloaded v2 target state

This commit is contained in:
Felipe Lalanne 2022-05-24 17:37:58 -04:00
parent 95bf4718d6
commit 303c805008

View File

@ -2,6 +2,7 @@ import * as _ from 'lodash';
import { promises as fs } from 'fs';
import { Image, imageFromService } from '../compose/images';
import { NumericIdentifier } from '../types';
import * as deviceState from '../device-state';
import * as config from '../config';
import * as deviceConfig from '../device-config';
@ -66,11 +67,7 @@ export async function loadTargetFromFile(appsPath: string): Promise<boolean> {
}
// if apps.json apps are keyed by numeric ids, then convert to v3 target state
if (
Object.keys(stateFromFile.apps || {}).some(
(appId) => !isNaN(parseInt(appId, 10)),
)
) {
if (Object.keys(stateFromFile.apps || {}).some(NumericIdentifier.is)) {
stateFromFile = await fromV2AppsJson(stateFromFile as any);
}