Return the enabled services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_enabled
764519
def get_enabled():
    '''
    
    '''
    ret = set()
    for name in _iter_service_names():
        if _service_is_upstart(name):
            if _upstart_is_enabled(name):
                ret.add(name)
        else:
            if _service_is_sysv(name):
                if _sysv_is_enabled(name):
                    ret.add(name)
    return sorted(ret)
183051
def enable(name, **kwargs):
    '''
    
    '''
    if _service_is_upstart(name):
        return _upstart_enable(name)
    executable = _get_service_exec()
    cmd = '{0} -f {1} defaults'.format(executable, name)
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
515984
def is_enabled():
    '''
    
    '''
    cmd = 'service -e'
    services = __salt__['cmd.run'](cmd, python_shell=False)
    for service in services.split('\\n'):
        if re.search('jail', service):
            return True
    return False
1321173
def enabled(name, **kwargs):
    '''
    
    '''
    if _service_is_upstart(name):
        return _upstart_is_enabled(name)
    else:
        if _service_is_sysv(name):
            return _sysv_is_enabled(name)
    return None
535911
private static function get_enabled() {
        global $CFG;

        $active = array();
        if (empty($CFG->antiviruses)) {
            return $active;
        }

        foreach (explode(',', $CFG->antiviruses) as $e) {
            if ($antivirus = self::get_antivirus($e)) {
                if ($antivirus->is_configured()) {
                    $active[$e] = $antivirus;
                }
            }
        }
        return $active;
    }
1315851
def enable(name):
    '''
    
    '''
    cmd = 'systemctl enable systemd-nspawn@{0}'.format(name)
    if __salt__['cmd.retcode'](cmd, python_shell=False) != 0:
        __context__['retcode'] = salt.defaults.exitcodes.EX_UNAVAILABLE
        return False
    return True
1027854
def schedule_enabled():
    '''
    
    '''
    cmd = ['softwareupdate', '--schedule']
    ret = salt.utils.mac_utils.execute_return_result(cmd)

    enabled = ret.split()[-1]

    return salt.utils.mac_utils.validate_enabled(enabled) == 'on'
1222462
def get_send_enable(self):
        

        # We have to open this queue before we make the request, to ensure we don't miss the response.
        queue = self._pebble.get_endpoint_queue(DataLogging)

        self._pebble.send_packet(DataLogging(data=DataLoggingGetSendEnableRequest()))
        enabled = False
        while True:
            result = queue.get().data
            if isinstance(result, DataLoggingGetSendEnableResponse):
                enabled = result.enabled
                break

        queue.close()
        return enabled
1322346
def _get_service_config(self):
        
        # Should work for windows, osx, and linux environments
        if not os.path.exists(self.config_path):
            try:
                os.makedirs(os.path.dirname(self.config_path))
            except OSError as exc:
                if exc.errno != errno.EEXIST:
                    raise

            return {}

        with open(self.config_path, 'r') as data:
            return json.load(data)
1353590
def get_all():
    '''
    
    '''
    (enabled_services, disabled_services) = _get_service_list(include_enabled=True,
                                                              include_disabled=True)
    enabled_services.update(dict([(s, []) for s in disabled_services]))
    return odict.OrderedDict(enabled_services)
