From 30c36a26e2b791312b2032626268b0cf17f58784 Mon Sep 17 00:00:00 2001 From: Paulo Castro Date: Sat, 27 Apr 2019 00:50:37 +0100 Subject: [PATCH] Handle app names that look like a number (eg 1234) Change-type: patch Signed-off-by: Paulo Castro --- lib/actions/deploy.coffee | 6 ++++-- lib/actions/push.ts | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/actions/deploy.coffee b/lib/actions/deploy.coffee index 2bb0cd25..afc49461 100644 --- a/lib/actions/deploy.coffee +++ b/lib/actions/deploy.coffee @@ -190,10 +190,12 @@ module.exports = appName = undefined Promise.try -> - { appName, image } = params + # when Capitano converts a positional parameter (but not an option) + # to a number, the original value is preserved with the _raw suffix + { appName, appName_raw, image } = params # look into "balena build" options if appName isn't given - appName = options.application if not appName? + appName = appName_raw || appName || options.application delete options.application validateComposeOptions(options) diff --git a/lib/actions/push.ts b/lib/actions/push.ts index 4382acf2..7df75563 100644 --- a/lib/actions/push.ts +++ b/lib/actions/push.ts @@ -99,7 +99,10 @@ async function getAppOwner(sdk: BalenaSDK, appName: string) { export const push: CommandDefinition< { + // when Capitano converts a positional parameter (but not an option) + // to a number, the original value is preserved with the _raw suffix applicationOrDevice: string; + applicationOrDevice_raw: string; }, { source: string; @@ -235,7 +238,8 @@ export const push: CommandDefinition< ); const { BuildError } = await import('../utils/device/errors'); - const appOrDevice: string | null = params.applicationOrDevice; + const appOrDevice: string | null = + params.applicationOrDevice_raw || params.applicationOrDevice; if (appOrDevice == null) { exitWithExpectedError('You must specify an application or a device'); }