Skip to content

Commit

Permalink
fix: always showcase deploy args (#1557)
Browse files Browse the repository at this point in the history
* fix: always showcase deploy args

* fix: set arguments on package during deploy guided
  • Loading branch information
sriram-mv committed Nov 23, 2019
1 parent dc1d10c commit 2e41981
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
41 changes: 21 additions & 20 deletions samcli/commands/deploy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,61 +212,62 @@ def do_cli(
changeset_decision = None
_capabilities = None
_parameter_overrides = None
guided_stack_name = None
guided_s3_bucket = None
guided_region = None

if guided:

read_config_showcase(template_file=template_file)

_parameter_override_keys = get_template_parameters(template_file=template_file)

stack_name, s3_bucket, region, profile, changeset_decision, _capabilities, _parameter_overrides, save_to_config = guided_deploy(
guided_stack_name, guided_s3_bucket, guided_region, guided_profile, changeset_decision, _capabilities, _parameter_overrides, save_to_config = guided_deploy(
stack_name, s3_bucket, region, profile, confirm_changeset, _parameter_override_keys, parameter_overrides
)

if save_to_config:
save_config(
template_file,
stack_name=stack_name,
s3_bucket=s3_bucket,
region=region,
profile=profile,
stack_name=guided_stack_name,
s3_bucket=guided_s3_bucket,
region=guided_region,
profile=guided_profile,
confirm_changeset=changeset_decision,
capabilities=_capabilities,
parameter_overrides=_parameter_overrides,
)

# We print deploy args only on guided.
# Should we print this always?
print_deploy_args(
stack_name=stack_name,
s3_bucket=s3_bucket,
region=region,
capabilities=_capabilities,
parameter_overrides=_parameter_overrides,
confirm_changeset=changeset_decision,
)
print_deploy_args(
stack_name=guided_stack_name if guided else stack_name,
s3_bucket=guided_s3_bucket if guided else s3_bucket,
region=guided_region if guided else region,
capabilities=_capabilities if guided else capabilities,
parameter_overrides=_parameter_overrides if guided else parameter_overrides,
confirm_changeset=changeset_decision if guided else confirm_changeset,
)

with tempfile.NamedTemporaryFile() as output_template_file:

with PackageContext(
template_file=template_file,
s3_bucket=s3_bucket,
s3_bucket=guided_s3_bucket if guided else s3_bucket,
s3_prefix=s3_prefix,
output_template_file=output_template_file.name,
kms_key_id=kms_key_id,
use_json=use_json,
force_upload=force_upload,
metadata=metadata,
on_deploy=True,
region=region,
region=guided_region if guided else region,
profile=profile,
) as package_context:
package_context.run()

with DeployContext(
template_file=output_template_file.name,
stack_name=stack_name,
s3_bucket=s3_bucket,
stack_name=guided_stack_name if guided else stack_name,
s3_bucket=guided_s3_bucket if guided else s3_bucket,
force_upload=force_upload,
s3_prefix=s3_prefix,
kms_key_id=kms_key_id,
Expand All @@ -277,7 +278,7 @@ def do_cli(
notification_arns=notification_arns,
fail_on_empty_changeset=fail_on_empty_changeset,
tags=tags,
region=region,
region=guided_region if guided else region,
profile=profile,
confirm_changeset=changeset_decision if guided else confirm_changeset,
) as deploy_context:
Expand Down
1 change: 0 additions & 1 deletion tests/unit/commands/deploy/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch, Mock, ANY, MagicMock

from samcli.commands.deploy.command import do_cli
from samcli.lib.config.samconfig import SamConfig


class TestDeployliCommand(TestCase):
Expand Down

0 comments on commit 2e41981

Please sign in to comment.