#NEWLINE# def __init__( self , fake = False , force_new_db = False ) : #NEWLINE# #INDENT# if ( not os . path . exists ( DEPLOYMENT_FILE ) ) : #NEWLINE# #INDENT# subprocess . call ( [ 'rally' , 'deployment' , 'config' ] , stdout = open ( DEPLOYMENT_FILE , 'w' ) ) #NEWLINE# #UNINDENT# self . tmp_dir = tempfile . mkdtemp ( ) #NEWLINE# self . env = copy . deepcopy ( os . environ ) #NEWLINE# self . env [ 'HOME' ] = self . tmp_dir #NEWLINE# if ( force_new_db or ( 'RCI_KEEP_DB' not in os . environ ) ) : #NEWLINE# #INDENT# config_filename = os . path . join ( fake . tmp_dir , 'conf' ) #NEWLINE# config = configparser . RawConfigParser ( ) #NEWLINE# config . add_section ( 'database' ) #NEWLINE# config . set ( 'database' , 'connection' , ( 'sqlite:///%s/db' % self . tmp_dir ) ) #NEWLINE# with open ( config_filename , 'w' ) as conf : #NEWLINE# #INDENT# config . write ( conf ) #NEWLINE# #UNINDENT# self . args = [ 'rally' , '--config-file' , config_filename ] #NEWLINE# subprocess . call ( [ 'rally-manage' , '--config-file' , config_filename , 'db' , 'recreate' ] , env = self . env ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . args = [ 'rally' ] #NEWLINE# subprocess . call ( [ 'rally-manage' , 'db' , 'recreate' ] , env = self . env ) #NEWLINE# #UNINDENT# self . reports_root = os . environ . get ( 'REPORTS_ROOT' , 'rally-cli-output-files' ) #NEWLINE# self . _created_files = [ ] #NEWLINE# self ( ( 'deployment create --file %s --name MAIN' % DEPLOYMENT_FILE ) , write_report = False )