def _publish(tgt, fun, arg=None, tgt_type='glob', returner='', timeout=5, form='clean'):
 if (fun == 'publish.publish'):
  log.info("Function name is 'publish.publish'. Returning {}")
  return {}
 arg = _parse_args(arg)
 load = {'cmd': 'minion_pub', 'fun': fun, 'arg': arg, 'tgt': tgt, 'tgt_type': tgt_type, 'ret': returner, 'tmo': timeout, 'form': form, 'id': __opts__['id']}
 channel = salt.transport.Channel.factory(__opts__)
 try:
  peer_data = channel.send(load)
 except SaltReqTimeoutError:
  return "'{0}' publish timed out".format(fun)
 if (not peer_data):
  return {}
 time.sleep(float(timeout))
 load = {'cmd': 'pub_ret', 'id': __opts__['id'], 'jid': str(peer_data['jid'])}
 ret = channel.send(load)
 if (form == 'clean'):
  cret = {}
  for host in ret:
   cret[host] = ret[host]['ret']
  return cret
 else:
  return ret

def _publish ( tgt , fun , arg = None , tgt_type = 'glob' , returner = '' , timeout = 5 , form = 'clean' ) : if ( fun == 'publish.publish' ) : log . info ( "Function name is 'publish.publish'. Returning {}" ) return { } arg = _parse_args ( arg ) load = { 'cmd' : 'minion_pub' , 'fun' : fun , 'arg' : arg , 'tgt' : tgt , 'tgt_type' : tgt_type , 'ret' : returner , 'tmo' : timeout , 'form' : form , 'id' : __opts__ [ 'id' ] } channel = salt . transport . Channel . factory ( __opts__ ) try : peer_data = channel . send ( load ) except SaltReqTimeoutError : return "'{0}' publish timed out" . format ( fun ) if ( not peer_data ) : return { } time . sleep ( float ( timeout ) ) load = { 'cmd' : 'pub_ret' , 'id' : __opts__ [ 'id' ] , 'jid' : str ( peer_data [ 'jid' ] ) } ret = channel . send ( load ) if ( form == 'clean' ) : cret = { } for host in ret : cret [ host ] = ret [ host ] [ 'ret' ] return cret else : return ret
publish a command from the minion out to other minions .