From c4fad95134608283750dfb4fa8991fe75eec5352 Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Sat, 23 Oct 2021 15:41:32 -0700 Subject: [PATCH] fix: Search path for apply file should be relative to the project-path setting it it exists --- src/AWS.Deploy.CLI/Commands/CommandFactory.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/AWS.Deploy.CLI/Commands/CommandFactory.cs b/src/AWS.Deploy.CLI/Commands/CommandFactory.cs index ef8dddc2c..74c1df85b 100644 --- a/src/AWS.Deploy.CLI/Commands/CommandFactory.cs +++ b/src/AWS.Deploy.CLI/Commands/CommandFactory.cs @@ -167,9 +167,15 @@ private Command BuildDeployCommand() _toolInteractiveService.Diagnostics = input.Diagnostics; _toolInteractiveService.DisableInteractive = input.Silent; - var userDeploymentSettings = !string.IsNullOrEmpty(input.Apply) - ? UserDeploymentSettings.ReadSettings(input.Apply) - : null; + var projectDefinition = await _projectParserUtility.Parse(input.ProjectPath ?? ""); + var targetApplicationDirectoryPath = new DirectoryInfo(projectDefinition.ProjectPath).Parent!.FullName; + + UserDeploymentSettings? userDeploymentSettings = null; + if (!string.IsNullOrEmpty(input.Apply)) + { + var applyPath = Path.GetFullPath(input.Apply, targetApplicationDirectoryPath); + userDeploymentSettings = UserDeploymentSettings.ReadSettings(applyPath); + } var awsCredentials = await _awsUtilities.ResolveAWSCredentials(input.Profile ?? userDeploymentSettings?.AWSProfile); var awsRegion = _awsUtilities.ResolveAWSRegion(input.Region ?? userDeploymentSettings?.AWSRegion); @@ -177,8 +183,6 @@ private Command BuildDeployCommand() _commandLineWrapper.RegisterAWSContext(awsCredentials, awsRegion); _awsClientFactory.RegisterAWSContext(awsCredentials, awsRegion); - var projectDefinition = await _projectParserUtility.Parse(input.ProjectPath ?? ""); - var callerIdentity = await _awsResourceQueryer.GetCallerIdentity(); var session = new OrchestratorSession( @@ -217,7 +221,6 @@ private Command BuildDeployCommand() var deploymentProjectPath = input.DeploymentProject ?? string.Empty; if (!string.IsNullOrEmpty(deploymentProjectPath)) { - var targetApplicationDirectoryPath = new DirectoryInfo(projectDefinition.ProjectPath).Parent!.FullName; deploymentProjectPath = Path.GetFullPath(deploymentProjectPath, targetApplicationDirectoryPath); }