@@ -49,7 +49,10 @@ def check_ip_block(self, value, path):
49
49
)
50
50
)
51
51
else :
52
- message = "Cidr ipBlock should be Cidr Range, Ref, GetAtt, Sub or Select for {0}"
52
+ message = (
53
+ "Cidr ipBlock should be Cidr Range, Ref, GetAtt, Sub or"
54
+ " Select for {0}"
55
+ )
53
56
matches .append (
54
57
RuleMatch (
55
58
path , message .format ("/" .join (map (str , value )))
@@ -78,18 +81,16 @@ def check_count(self, value, path):
78
81
if len (value .get ("Fn::If" )) == 3 and isinstance (
79
82
value .get ("Fn::If" ), list
80
83
):
81
- matches .extend (
82
- self .check_count (
83
- value .get ("Fn::If" )[1 ],
84
- path = path [:] + [index_key , 1 ],
85
- )
86
- )
87
- matches .extend (
88
- self .check_count (
89
- value .get ("Fn::If" )[2 ],
90
- path = path [:] + [index_key , 2 ],
84
+ for i in [1 , 2 ]:
85
+ (
86
+ new_count_parameters ,
87
+ new_matches ,
88
+ ) = self .check_count (
89
+ value .get ("Fn::If" )[i ],
90
+ path = path [:] + [index_key , i ],
91
91
)
92
- )
92
+ count_parameters .extend (new_count_parameters )
93
+ matches .extend (new_matches )
93
94
else :
94
95
message = "Cidr count should be Int, Ref, or Select for {0}"
95
96
matches .append (
@@ -168,15 +169,21 @@ def check_parameter_count(self, cfn, parameter_name):
168
169
max_value = parameter_obj .get ("MaxValue" )
169
170
min_value = parameter_obj .get ("MinValue" )
170
171
if (not min_value ) or min_value < 1 or min_value > 256 :
171
- message = "Parameter for Cidr count have MinValue between 1 and 256 at {0}"
172
+ message = (
173
+ "Parameter for Cidr count have MinValue between 1 and 256"
174
+ " at {0}"
175
+ )
172
176
matches .append (
173
177
RuleMatch (
174
178
tree + ["MinValue" ],
175
179
message .format ("/" .join (map (str , tree + ["MinValue" ]))),
176
180
)
177
181
)
178
182
if (not max_value ) or max_value < 1 or max_value > 256 :
179
- message = "Parameter for Cidr count have MaxValue between 1 and 256 at {0}"
183
+ message = (
184
+ "Parameter for Cidr count have MaxValue between 1 and 256"
185
+ " at {0}"
186
+ )
180
187
matches .append (
181
188
RuleMatch (
182
189
tree + ["MaxValue" ],
@@ -258,7 +265,6 @@ def match(self, cfn):
258
265
)
259
266
count_parameters .extend (new_count_parameters )
260
267
matches .extend (new_matches )
261
-
262
268
new_size_mask_parameters , new_matches = self .check_size_mask (
263
269
size_mask_obj , tree [:] + [2 ]
264
270
)
0 commit comments