#NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# '\n        No need to add a dummy foo.txt to muddy up the github repo, just make\n        our own fileserver root on-the-fly.\n        ' #NEWLINE# def _new_dir( path ) : #NEWLINE# #INDENT# '\n            Add a new dir at ``path`` using os.makedirs. If the directory\n            already exists, remove it recursively and then try to create it\n            again.\n            ' #NEWLINE# try : #NEWLINE# #INDENT# os . makedirs ( path ) #NEWLINE# #UNINDENT# except OSError as exc : #NEWLINE# #INDENT# if ( exc . errno == errno . EEXIST ) : #NEWLINE# #INDENT# shutil . rmtree ( path ) #NEWLINE# os . makedirs ( path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for saltenv in SALTENVS : #NEWLINE# #INDENT# saltenv_root = os . path . join ( FS_ROOT , saltenv ) #NEWLINE# _new_dir ( saltenv_root ) #NEWLINE# path = os . path . join ( saltenv_root , 'foo.txt' ) #NEWLINE# with salt . utils . fopen ( path , 'w' ) as fp_ : #NEWLINE# #INDENT# fp_ . write ( "This is a test file in the '{0}' saltenv.\n" . format ( saltenv ) ) #NEWLINE# #UNINDENT# subdir_abspath = os . path . join ( saltenv_root , SUBDIR ) #NEWLINE# os . makedirs ( subdir_abspath ) #NEWLINE# for subdir_file in SUBDIR_FILES : #NEWLINE# #INDENT# path = os . path . join ( subdir_abspath , subdir_file ) #NEWLINE# with salt . utils . fopen ( path , 'w' ) as fp_ : #NEWLINE# #INDENT# fp_ . write ( "This is file '{0}' in subdir '{1} from saltenv '{2}'" . format ( fp_ , SUBDIR , saltenv ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# _new_dir ( CACHE_ROOT )