Skip to content
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

Fix --ignore-dependencies with stack_output #779

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions integration-tests/features/stack-output-resolver.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ Feature: Stack output resolver
When the user launches stack "6/1/B"
Then stack "6/1/B" exists in "CREATE_COMPLETE" state

Scenario: launch a stack referencing an output of existing stack with ignore dependencies
Given stack "6/1/A" exists using "dependencies/independent_template.json"
and stack "6/1/B" does not exist
and stack "6/1/C" does not exist
When the user launches stack "6/1/B" with ignore dependencies
Then stack "6/1/B" exists in "CREATE_COMPLETE" state
And stack "6/1/C" does not exist

Scenario: launch a stack referencing an output of a non-existant stack
Given stack "6/1/B" does not exist
and stack "6/1/A" does not exist
Expand Down
37 changes: 30 additions & 7 deletions sceptre/resolvers/stack_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,39 @@ def resolve(self):
"""
self.logger.debug("Resolving Stack output: {0}".format(self.argument))

friendly_stack_name = self.dependency_stack_name.replace(TEMPLATE_EXTENSION, "")
if self.stack.dependencies:
friendly_stack_name = self.dependency_stack_name.replace(
TEMPLATE_EXTENSION, "")

stack = next(
stack for stack in self.stack.dependencies if stack.name == friendly_stack_name
)
stack = next(
stack for stack in self.stack.dependencies
if stack.name == friendly_stack_name
)

stack_name = "-".join([stack.project_code, friendly_stack_name.replace("/", "-")])
stack_name = "-".join([
stack.project_code,
friendly_stack_name.replace("/", "-")
])

return self._get_output_value(stack_name, self.output_key,
profile=stack.profile, region=stack.region)
return self._get_output_value(
stack_name,
self.output_key,
profile=stack.profile,
region=stack.region
)
else:
dep_stack_name, self.output_key = self.argument.split("::")
friendly_stack_name = dep_stack_name.replace(TEMPLATE_EXTENSION, "")
stack_name = "-".join([
self.stack.project_code,
friendly_stack_name.replace("/", "-")
])
return self._get_output_value(
stack_name,
self.output_key,
profile=self.stack.profile,
region=self.stack.region
)


class StackOutputExternal(StackOutputBase):
Expand Down