tunnel: Fix incorrect parsing of numeric short UUIDs

Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
Thodoris Greasidis 2019-06-26 13:44:22 +03:00
parent 1d3af3245a
commit f0030a1891

View File

@ -25,6 +25,9 @@ import { tunnelConnectionToDevice } from '../utils/tunnel';
interface Args {
deviceOrApplication: string;
// when Capitano converts a positional parameter (but not an option)
// to a number, the original value is preserved with the _raw suffix
deviceOrApplication_raw: string;
}
interface Options {
@ -88,6 +91,8 @@ export const tunnel: CommandDefinition<Args, Options> = {
primary: true,
action: async (params, options) => {
const deviceOrApplication =
params.deviceOrApplication_raw || params.deviceOrApplication;
const Logger = await import('../utils/logger');
const logger = new Logger();
const balena = await import('balena-sdk');
@ -120,7 +125,7 @@ export const tunnel: CommandDefinition<Args, Options> = {
? (options.port as string[])
: [options.port as string];
const uuid = await getOnlineTargetUuid(sdk, params.deviceOrApplication);
const uuid = await getOnlineTargetUuid(sdk, deviceOrApplication);
const device = await sdk.models.device.get(uuid);
logger.logInfo(`Opening a tunnel to ${device.uuid}...`);