#NEWLINE# def wait_for( self , check_type , check_name , desired_status , wait = 120 , interval = 5 , failures = [ 'ERROR' ] ) : #NEWLINE# #INDENT# status = 'notset' #NEWLINE# total_sleep = 0 #NEWLINE# opts = self . get_show_opts ( [ 'status' ] ) #NEWLINE# while ( total_sleep < wait ) : #NEWLINE# #INDENT# status = self . openstack ( ( ( ( check_type + ' show ' ) + check_name ) + opts ) ) #NEWLINE# status = status . rstrip ( ) #NEWLINE# print ( 'Checking {} {} Waiting for {} current status: {}' . format ( check_type , check_name , desired_status , status ) ) #NEWLINE# if ( status == desired_status ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# self . assertNotIn ( status , failures ) #NEWLINE# time . sleep ( interval ) #NEWLINE# total_sleep += interval #NEWLINE# #UNINDENT# self . assertEqual ( desired_status , status )