in src/cfnlint/rules/functions/Join.py [0:0]
def _match_string_objs(self, join_string_objs, cfn, path):
""" Check join list """
matches = []
template_parameters = self._get_parameters(cfn)
get_atts = cfn.get_valid_getatts()
if isinstance(join_string_objs, dict):
if len(join_string_objs) == 1:
for key, value in join_string_objs.items():
if key not in self.list_supported_functions:
message = 'Fn::Join unsupported function for {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
elif key in ['Ref']:
if not self._is_ref_a_list(value, template_parameters):
message = 'Fn::Join must use a list at {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
elif key in ['Fn::GetAtt']:
if self._is_getatt_a_list(self._normalize_getatt(value), get_atts) == 'FALSE':
message = 'Fn::Join must use a list at {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
else:
message = 'Join list of values should be singular for {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
elif not isinstance(join_string_objs, list):
message = 'Join list of values for {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
else:
for string_obj in join_string_objs:
if isinstance(string_obj, dict):
if len(string_obj) == 1:
for key, value in string_obj.items():
if key not in self.singular_supported_functions:
message = 'Join unsupported function for {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
elif key in ['Ref']:
if self._is_ref_a_list(value, template_parameters):
message = 'Fn::Join must not be a list at {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
elif key in ['Fn::GetAtt']:
if self._is_getatt_a_list(self._normalize_getatt(value), get_atts) == 'TRUE':
message = 'Fn::Join must not be a list at {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
else:
message = 'Join list of values should be singular for {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
elif not isinstance(string_obj, six.string_types):
message = 'Join list of singular function or string for {0}'
matches.append(RuleMatch(
path, message.format('/'.join(map(str, path)))))
return matches