From 84a20de3f3e9fc49017626f2233929cf03d2e277 Mon Sep 17 00:00:00 2001 From: Daniel Neilson <53624638+ddneilson@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:02:58 -0600 Subject: [PATCH] fix(deadline): bad file path for Repository when using VersionQuery (#252) --- packages/aws-rfdk/lib/deadline/lib/repository.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/aws-rfdk/lib/deadline/lib/repository.ts b/packages/aws-rfdk/lib/deadline/lib/repository.ts index ab5c65585..62303edab 100644 --- a/packages/aws-rfdk/lib/deadline/lib/repository.ts +++ b/packages/aws-rfdk/lib/deadline/lib/repository.ts @@ -47,6 +47,7 @@ import { RemovalPolicy, Stack, Tags, + Token, } from '@aws-cdk/core'; import { CloudWatchAgent, @@ -589,7 +590,13 @@ export class Repository extends Construct implements IRepository { */ public configureClientECS(props: ECSDirectConnectProps): IContainerDirectRepositoryConnection { const hostMountPoint = props.containerInstances.filesystemMountPoint ?? '/mnt/repo'; - const containerMountPoint = props.containers.filesystemMountPoint ?? `/opt/Thinkbox/DeadlineRepository${this.version.majorVersion}`; + const majorVersion = Token.isUnresolved(this.version.majorVersion) ? + Token.asString(this.version.majorVersion) : this.version.majorVersion.toString(); + const containerMountPoint = props.containers.filesystemMountPoint ?? `/opt/Thinkbox/DeadlineRepository${majorVersion}`; + // Note: pathToFileURL messes up CDK Tokens like the one in majorVersion + const containerMountPointURL = props.containers.filesystemMountPoint ? + pathToFileURL(props.containers.filesystemMountPoint).toString() : + `file:///opt/Thinkbox/DeadlineRepository${majorVersion}`; // Set up a direct connection on the host machine. This: // - grants IAM permissions to the role associated with the instance profile access to @@ -604,7 +611,7 @@ export class Repository extends Construct implements IRepository { // Build up a mapping of environment variables that are used to configure the container's direct connection to the // repository const containerEnvironment: { [name: string]: string } = { - REPO_URI: pathToFileURL(containerMountPoint).toString(), + REPO_URI: containerMountPointURL, }; // The role associated with the task definition needs access to connect to the database