Skip to content

Commit 118686c

Browse files
authored
Enumerate FindInMap when can't be resolved (#3246)
* Enumerate FindInMap when can't be resolved * Fix new pylint issues
1 parent 592ce0b commit 118686c

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/cfnlint/rules/resources/events/RuleScheduleExpression.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ def check_rate(self, value, path):
5050
RuleMatch(path, f"Rate Value {items[0]!r} should be greater than 0.")
5151
]
5252

53+
valid_periods = ["minutes", "hours", "days"]
5354
if float(items[0]) <= 1:
5455
valid_periods = ["minute", "hour", "day"]
55-
elif float(items[0]) > 1:
56-
valid_periods = ["minutes", "hours", "days"]
5756
# Check the Unit
5857
if items[1] not in valid_periods:
5958
return [

src/cfnlint/rules/resources/properties/ValueRefGetAtt.py

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def check_value_getatt(self, value, path, **kwargs):
132132
property_type = kwargs.get("property_type")
133133
property_name = kwargs.get("property_name")
134134
# You can sometimes get a list or a string with . in it
135+
resource_name = ""
136+
resource_attribute = []
135137
if isinstance(value, list):
136138
resource_name = value[0]
137139
if len(value[1:]) == 1:

src/cfnlint/template/transforms/_language_extensions.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,15 @@ def _walk(self, item: Any, params: MutableMapping[str, Any], cfn: Any):
159159
try:
160160
mapping = _ForEachValueFnFindInMap(get_hash(v), v)
161161
map_value = mapping.value(cfn, params, True, False)
162-
# if we get None this means its all strings but couldn't be resolved
163-
# we will pass this forward
164-
if map_value is None:
165-
continue
166162
# if we can resolve it we will return it
167163
if isinstance(map_value, tuple([list]) + _SCALAR_TYPES):
168164
return map_value
169165
except Exception as e: # pylint: disable=broad-exception-caught
170166
# We couldn't resolve the FindInMap so we are going to leave it as it is
171167
LOGGER.debug("Transform and Fn::FindInMap error: %s", {str(e)})
172-
for i, el in enumerate(v):
173-
v[i] = self._walk(el, params, cfn)
174-
obj[k] = v
168+
for i, el in enumerate(v):
169+
v[i] = self._walk(el, params, cfn)
170+
obj[k] = v
175171
elif k == "Ref":
176172
if isinstance(v, str):
177173
if v in params:

0 commit comments

Comments
 (0)