Enters maintenance mode

        Parameters:
            reason (str): Reason of disabling
        Returns:
            bool: ``True`` on success
190705
async def disable(self, reason=None):
        
        params = {"enable": True, "reason": reason}
        response = await self._api.put("/v1/agent/maintenance", params=params)
        return response.status == 200
1295223
def deactivate(self):
        
        if not self._optional:
            self._optional = True

        self._activated = False
893229
def get_reason_for_status(status_code):
        

        if status_code in requests.status_codes.codes:
            return requests.status_codes._codes[status_code][0].replace('_',
                                                                        ' ')
        else:
            return 'Unknown status code - {0}'.format(status_code)
875420
public function activate() {
		$duration = (int)$this->params['duration'];
		$this->Maintenance->setMaintenanceMode($duration);
		$this->out('Maintenance mode activated ...');
	}
1057635
def set_maintenance_mode(value):
    

    # If maintenance mode is defined in settings, it can't be changed.
    if settings.MAINTENANCE_MODE is not None:
        raise ImproperlyConfigured(
            'Maintenance mode cannot be set dynamically '
            'if defined in settings.')

    if not isinstance(value, bool):
        raise TypeError('value argument type is not boolean')

    backend = get_maintenance_mode_backend()
    backend.set_value(value)
643846
def require_login_allowed(f):
    

    @functools.wraps(f)
    def deco(*a, **kw):
        if not __options__.get("allow_login"):
            abort(403, "Login not allowed. Contact admin if it's a mistake")
        return f(*a, **kw)

    return deco
367520
public static function enableMaintenanceMode()
    {
        $config = Config::getInstance();

        $tracker = $config->Tracker;
        $tracker['record_statistics'] = 0;
        $config->Tracker = $tracker;

        $general = $config->General;
        $general['maintenance_mode'] = 1;
        $config->General = $general;

        $config->forceSave();
    }
35429
protected void deactivate(ComponentContext context, int reason) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Deactivating, reason=" + reason);
        }

        this.registry.removeAll();
    }
294473
def mode(self, mode):
        
        allowed_values = ["test", "live"]
        if mode is not None and mode not in allowed_values:
            raise ValueError(
                "Invalid value for `mode` ({0}), must be one of {1}"
                .format(mode, allowed_values)
            )

        self._mode = mode
1340652
def disable(self):
        
        if not self._expert:
            self.config(state='disable')
        self._active = False
912580
def is_enabled(self):
        
        if self.name in settings.exclude_rules:
            return False
        elif self.name in settings.rules:
            return True
        elif self.enabled_by_default and ALL_ENABLED in settings.rules:
            return True
        else:
            return False
657918
def reason(self, reason):
        

        if reason is None:
            raise ValueError("Invalid value for `reason`, must not be `None`")
        if len(reason) > 192:
            raise ValueError("Invalid value for `reason`, length must be less than `192`")

        self._reason = reason
1267454
public function actionEnable()
    {
        $maintenance = Yii::$app->maintenanceMode;

        if (!$maintenance->getIsEnabled(true) && $maintenance->enable()) {
            $this->stdout("Maintenance mode enabled successfully.\n", Console::FG_GREEN);
            return Controller::EXIT_CODE_NORMAL;
        } else {
            $this->stdout("Maintenance mode already enabled.\n", Console::FG_RED);
            return Controller::EXIT_CODE_ERROR;
        }
    }
805347
def _enable(name, started, result=True, skip_verify=False, **kwargs):
    '''
    
    '''
    ret = {}

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

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

    # Check to see if this minion supports enable
    if 'service.enable' not in __salt__ or 'service.enabled' not in __salt__:
        if started is True:
            ret['comment'] = ('Enable is not available on this minion,'
                              ' service {0} started').format(name)
        elif started is None:
            ret['comment'] = ('Enable is not available on this minion,'
                              ' service {0} is in the desired state'
                              ).format(name)
        else:
            ret['comment'] = ('Enable is not available on this minion,'
                              ' service {0} is dead').format(name)
        return ret

    # Service can be enabled
    before_toggle_enable_status = __salt__['service.enabled'](name, **kwargs)
    if before_toggle_enable_status:
        # Service is enabled
        if started is True:
            ret['comment'] = ('Service {0} is already enabled,'
                              ' 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 enabled,'
                              ' and is in the desired state').format(name)
        else:
            ret['comment'] = ('Service {0} is already enabled,'
                              ' and is dead').format(name)
        return ret

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

    try:
        if __salt__['service.enable'](name, **kwargs):
            # Service has been enabled
            ret['changes'] = {}
            after_toggle_enable_status = __salt__['service.enabled'](
                name,
                **kwargs)
            # on upstart, certain services like apparmor will always return
            # False, even if correctly activated
            # do not trigger a change
            if before_toggle_enable_status != after_toggle_enable_status:
                ret['changes'][name] = True
            if started is True:
                ret['comment'] = ('Service {0} has been enabled,'
                                  ' and is running').format(name)
            elif started is None:
                ret['comment'] = ('Service {0} has been enabled,'
                                  ' and is in the desired state').format(name)
            else:
                ret['comment'] = ('Service {0} has been enabled,'
                                  ' and is dead').format(name)
            return ret
    except CommandExecutionError as exc:
        enable_error = exc.strerror
    else:
        enable_error = False

    # Service failed to be enabled
    ret['result'] = False
    if started is True:
        ret['comment'] = ('Failed when setting service {0} to start at boot,'
                          ' but the service is running').format(name)
    elif started is None:
        ret['comment'] = ('Failed when setting service {0} to start at boot,'
                          ' but the service was already running').format(name)
    else:
        ret['comment'] = ('Failed when setting service {0} to start at boot,'
                          ' and the service is dead').format(name)

    if enable_error:
        ret['comment'] += '. Additional information follows:\n\n{0}'.format(
            enable_error
        )

    return ret
554481
def registrationEnabled(self):
        '''  '''
        return self.status in [self.RegStatus.enabled,self.RegStatus.heldOpen,self.RegStatus.heldClosed]
954396
def do_enable(self, arg):
        
        args = arg.split()
        for i in args:
            try:
                bp = self.get_bpbynumber(i)
            except ValueError as err:
                self.error(err)
            else:
                bp.enable()
                self.done_breakpoint_state(bp, True)
331360
@Deactivate
    protected void deactivate(int reason) {
        final String methodName = "deactivate";
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(tc, methodName, "Entry Count: " + ++JDBCMBeanRuntime.counterDeactivate);
        if (trace && tc.isEventEnabled())
            Tr.event(tc, className + methodName + ", reason=" + reason);
        if (trace && tc.isEntryEnabled())
            Tr.exit(tc, methodName, "Normal Exit");
    }