Merge pull request #1194 from balena-io/1187-numeric-app-name

Handle app names that look like a number (e.g. 1234)
This commit is contained in:
Paulo Castro 2019-04-29 11:11:15 +01:00 committed by GitHub
commit 88ad591a83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -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');
}