8000 Run dump and outline actions offline by zaro0508 · Pull Request #594 · cloudtools/stacker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Run dump and outline actions offline #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion stacker/actions/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ def should_submit(stack):
return False


def should_ensure_cfn_bucket(outline, dump):
"""Test whether access to the cloudformation template bucket is required

Args:
outline (bool): The outline action.
dump (bool): The dump action.

Returns:
bool: If access to CF bucket is needed, return True.

"""
return outline is False and dump is False
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may need to consider package sources as well. if user sets up package sources then I think stacker needs to run in online mode.



def _resolve_parameters(parameters, blueprint):
"""Resolves CloudFormation Parameters for a given blueprint.

Expand Down Expand Up @@ -351,7 +365,8 @@ def _generate_plan(self, tail=False):

def pre_run(self, outline=False, dump=False, *args, **kwargs):
"""Any steps that need to be taken prior to running the action."""
self.ensure_cfn_bucket()
if should_ensure_cfn_bucket(outline, dump):
self.ensure_cfn_bucket()
hooks = self.context.config.pre_build
handle_hooks(
"pre_build",
Expand Down
20 changes: 20 additions & 0 deletions stacker/tests/actions/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,26 @@ def test_should_update(self):
mock_stack.force = t.force
self.assertEqual(build.should_update(mock_stack), t.result)

def test_should_ensure_cfn_bucket(self):
test_scenarios = [
{"outline": False, "dump": False, "result": True},
{"outline": True, "dump": False, "result": False},
{"outline": False, "dump": True, "result": False},
{"outline": True, "dump": True, "result": False},
{"outline": True, "dump": "DUMP", "result": False}
]

for scenario in test_scenarios:
outline = scenario["outline"]
dump = scenario["dump"]
result = scenario["result"]
try:
self.assertEqual(
build.should_ensure_cfn_bucket(outline, dump), result)
except AssertionError as e:
e.args += ("scenario", str(scenario))
raise

def test_should_submit(self):
test_scenario = namedtuple("test_scenario",
["enabled", "result"])
Expand Down
0