Skip to content

Commit 7ae24af

Browse files
authored
Merge pull request #539 from remind101/diff
Diff improvements
2 parents 21eda43 + 9d68635 commit 7ae24af

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

stacker/actions/diff.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
from . import build
99
from .. import exceptions
1010
from ..util import parse_cloudformation_template
11-
from ..status import NotSubmittedStatus, NotUpdatedStatus, COMPLETE
11+
from ..status import (
12+
NotSubmittedStatus,
13+
NotUpdatedStatus,
14+
COMPLETE,
15+
INTERRUPTED,
16+
)
1217

1318
logger = logging.getLogger(__name__)
1419

@@ -198,16 +203,21 @@ def _print_new_stack(self, stack, parameters):
198203

199204
def _diff_stack(self, stack, **kwargs):
200205
"""Handles the diffing a stack in CloudFormation vs our config"""
206+
if self.cancel.wait(0):
207+
return INTERRUPTED
208+
201209
if not build.should_submit(stack):
202210
return NotSubmittedStatus()
203211

204212
if not build.should_update(stack):
205213
return NotUpdatedStatus()
206214

215+
provider_stack = self.provider.get_stack(stack.fqn)
216+
207217
# get the current stack template & params from AWS
208218
try:
209219
[old_template, old_params] = self.provider.get_stack_info(
210-
stack.fqn)
220+
provider_stack)
211221
except exceptions.StackDoesNotExist:
212222
old_template = None
213223
old_params = {}
@@ -241,6 +251,9 @@ def _diff_stack(self, stack, **kwargs):
241251
)
242252
print_stack_changes(stack.name, new_stack, old_stack, new_params,
243253
old_params)
254+
255+
self.provider.set_outputs(stack.fqn, provider_stack)
256+
244257
return COMPLETE
245258

246259
def _generate_plan(self):

stacker/providers/aws/default.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,12 +900,12 @@ def set_outputs(self, stack_name, stack):
900900
self._outputs[stack_name] = get_output_dict(stack)
901901
return
902902

903-
def get_stack_info(self, stack_name):
903+
def get_stack_info(self, stack):
904904
""" Get the template and parameters of the stack currently in AWS
905905
906906
Returns [ template, parameters ]
907907
"""
908-
stack = self.get_stack(stack_name)
908+
stack_name = stack['StackId']
909909

910910
try:
911911
template = self.cloudformation.get_template(

0 commit comments

Comments
 (0)