-
Notifications
You must be signed in to change notification settings - Fork 166
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
Formalize the existence of external (read-only) stacks #618
base: master
Are you sure you want to change the base?
Changes from all commits
8130fa6
17ff01b
f614885
fc868ad
d0ee28e
19a0386
9a7e889
6978716
8e36bf6
2ce72e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
import collections | ||
import logging | ||
|
||
from stacker.config import Config | ||
from .stack import Stack | ||
from stacker.config import Config, ExternalStack as ExternalStackModel | ||
from .stack import ExternalStack, Stack | ||
from .target import Target | ||
|
||
logger = logging.getLogger(__name__) | ||
|
@@ -153,15 +153,18 @@ def get_stacks(self): | |
stacks = [] | ||
definitions = self._get_stack_definitions() | ||
for stack_def in definitions: | ||
stack = Stack( | ||
definition=stack_def, | ||
context=self, | ||
mappings=self.mappings, | ||
force=stack_def.name in self.force_stacks, | ||
locked=stack_def.locked, | ||
enabled=stack_def.enabled, | ||
protected=stack_def.protected, | ||
) | ||
if isinstance(stack_def, ExternalStackModel): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the change to inject a fake What if the condition here was just: if stack_def.locked and not stack_def.blueprint and not stack_def.template_path:
# ExternalStack That would be a much smaller change and help reduce the size of this PR (and be more backwards compatible with existing configs). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my first approach, but I noticed more than half of an external stack's attributes would be completely invalid/useless, and that I needed to add conditions that checked |
||
stack = ExternalStack( | ||
definition=stack_def, | ||
context=self | ||
) | ||
else: | ||
stack = Stack( | ||
definition=stack_def, | ||
context=self, | ||
mappings=self.mappings, | ||
force=stack_def.name in self.force_stacks | ||
) | ||
stacks.append(stack) | ||
self._stacks = stacks | ||
return self._stacks | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe throw a comment here stating that this stack won't be changed/build/etc because of the external flag (it is redundant, but I think it's useful)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.