#NEWLINE# def action( self ) : #NEWLINE# #INDENT# '\n        Initial pillar\n        ' #NEWLINE# available_masters = [ remote for remote in list ( self . road_stack . value . remotes . values ( ) ) if remote . allowed ] #NEWLINE# while ( not available_masters ) : #NEWLINE# #INDENT# available_masters = [ remote for remote in self . road_stack . value . remotes . values ( ) if sender . allowed ] #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# #UNINDENT# random_master = self . opts . value . get ( 'random_master' ) #NEWLINE# if random_master : #NEWLINE# #INDENT# master = available_masters [ random . randint ( 0 , ( len ( available_masters ) - 1 ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# master = available_masters [ 0 ] #NEWLINE# #UNINDENT# self . master_estate_name . value = master . name #NEWLINE# route = { #NEWLINE# #INDENT# 'src' : ( self . road_stack . value . local . name , None , None ) , #NEWLINE# 'dst' : ( master . name , None , 'remote_cmd' ) , #NEWLINE# #UNINDENT# } #NEWLINE# load = { #NEWLINE# #INDENT# 'id' : self . opts . value [ 'id' ] , #NEWLINE# 'grains' : self . grains . value , #NEWLINE# 'saltenv' : self . opts . value [ 'environment' ] , #NEWLINE# 'ver' : '2' , #NEWLINE# 'cmd' : '_pillar' , #NEWLINE# #UNINDENT# } #NEWLINE# self . road_stack . value . transmit ( { #NEWLINE# #INDENT# 'route' : route , #NEWLINE# 'load' : load , #NEWLINE# #UNINDENT# } , uid = master . uid ) #NEWLINE# self . road_stack . value . serviceAll ( ) #NEWLINE# while True : #NEWLINE# #INDENT# time . sleep ( 0.1 ) #NEWLINE# while self . road_stack . value . rxMsgs : #NEWLINE# #INDENT# ( msg , sender ) = self . road_stack . value . rxMsgs . popleft ( ) #NEWLINE# self . pillar . value = msg . get ( 'return' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( self . pillar . value is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# self . opts . value [ 'pillar' ] = self . pillar . value #NEWLINE# self . pillar_refresh . value = False #NEWLINE# return #NEWLINE# #UNINDENT# self . road_stack . value . serviceAll ( )