def _talk2modjk(name, lbn, target, action, profile='default', tgt_type='glob'):
 ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
 action_map = {'worker_stop': 'STP', 'worker_disable': 'DIS', 'worker_activate': 'ACT'}
 status = _worker_status(target, name, action_map[action], profile, tgt_type)
 if (not status['result']):
  ret['result'] = False
  ret['comment'] = 'no servers answered the published command modjk.worker_status'
  return ret
 if status['errors']:
  ret['result'] = False
  ret['comment'] = 'the following balancers could not find the worker {0}: {1}'.format(name, status['errors'])
  return ret
 if (not status['wrong_state']):
  ret['comment'] = 'the worker is in the desired activation state on all the balancers'
  return ret
 else:
  ret['comment'] = 'the action {0} will be sent to the balancers {1}'.format(action, status['wrong_state'])
  ret['changes'] = {action: status['wrong_state']}
 if __opts__['test']:
  ret['result'] = None
  return ret
 response = _send_command(action, name, lbn, target, profile, tgt_type)
 ret['comment'] = response['msg']
 ret['result'] = response['code']
 return ret

def _talk2modjk ( name , lbn , target , action , profile = 'default' , tgt_type = 'glob' ) : ret = { 'name' : name , 'result' : True , 'changes' : { } , 'comment' : '' } action_map = { 'worker_stop' : 'STP' , 'worker_disable' : 'DIS' , 'worker_activate' : 'ACT' } status = _worker_status ( target , name , action_map [ action ] , profile , tgt_type ) if ( not status [ 'result' ] ) : ret [ 'result' ] = False ret [ 'comment' ] = 'no servers answered the published command modjk.worker_status' return ret if status [ 'errors' ] : ret [ 'result' ] = False ret [ 'comment' ] = 'the following balancers could not find the worker {0}: {1}' . format ( name , status [ 'errors' ] ) return ret if ( not status [ 'wrong_state' ] ) : ret [ 'comment' ] = 'the worker is in the desired activation state on all the balancers' return ret else : ret [ 'comment' ] = 'the action {0} will be sent to the balancers {1}' . format ( action , status [ 'wrong_state' ] ) ret [ 'changes' ] = { action : status [ 'wrong_state' ] } if __opts__ [ 'test' ] : ret [ 'result' ] = None return ret response = _send_command ( action , name , lbn , target , profile , tgt_type ) ret [ 'comment' ] = response [ 'msg' ] ret [ 'result' ] = response [ 'code' ] return ret
wrapper function for the stop/disable/activate functions .