diff --git a/samcli/commands/deploy/command.py b/samcli/commands/deploy/command.py index 9347b266fe..cddbeac25f 100644 --- a/samcli/commands/deploy/command.py +++ b/samcli/commands/deploy/command.py @@ -16,7 +16,7 @@ tags_override_option, template_click_option, ) -from samcli.commands.deploy.utils import print_deploy_args, sanitize_parameter_overrides +from samcli.commands.deploy.utils import sanitize_parameter_overrides from samcli.lib.telemetry.metrics import track_command from samcli.lib.utils import osutils @@ -222,15 +222,6 @@ def do_cli( ) guided_context.run() - print_deploy_args( - stack_name=guided_context.guided_stack_name if guided else stack_name, - s3_bucket=guided_context.guided_s3_bucket if guided else s3_bucket, - region=guided_context.guided_region if guided else region, - capabilities=guided_context.guided_capabilities if guided else capabilities, - parameter_overrides=guided_context.guided_parameter_overrides if guided else parameter_overrides, - confirm_changeset=guided_context.confirm_changeset if guided else confirm_changeset, - ) - with osutils.tempfile_platform_independent() as output_template_file: with PackageContext( diff --git a/samcli/commands/deploy/deploy_context.py b/samcli/commands/deploy/deploy_context.py index 5bee46cff2..48922496be 100644 --- a/samcli/commands/deploy/deploy_context.py +++ b/samcli/commands/deploy/deploy_context.py @@ -24,7 +24,7 @@ from samcli.commands._utils.template import get_template_data from samcli.commands.deploy import exceptions as deploy_exceptions from samcli.commands.deploy.auth_utils import auth_per_resource -from samcli.commands.deploy.utils import sanitize_parameter_overrides +from samcli.commands.deploy.utils import sanitize_parameter_overrides, print_deploy_args from samcli.lib.deploy.deployer import Deployer from samcli.lib.package.s3_uploader import S3Uploader from samcli.lib.utils.botoconfig import get_boto_config_with_user_agent @@ -118,7 +118,14 @@ def run(self): self.deployer = Deployer(cloudformation_client) region = s3_client._client_config.region_name if s3_client else self.region # pylint: disable=W0212 - + print_deploy_args( + self.stack_name, + self.s3_bucket, + region, + self.capabilities, + self.parameter_overrides, + self.confirm_changeset, + ) return self.deploy( self.stack_name, template_str, diff --git a/samcli/commands/deploy/guided_context.py b/samcli/commands/deploy/guided_context.py index 98855d2cae..e19c5e7b69 100644 --- a/samcli/commands/deploy/guided_context.py +++ b/samcli/commands/deploy/guided_context.py @@ -14,7 +14,7 @@ from samcli.commands.deploy.exceptions import GuidedDeployFailedError from samcli.commands.deploy.guided_config import GuidedConfig from samcli.commands.deploy.auth_utils import auth_per_resource -from samcli.commands.deploy.utils import sanitize_parameter_overrides +from samcli.commands.deploy.utils import sanitize_parameter_overrides, print_deploy_args from samcli.lib.bootstrap.bootstrap import manage_stack from samcli.lib.utils.colors import Colored @@ -163,6 +163,15 @@ def run(self): guided_config = GuidedConfig(template_file=self.template_file, section=self.config_section) guided_config.read_config_showcase() + print_deploy_args( + stack_name=self.guided_stack_name, + s3_bucket=self.guided_s3_bucket, + region=self.guided_region, + capabilities=self._capabilities, + parameter_overrides=self._parameter_overrides, + confirm_changeset=self.confirm_changeset, + ) + self.guided_prompts(_parameter_override_keys) if self.save_to_config: diff --git a/tests/unit/commands/deploy/test_command.py b/tests/unit/commands/deploy/test_command.py index 1e1736cb84..ba412447da 100644 --- a/tests/unit/commands/deploy/test_command.py +++ b/tests/unit/commands/deploy/test_command.py @@ -98,7 +98,7 @@ def test_all_args(self, mock_deploy_context, mock_deploy_click, mock_package_con @patch("samcli.commands.package.package_context.PackageContext") @patch("samcli.commands.deploy.command.click") @patch("samcli.commands.deploy.deploy_context.DeployContext") - @patch("samcli.commands.deploy.command.print_deploy_args") + @patch("samcli.commands.deploy.guided_context.print_deploy_args") @patch("samcli.commands.deploy.guided_context.manage_stack") @patch("samcli.commands.deploy.guided_context.auth_per_resource") @patch("samcli.commands.deploy.guided_context.get_template_parameters") @@ -162,7 +162,7 @@ def test_all_args_guided_no_to_authorization_confirmation_prompt( @patch("samcli.commands.package.package_context.PackageContext") @patch("samcli.commands.deploy.command.click") @patch("samcli.commands.deploy.deploy_context.DeployContext") - @patch("samcli.commands.deploy.command.print_deploy_args") + @patch("samcli.commands.deploy.guided_context.print_deploy_args") @patch("samcli.commands.deploy.guided_context.manage_stack") @patch("samcli.commands.deploy.guided_context.auth_per_resource") @patch("samcli.commands.deploy.guided_context.get_template_parameters") @@ -261,7 +261,7 @@ def test_all_args_guided( @patch("samcli.commands.package.package_context.PackageContext") @patch("samcli.commands.deploy.command.click") @patch("samcli.commands.deploy.deploy_context.DeployContext") - @patch("samcli.commands.deploy.command.print_deploy_args") + @patch("samcli.commands.deploy.guided_context.print_deploy_args") @patch("samcli.commands.deploy.guided_context.manage_stack") @patch("samcli.commands.deploy.guided_context.auth_per_resource") @patch("samcli.commands.deploy.guided_context.get_template_data") @@ -380,7 +380,7 @@ def test_all_args_guided_no_save_echo_param_to_config( @patch("samcli.commands.package.package_context.PackageContext") @patch("samcli.commands.deploy.command.click") @patch("samcli.commands.deploy.deploy_context.DeployContext") - @patch("samcli.commands.deploy.command.print_deploy_args") + @patch("samcli.commands.deploy.guided_context.print_deploy_args") @patch("samcli.commands.deploy.guided_context.auth_per_resource") @patch("samcli.commands.deploy.guided_context.get_template_data") @patch("samcli.commands.deploy.guided_context.manage_stack") @@ -484,7 +484,7 @@ def test_all_args_guided_no_params_save_config( @patch("samcli.commands.package.package_context.PackageContext") @patch("samcli.commands.deploy.command.click") @patch("samcli.commands.deploy.deploy_context.DeployContext") - @patch("samcli.commands.deploy.command.print_deploy_args") + @patch("samcli.commands.deploy.guided_context.print_deploy_args") @patch("samcli.commands.deploy.guided_context.manage_stack") @patch("samcli.commands.deploy.guided_context.auth_per_resource") @patch("samcli.commands.deploy.guided_context.get_template_data")