From f0030a18910e454b59cc5d3573a69fdb7264b9d0 Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Wed, 26 Jun 2019 13:44:22 +0300 Subject: [PATCH] tunnel: Fix incorrect parsing of numeric short UUIDs Change-type: patch Signed-off-by: Thodoris Greasidis --- lib/actions/tunnel.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/actions/tunnel.ts b/lib/actions/tunnel.ts index e89f21a7..5e6a87fe 100644 --- a/lib/actions/tunnel.ts +++ b/lib/actions/tunnel.ts @@ -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 = { 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 = { ? (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}...`);