def _switch(name,                   # pylint: disable=C0103
            on,                     # pylint: disable=C0103
            **kwargs):
    if not available(name):
        return False

    rcvar = _get_rcvar(name)
    if not rcvar:
        log.error('rcvar for service {0} not found'.format(name))
        return False

    config = kwargs.get('config',
                        __salt__['config.option']('service.config',
                                                  default='/etc/rc.conf'
                                                  )
                        )

    if not config:
        rcdir = '/etc/rc.conf.d'
        if not os.path.exists(rcdir) or not os.path.isdir(rcdir):
            log.error('{0} not exists'.format(rcdir))
            return False
        config = os.path.join(rcdir, rcvar.replace('_enable', ''))

    nlines = []
    edited = False

    if on:
        val = 'YES'
    else:
        val = 'NO'

    if os.path.exists(config):
        with salt.utils.fopen(config, 'r') as ifile:
            for line in ifile:
                if not line.startswith('{0}='.format(rcvar)):
                    nlines.append(line)
                    continue
                rest = line[len(line.split()[0]):]  # keep comments etc
                nlines.append('{0}="{1}"{2}'.format(rcvar, val, rest))
                edited = True
    if not edited:
        # Ensure that the file ends in a \n
        if len(nlines) > 1 and nlines[-1][-1] != '\n':
            nlines[-1] = '{0}\n'.format(nlines[-1])
        nlines.append('{0}="{1}"\n'.format(rcvar, val))

    with salt.utils.fopen(config, 'w') as ofile:
        ofile.writelines(nlines)

    return True
Return a list of branch names of this repo, ordered by the time they
dataset/ETHPy150Open saltstack/salt/salt/modules/freebsdservice.py/_switch--crossover with--dataset/ETHPy150Open jonashaag/klaus/klaus/repo.py/FancyRepo.get_branch_names