Skip to content

Commit

Permalink
Handle extra dots in getatts
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzbeard committed Dec 18, 2024
1 parent c6851c9 commit dd16375
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions awscli/customizations/cloudformation/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def resolve_output_sub(self, v, d, n):
sub += resolved
elif word.t == WordType.GETATT:
resolved = "${" + word.w + "}"
tokens = word.w.split(".")
tokens = word.w.split(".", 1)
if len(tokens) < 2:
msg = f"GetAtt {word.w} has unexpected number of tokens"
raise exceptions.InvalidModuleError(msg=msg)
Expand Down Expand Up @@ -419,7 +419,7 @@ def resolve_output_getatt(self, v, d, n):
sub += resolved
elif word.t == WordType.GETATT:
resolved = "${" + word.w + "}"
tokens = word.w.split(".")
tokens = word.w.split(".", 1)
if len(tokens) < 2:
msg = f"GetAtt {word.w} unexpected length"
raise exceptions.InvalidModuleError(msg=msg)
Expand Down Expand Up @@ -621,7 +621,7 @@ def resolve_sub(self, v, d, n):
elif word.t == WordType.GETATT:
need_sub = True
resolved = "${" + word.w + "}"
tokens = word.w.split(".")
tokens = word.w.split(".", 1)
if len(tokens) < 2:
msg = f"GetAtt {word.w} has unexpected number of tokens"
raise exceptions.InvalidModuleError(msg=msg)
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/customizations/cloudformation/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,10 @@ def test_merge_props(self):
expect = {"b": "cc", "d": {"e": "ff", "g": "h", "i": [1, 2, 3, 4, 5]}}
merged = modules.merge_props(original, overrides)
self.assertEqual(merged, expect)
# TODO: More complex examples (especially merging Policies)

def test_main(self):
"Run tests on sample templates that include local modules"

# TODO: Port tests over from Rain

# The tests are in the modules directory.
# Each test has 3 files:
# test-template.yaml, test-module.yaml, and test-expect.yaml
Expand Down

0 comments on commit dd16375

Please sign in to comment.