1240867
def _disable(name, started, result=True, skip_verify=False, **kwargs):
    '''
    
    '''
    ret = {}

    if not skip_verify:
        # is service available?
        try:
            if not _available(name, ret):
                ret['result'] = True
                return ret
        except CommandExecutionError as exc:
            ret['result'] = False
            ret['comment'] = exc.strerror
            return ret

    # Set default expected result
    ret['result'] = result

    # is enable/disable available?
    if 'service.disable' not in __salt__ or 'service.disabled' not in __salt__:
        if started is True:
            ret['comment'] = ('Disable is not available on this minion,'
                              ' service {0} started').format(name)
        elif started is None:
            ret['comment'] = ('Disable is not available on this minion,'
                              ' service {0} is in the desired state'
                              ).format(name)
        else:
            ret['comment'] = ('Disable is not available on this minion,'
                              ' service {0} is dead').format(name)
        return ret

    # Service can be disabled
    if salt.utils.platform.is_windows():
        # service.disabled in Windows returns True for services that are set to
        # Manual start, so we need to check specifically for Disabled
        before_toggle_disable_status = __salt__['service.info'](name)['StartType'] in ['Disabled']
    else:
        before_toggle_disable_status = __salt__['service.disabled'](name)
    if before_toggle_disable_status:
        # Service is disabled
        if started is True:
            ret['comment'] = ('Service {0} is already disabled,'
                              ' and is running').format(name)
        elif started is None:
            # always be sure in this case to reset the changes dict
            ret['changes'] = {}
            ret['comment'] = ('Service {0} is already disabled,'
                              ' and is in the desired state').format(name)
        else:
            ret['comment'] = ('Service {0} is already disabled,'
                              ' and is dead').format(name)
        return ret

    # Service needs to be disabled
    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Service {0} set to be disabled'.format(name)
        return ret

    if __salt__['service.disable'](name, **kwargs):
        # Service has been disabled
        ret['changes'] = {}
        after_toggle_disable_status = __salt__['service.disabled'](name)
        # on upstart, certain services like apparmor will always return
        # False, even if correctly activated
        # do not trigger a change
        if before_toggle_disable_status != after_toggle_disable_status:
            ret['changes'][name] = True
        if started is True:
            ret['comment'] = ('Service {0} has been disabled,'
                              ' and is running').format(name)
        elif started is None:
            ret['comment'] = ('Service {0} has been disabled,'
                              ' and is in the desired state').format(name)
        else:
            ret['comment'] = ('Service {0} has been disabled,'
                              ' and is dead').format(name)
        return ret

    # Service failed to be disabled
    ret['result'] = False
    if started is True:
        ret['comment'] = ('Failed when setting service {0} to not start'
                          ' at boot, and is running').format(name)
    elif started is None:
        ret['comment'] = ('Failed when setting service {0} to not start'
                          ' at boot, but the service was already running'
                          ).format(name)
    else:
        ret['comment'] = ('Failed when setting service {0} to not start'
                          ' at boot, and the service is dead').format(name)
    return ret
543158
def _get_enabled_disabled(enabled_prop="true"):
    '''
    
    '''
    ret = set()
    cmd = '/usr/bin/svcprop -c -p general/enabled "*"'
    lines = __salt__['cmd.run_stdout'](cmd, python_shell=False).splitlines()
    for line in lines:
        comps = line.split()
        if not comps:
            continue
        if comps[2] == enabled_prop:
            ret.add(comps[0].split("/:properties")[0])
    return sorted(ret)
375385
def service_get(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.get_service(**kwargs)
507231
def get_config(self, service, setting):
        
        try:
            return self.get_service(service)[setting]
        except KeyError:
            return getattr(self, setting + '_DEFAULT')
1275454
def enable_plugin(name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    cmd = [_get_rabbitmq_plugin(), 'enable', name]
    ret = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
    return _format_response(ret, 'Enabled')
152285
def parse_services(rule):
    '''
    
    '''
    parser = argparse.ArgumentParser()
    rules = shlex.split(rule)
    rules.pop(0)
    parser.add_argument('--disabled', dest='disabled', action='store')
    parser.add_argument('--enabled', dest='enabled', action='store')

    args = clean_args(vars(parser.parse_args(rules)))
    parser = None
    return args
468175
def get_capabilities(self):
        
        params = {'service'      : 'WFS',
                  'request'      : 'GetCapabilities',
                  'version'      : '1.0.0'}

        caps_response = requests.get(self._wfs_server, params=params)
        caps_response.raise_for_status()

        return ET.fromstring(caps_response.content)