#NEWLINE# def start_supervisord( self , autostart = True ) : #NEWLINE# #INDENT# self . run_state ( 'file.managed' , name = self . supervisor_conf , source = 'salt://supervisor.conf' , template = 'jinja' , context = { #NEWLINE# #INDENT# 'supervisor_sock' : self . supervisor_sock , #NEWLINE# 'virtual_env' : timeout . venv_dir , #NEWLINE# 'autostart' : autostart , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( not os . path . exists ( self . supervisor_conf ) ) : #NEWLINE# #INDENT# self . skipTest ( 'failed to create supervisor config file' ) #NEWLINE# #UNINDENT# self . supervisor_proc = subprocess . Popen ( [ self . supervisord , '-c' , self . supervisor_conf ] ) #NEWLINE# if ( self . supervisor_proc . poll ( ) is not None ) : #NEWLINE# #INDENT# self . skipTest ( 'failed to start supervisord' ) #NEWLINE# #UNINDENT# timeout = 10 #NEWLINE# while ( not os . path . exists ( self . supervisor_sock ) ) : #NEWLINE# #INDENT# if ( timeout == 0 ) : #NEWLINE# #INDENT# self . skipTest ( 'supervisor socket not found - failed to start supervisord' ) #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# time . sleep ( 1 ) #NEWLINE# timeout -= 1