#NEWLINE# def reload( datadir = None ) : #NEWLINE# #INDENT# 'Re/load Romeo data files parse them and create object\n       relationships if required\n\n       @param datadir (string) - directory\n       @return None\n    ' #NEWLINE# if ( not datadir ) : #NEWLINE# #INDENT# datadir = _os . getenv ( 'ROMEO_DATA' , '/etc/hostdb' ) #NEWLINE# #UNINDENT# entity . namespace . pop ( 'romeo' , None ) #NEWLINE# entity . namespace [ 'romeo' ] = set ( ) #NEWLINE# cachedb = _os . path . join ( datadir , CACHEDB ) #NEWLINE# if _os . path . exists ( cachedb ) : #NEWLINE# #INDENT# fd = open ( cachedb , 'rb' ) #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# entity . namespace [ 'romeo' ] . add ( foundation . RomeoKeyValue . deserialize ( fd ) ) #NEWLINE# #UNINDENT# except EOFError : #NEWLINE# #INDENT# fd . close ( ) #NEWLINE# return #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# from romeo.directives import Preprocessor #NEWLINE# pp = Preprocessor ( datadir ) #NEWLINE# for f in _glob . glob ( ( '%s/*.yaml' % ( datadir , ) ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# fd = open ( f , 'r' ) #NEWLINE# outstr = pp . pre_process ( fd , f ) #NEWLINE# fd . close ( ) #NEWLINE# rd = _copy . deepcopy ( _yaml . load ( outstr , Loader = _Loader ) ) #NEWLINE# rd . append ( { #NEWLINE# #INDENT# 'FILENAME' : f , #NEWLINE# #UNINDENT# } ) #NEWLINE# pp . post_process ( rd , f ) #NEWLINE# entity . namespace [ 'romeo' ] . add ( foundation . RomeoKeyValue ( 'ENVIRONMENT' , rd ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# _traceback . print_exc ( ) #NEWLINE# #UNINDENT# #UNINDENT# pp . shutdown ( ) #NEWLINE# Preprocessor . delete ( pp )