Skip to content

Commit

Permalink
fix: previous generation instance type RuleMatch path (#2309)
Browse files Browse the repository at this point in the history
#2267

Co-authored-by: Kevin DeJong <kddejong@amazon.com>
  • Loading branch information
PatMyron and kddejong authored Aug 11, 2022
1 parent d24b53b commit bf21510
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cfnlint/rules/resources/PreviousGenerationInstanceType.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def match(self, cfn):
for resource_name, resource in cfn.get_resources([resource_type]).items():
if isinstance(resource.get('Properties', {}).get(property_type, ''), str):
if re.search(r'([cmr][1-3]|cc2|cg1|cr1|g2|hi1|hs1|i2|t1)\.', resource.get('Properties', {}).get(property_type, '')):
matches.append(RuleMatch(['Resources', resource_name, property_type], 'Upgrade previous generation instance type: ' + resource.get('Properties').get(property_type)))
matches.append(RuleMatch(['Resources', resource_name, 'Properties', property_type], 'Upgrade previous generation instance type: ' + resource.get('Properties').get(property_type)))

for resource_type, top_level_property_type, property_type in [
('AWS::EC2::EC2Fleet', 'FleetLaunchTemplateOverridesRequest', 'InstanceType'),
Expand All @@ -41,5 +41,5 @@ def match(self, cfn):
for resource_name, resource in cfn.get_resources([resource_type]).items():
if isinstance(resource.get('Properties', {}).get(top_level_property_type, {}).get(property_type, ''), str):
if re.search(r'([cmr][1-3]|cc2|cg1|cr1|g2|hi1|hs1|i2|t1)\.', resource.get('Properties', {}).get(top_level_property_type, {}).get(property_type, '')):
matches.append(RuleMatch(['Resources', resource_name, top_level_property_type, property_type], 'Upgrade previous generation instance type: ' + resource.get('Properties').get(top_level_property_type).get(property_type)))
matches.append(RuleMatch(['Resources', resource_name, 'Properties', top_level_property_type, property_type], 'Upgrade previous generation instance type: ' + resource.get('Properties').get(top_level_property_type).get(property_type)))
return matches

0 comments on commit bf21510

Please sign in to comment.