Skip to content

Commit

Permalink
Fix module json file writing during update (#3280)
Browse files Browse the repository at this point in the history
* Fix module json file writing during update
  • Loading branch information
kddejong authored Jun 7, 2024
1 parent bb83a0d commit 93d036d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cfnlint/rules/formats/SecurityGroupId.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def format(self, validator: Validator, instance: Any) -> bool:
if not isinstance(instance, str):
return True

if re.match(r"^sg-([a-zA-Z0-9]{8}|[a-zA-Z0-9]{17})$", instance):
if re.match(r"^sg-([a-fA-F0-9]{8}|[a-fA-F0-9]{17})$", instance):
return True

return False
2 changes: 1 addition & 1 deletion src/cfnlint/rules/formats/VpcId.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def format(self, validator: Validator, instance: Any) -> bool:
if not isinstance(instance, str):
return True

if re.match(r"^vpc-(([0-9A-Za-z]{8})|([0-9A-Za-z]{17}))$", instance):
if re.match(r"^vpc-(([0-9A-Fa-f]{8})|([0-9A-Fa-f]{17}))$", instance):
return True

return False
1 change: 1 addition & 0 deletions src/cfnlint/schema/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def _update_provider_schema(self, region: str, force: bool = False) -> None:
separators=(",", ": "),
sort_keys=True,
)
fh.write("\n")
for filename in filenames:
with open(f"{directory}{filename}", "r+", encoding="utf-8") as fh:
spec = json.load(fh)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/rules/formats/test_image_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validator():
),
(
"Valid image id long",
"ami-abcdefg1234567890",
"ami-abcdefa1234567890",
True,
),
(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/rules/formats/test_security_group_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validator():
),
(
"Valid security group id long",
"sg-abcdefg1234567890",
"sg-abcdefa1234567890",
True,
),
(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/rules/formats/test_vpc_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validator():
),
(
"Valid vpc id long",
"vpc-abcdefg1234567890",
"vpc-abcdefa1234567890",
True,
),
(
Expand Down

0 comments on commit 93d036d

Please sign in to comment.