def _send_command(cmd, worker, lbn, target, profile='default', tgt_type='glob'):
 ret = {'code': False, 'msg': 'OK', 'minions': []}
 func = 'modjk.{0}'.format(cmd)
 args = [worker, lbn, profile]
 response = __salt__['publish.publish'](target, func, args, tgt_type)
 errors = []
 minions = []
 for minion in response:
  minions.append(minion)
  if (not response[minion]):
   errors.append(minion)
 if (not response):
  ret['msg'] = 'no servers answered the published command {0}'.format(cmd)
  return ret
 elif (len(errors) > 0):
  ret['msg'] = 'the following minions return False'
  ret['minions'] = errors
  return ret
 else:
  ret['code'] = True
  ret['msg'] = 'the commad was published successfully'
  ret['minions'] = minions
  return ret

def _send_command ( cmd , worker , lbn , target , profile = 'default' , tgt_type = 'glob' ) : ret = { 'code' : False , 'msg' : 'OK' , 'minions' : [ ] } func = 'modjk.{0}' . format ( cmd ) args = [ worker , lbn , profile ] response = __salt__ [ 'publish.publish' ] ( target , func , args , tgt_type ) errors = [ ] minions = [ ] for minion in response : minions . append ( minion ) if ( not response [ minion ] ) : errors . append ( minion ) if ( not response ) : ret [ 'msg' ] = 'no servers answered the published command {0}' . format ( cmd ) return ret elif ( len ( errors ) > 0 ) : ret [ 'msg' ] = 'the following minions return False' ret [ 'minions' ] = errors return ret else : ret [ 'code' ] = True ret [ 'msg' ] = 'the commad was published successfully' ret [ 'minions' ] = minions return ret
send a command to the modjk loadbalancer the minion need to be able to publish the commands to the load balancer cmd: worker_stop - wont get any traffic from the lbn worker_activate - activate the worker worker_disable - will get traffic only for current sessions .