#NEWLINE# def _load_extended_node_data( nodes ) : #NEWLINE# #INDENT# 'Loads JSON node files from node databag, which has merged attributes' #NEWLINE# data = [ ] #NEWLINE# for node in nodes : #NEWLINE# #INDENT# filename = ( node [ 'name' ] . replace ( '.' , '_' ) + '.json' ) #NEWLINE# filepath = os . path . join ( DATA_BAG_PATH , filename ) #NEWLINE# if ( not os . path . exists ( filepath ) ) : #NEWLINE# #INDENT# error = "'node' data bag was not generated correctly: item " #NEWLINE# error += "'data_bag/node/{0}' is missing" . format ( filename ) #NEWLINE# raise RepoError ( error ) #NEWLINE# #UNINDENT# with open ( filepath , 'r' ) as f : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# data . append ( json . loads ( f . read ( ) ) ) #NEWLINE# #UNINDENT# except json . JSONDecodeError as e : #NEWLINE# #INDENT# error = 'LittleChef found the following error in' #NEWLINE# error += ' "{0}":\n {1}' . format ( filepath , str ( e ) ) #NEWLINE# raise RepoError ( error ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return data