From fe24280adfca5550c95bb80d30b651bfe4713cf4 Mon Sep 17 00:00:00 2001 From: Scott Lowe Date: Fri, 11 Dec 2020 13:14:12 +0000 Subject: [PATCH] Fix preload command support for application IDs Change-type: patch Resolves: #2063 Signed-off-by: Scott Lowe --- lib/commands/preload.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/commands/preload.ts b/lib/commands/preload.ts index b475de43..b99441b6 100644 --- a/lib/commands/preload.ts +++ b/lib/commands/preload.ts @@ -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: { [key: string]: ReturnType['Progress']; } = {}; @@ -200,7 +211,7 @@ Can be repeated to add multiple certificates.\ if (dontCheckArch && !appId) { 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.', ); }