

def _talk2modjk(name, lbn, target, action, profile='default', expr_form='glob'):
    '\n    Wrapper function for the stop/disable/activate functions\n    '
    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, expr_form)
    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, expr_form)
    ret['comment'] = response['msg']
    ret['result'] = response['code']
    return ret

dataset/ETHPy150Open saltstack/salt/salt/states/modjk_worker.py _talk2modjk/original