def set_target(module, target, module_parameter=None, action_parameter=None):
    '''
    Set the target for the given module.
    Target can be specified by index or name.

    module
        name of the module for which a target should be set

    target
        name of the target to be set for this module

    module_parameter
        additional params passed to the defined module

    action_parameter
        additional params passed to the defined action

    CLI Example (setting target of system-wide ``java-vm``):

    .. code-block:: bash

        salt '*' eselect.set_target java-vm icedtea-bin-7 action_parameter='system'

    CLI Example (setting target of ``kernel`` symlink):

    .. code-block:: bash

        salt '*' eselect.set_target kernel linux-3.17.5-gentoo
    '''
    if action_parameter:
        action_parameter = '{0} {1}'.format(action_parameter, target)
    else:
        action_parameter = target

    # get list of available modules
    if module not in get_modules():
        log.error('Module {0} not available'.format(module))
        return False

    exec_result = exec_action(module, 'set', module_parameter=module_parameter, action_parameter=action_parameter, state_only=True)
    if exec_result:
        return exec_result
    return False
dataset/ETHPy150Open saltstack/salt/salt/modules/eselect.py/set_target/original