Merge pull request #2136 from balena-io/fix-preload-app-id

Fix preload command support for application IDs
This commit is contained in:
bulldozer-balena[bot] 2020-12-11 16:41:03 +00:00 committed by GitHub
commit 1f3677bdb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,6 +157,17 @@ Can be repeated to add multiple certificates.\
); );
} }
// balena-preload currently does not work with numerical app IDs
// Load app here, and use app slug from hereon
if (options.app && !options.app.includes('/')) {
const { getApplication } = await import('../utils/sdk');
const application = await getApplication(balena, options.app);
if (!application) {
throw new ExpectedError(`Application not found: ${options.app}`);
}
options.app = application.slug;
}
const progressBars: { const progressBars: {
[key: string]: ReturnType<typeof getVisuals>['Progress']; [key: string]: ReturnType<typeof getVisuals>['Progress'];
} = {}; } = {};
@ -200,7 +211,7 @@ Can be repeated to add multiple certificates.\
if (dontCheckArch && !appId) { if (dontCheckArch && !appId) {
throw new ExpectedError( throw new ExpectedError(
'You need to specify an app id if you disable the architecture check.', 'You need to specify an application if you disable the architecture check.',
); );
} }