@@ -192,6 +192,18 @@ def __init__(self, stream, filename):
192
192
Resolver .__init__ (self )
193
193
NodeConstructor .__init__ (self , filename )
194
194
195
+ def construct_getatt (self , node ):
196
+ """
197
+ Reconstruct !GetAtt into a list
198
+ """
199
+
200
+ if isinstance (node .value , (str )):
201
+ return list_node (node .value .split ("." , 1 ), node .start_mark , node .end_mark )
202
+ if isinstance (node .value , list ):
203
+ return [self .construct_object (child , deep = False ) for child in node .value ]
204
+
205
+ raise ValueError (f"Unexpected node type: { type (node .value )} " )
206
+
195
207
196
208
def multi_constructor (loader , tag_suffix , node ):
197
209
"""
@@ -203,7 +215,7 @@ def multi_constructor(loader, tag_suffix, node):
203
215
204
216
constructor = None
205
217
if tag_suffix == "Fn::GetAtt" :
206
- constructor = construct_getatt
218
+ constructor = loader . construct_getatt
207
219
elif isinstance (node , ScalarNode ):
208
220
constructor = loader .construct_scalar
209
221
elif isinstance (node , SequenceNode ):
@@ -219,19 +231,6 @@ def multi_constructor(loader, tag_suffix, node):
219
231
return dict_node ({tag_suffix : constructor (node )}, node .start_mark , node .end_mark )
220
232
221
233
222
- def construct_getatt (node ):
223
- """
224
- Reconstruct !GetAtt into a list
225
- """
226
-
227
- if isinstance (node .value , (str )):
228
- return list_node (node .value .split ("." , 1 ), node .start_mark , node .end_mark )
229
- if isinstance (node .value , list ):
230
- return list_node ([s .value for s in node .value ], node .start_mark , node .end_mark )
231
-
232
- raise ValueError (f"Unexpected node type: { type (node .value )} " )
233
-
234
-
235
234
def loads (yaml_string , fname = None ):
236
235
"""
237
236
Load the given YAML string
0 commit comments