Check if a server is enabled globally

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.server_enabled 'serverName'
498532
def server_enabled(s_name, **connection_args):
    '''
    
    '''
    server = _server_get(s_name, **connection_args)
    return server is not None and server.get_state() == 'ENABLED'
1352462
def include_server?(server)
      return false if (opts[:state] && server.state.name != opts[:state]) ||
                      (opts[:type] && server.instance_type != opts[:type]) ||
                      (opts[:zone] && server.placement.availability_zone != opts[:zone]) ||
                      (server.state.name == 'terminated' && !include_terminated?)

      true
    end
247059
def _chkconfig_is_enabled(name, runlevel=None):
    '''
    
    '''
    cmdline = '/sbin/chkconfig --list {0}'.format(name)
    result = __salt__['cmd.run_all'](cmdline, python_shell=False)

    if runlevel is None:
        runlevel = _runlevel()
    if result['retcode'] == 0:
        for row in result['stdout'].splitlines():
            if '{0}:on'.format(runlevel) in row:
                if row.split()[0] == name:
                    return True
            elif row.split() == [name, 'on']:
                return True
    return False
839671
def is_disabled(self, name):
        
        if self.services and name in self.services:
            return self.services[name]['config'] == 'disabled'
        return False
1083700
def check_global_status(flag, name, oid):
    
    # only check the status, if the "no" flag is not set
    if flag:
        # get the data via snmp
        myData = get_data(sess, oid, helper)
        data_summary_output, data_long_output = state_summary(myData, name, normal_state, helper)
        add_output(data_summary_output, data_long_output, helper)
80106
def check_server(self):
        
        msg = 'API server not found. Please check your API url configuration.'

        try:
            response = self.session.head(self.domain)
        except Exception as e:
            raise_from(errors.ServerError(msg), e)

        try:
            self._check_response(response)
        except errors.NotFound as e:
            raise raise_from(errors.ServerError(msg), e)
60056
def enabled(name, **kwargs):
    '''
    
    '''
    # The property that reveals whether a service is enabled
    # can only be queried using the full FMRI
    # We extract the FMRI and then do the query
    fmri_cmd = '/usr/bin/svcs -H -o FMRI {0}'.format(name)
    fmri = __salt__['cmd.run'](fmri_cmd, python_shell=False)
    cmd = '/usr/sbin/svccfg -s {0} listprop general/enabled'.format(fmri)
    comps = __salt__['cmd.run'](cmd, python_shell=False).split()
    if comps[2] == 'true':
        return True
    else:
        return False
160296
def do_server(self, arg):
        
        if arg['on']:
            self.server_on()
        elif arg['off']:
            self.server_off()
        elif arg['restart']:
            self.server_restart()
        elif arg['log']:
            self.server_log()
        else:
            self.help_server()
1037170
def is_available(self):
        
        # if the availability flag is raised, return True immediately.
        # NOTE: subsequent API failures will lower this flag. we do this here
        # to ensure we don't keep hitting Joe with requests while availability
        # is there.
        if self.server_available:
            return True

        # otherwise, we have to check with the cloud.
        else:

            try:
                self.server_available = self.jbx.server_online()
                return self.server_available
            except jbxapi.JoeException:
                pass

        self.server_available = False
        return False
87075
def start_accepting_passive_host_checks(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if not self.my_conf.accept_passive_host_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_PASSIVE_CHECKS_ENABLED"].value
            self.my_conf.accept_passive_host_checks = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
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
1261374
def server_exists(s_name, ip=None, s_state=None, **connection_args):
    '''
    
    '''
    server = _server_get(s_name, **connection_args)
    if server is None:
        return False
    if ip is not None and ip != server.get_ipaddress():
        return False
    if s_state is not None and s_state.upper() != server.get_state():
        return False
    return True
277726
async def enable(self, ctx, *, command: str):
        
        command = command.lower()
        guild_id = ctx.message.server.id
        cmds = self.config.get('commands', {})
        entries = cmds.get(guild_id, [])

        try:
            entries.remove(command)
        except KeyError:
            await self.bot.responses.failure(message='The command does not exist or is not disabled.')
        else:
            cmds[guild_id] = entries
            await self.config.put('commands', cmds)
            await self.bot.responses.success(message='"%s" command enabled in this server.' % command)
172827
def check_rest(args):
    ''''''
    nni_config = Config(get_config_filename(args))
    rest_port = nni_config.get_config('restServerPort')
    running, _ = check_rest_server_quick(rest_port)
    if not running:
        print_normal('Restful server is running...')
    else:
        print_normal('Restful server is not running...')
14423
def server_check(arg):
    
    if arg.startswith(('http://', 'https://', 'http+unix://')):
        return arg
    if arg.startswith('./'):
        arg = os.path.abspath(arg)
    elif not arg.startswith('/'):
        raise argparse.ArgumentTypeError(
            'Unix socket path must start with / or ./')
    # assume it is a unix socket
    return 'http+unix://{}'.format(url_escape(arg, ''))
857809
private boolean checkVmIsOnline() {

		String zoneName = OpenstackIaasHandler.findZoneName( this.novaApi, this.targetProperties );
		Server server = this.novaApi.getServerApiForZone( zoneName ).get(this.machineId);
		return Status.ACTIVE.equals(server.getStatus());
	}
1272605
def check_virtualserver(self, name):
        '''
        
        '''
        vs = self.bigIP.LocalLB.VirtualServer
        for v in vs.get_list():
            if v.split('/')[-1] == name:
                return True
        return False