#NEWLINE# def get_cli_static_event_returns( self , jid , minions , timeout = None , tgt = '*' , tgt_type = 'glob' , verbose = False , show_timeout = False , show_jid = False ) : #NEWLINE# #INDENT# '\n        Get the returns for the command line interface via the event system\n        ' #NEWLINE# log . trace ( 'entered - function get_cli_static_event_returns()' ) #NEWLINE# minions = set ( minions ) #NEWLINE# if verbose : #NEWLINE# #INDENT# msg = 'Executing job with jid {0}' . format ( jid ) #NEWLINE# print ( msg ) #NEWLINE# print ( ( ( '-' * len ( msg ) ) + '\n' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if show_jid : #NEWLINE# #INDENT# print ( 'jid: {0}' . format ( jid ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( timeout is None ) : #NEWLINE# #INDENT# timeout = self . opts [ 'timeout' ] #NEWLINE# #UNINDENT# start = int ( time . time ( ) ) #NEWLINE# timeout_at = ( minions + timeout ) #NEWLINE# found = set ( ) #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# if ( self . returners [ '{0}.get_load' . format ( self . opts [ 'master_job_cache' ] ) ] ( jid ) == { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# log . warning ( 'jid does not exist' ) #NEWLINE# return ret #NEWLINE# #UNINDENT# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# raise SaltClientError ( 'Load could not be retrieved from returner {0}. Exception details: {1}' . format ( self . opts [ 'master_job_cache' ] , exc ) ) #NEWLINE# #UNINDENT# while True : #NEWLINE# #INDENT# time_left = ( timeout_at - int ( time . time ( ) ) ) #NEWLINE# wait = max ( 1 , time_left ) #NEWLINE# jid_tag = 'salt/job/{0}' . format ( jid ) #NEWLINE# raw = self . event . get_event ( wait , jid_tag ) #NEWLINE# if ( ( raw is not None ) and ( 'return' in raw ) ) : #NEWLINE# #INDENT# if ( 'minions' in raw . get ( 'data' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) : #NEWLINE# #INDENT# minions . update ( raw [ 'data' ] [ 'minions' ] ) #NEWLINE# continue #NEWLINE# #UNINDENT# found . add ( raw [ 'id' ] ) #NEWLINE# ret [ raw [ 'id' ] ] = { #NEWLINE# #INDENT# 'ret' : raw [ 'return' ] , #NEWLINE# #UNINDENT# } #NEWLINE# ret [ raw [ 'id' ] ] [ 'success' ] = raw . get ( 'success' , False ) #NEWLINE# if ( 'out' in raw ) : #NEWLINE# #INDENT# ret [ raw [ 'id' ] ] [ 'out' ] = raw [ 'out' ] #NEWLINE# #UNINDENT# if ( len ( found . intersection ( minions ) ) >= len ( minions ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# continue #NEWLINE# #UNINDENT# if ( len ( found . intersection ( minions ) ) >= len ( minions ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( int ( time . time ( ) ) > timeout_at ) : #NEWLINE# #INDENT# if ( verbose or show_timeout ) : #NEWLINE# #INDENT# if ( self . opts . get ( 'minion_data_cache' , False ) or ( tgt_type in ( 'glob' , 'pcre' , 'list' ) ) ) : #NEWLINE# #INDENT# if ( len ( found ) < len ( minions ) ) : #NEWLINE# #INDENT# fail = sorted ( list ( minions . difference ( found ) ) ) #NEWLINE# for minion in fail : #NEWLINE# #INDENT# ret [ minion ] = { #NEWLINE# #INDENT# 'out' : 'no_return' , #NEWLINE# 'ret' : 'Minion did not return' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# break #NEWLINE# #UNINDENT# time . sleep ( 0.01 ) #NEWLINE# #UNINDENT# self . _clean_up_subscriptions ( jid ) #NEWLINE# return ret