Skip to content
Permalink
Browse files

Derive from MKException

Change-Id: I8ac54b41f2035b7af9ac439e39a400e01dba3708
  • Loading branch information
si-23 committed Nov 22, 2019
1 parent 408e8db commit 6e59643a9cf8872d0b4972e63370b6b1de72b1d4
@@ -36,6 +36,7 @@ from optparse import OptionParser

import cmk.utils.render
import cmk.utils.password_store
from cmk.utils.exceptions import MKException
cmk.utils.password_store.replace_passwords()


@@ -82,7 +83,7 @@ class MailList(object):
return not self.__id_list


class LoginError(Exception):
class LoginError(MKException):
pass


@@ -35,6 +35,8 @@ import socket
import urllib2
import traceback

from cmk.utils.exceptions import MKException


def usage():
sys.stderr.write("""Check_MK ALLNET IP-Sensoric Agent
@@ -89,7 +91,7 @@ else:
socket.setdefaulttimeout(opt_timeout)


class RequestError(Exception):
class RequestError(MKException):
pass


@@ -35,6 +35,7 @@ import urllib3
import cmk
import cmk.utils.site
from cmk.utils.regex import regex
from cmk.utils.exceptions import MKException

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

@@ -121,7 +122,7 @@ class AggregationData(object):
self._aggregation_targets.setdefault(target_host, {})[aggr_name] = aggr


class RawdataException(Exception):
class RawdataException(MKException):
pass


@@ -54,6 +54,8 @@ import socket
import urllib2
import traceback

from cmk.utils.exceptions import MKException


def usage():
sys.stderr.write("""Check_MK Fritz!Box Agent
@@ -108,7 +110,7 @@ else:
socket.setdefaulttimeout(opt_timeout)


class RequestError(Exception):
class RequestError(MKException):
pass


@@ -32,6 +32,7 @@ import xml.etree.ElementTree as ET

import requests
from requests.packages import urllib3 # pylint: disable=import-error
from cmk.utils.exceptions import MKException

# TODO Add functionality in the future
#import cmk.utils.password_store
@@ -205,7 +206,7 @@ C_SERIES_ENTITIES = [
# '----------------------------------------------------------------------'


class CommunicationException(Exception):
class CommunicationException(MKException):
pass


@@ -35,6 +35,7 @@ import sys
import argparse
import requests

from cmk.utils.exceptions import MKException
LOGGER = logging.getLogger(__name__)


@@ -118,7 +119,7 @@ class ZertoConnection(object):
return response.headers.get('x-zerto-session')


class AuthError(Exception):
class AuthError(MKException):
pass


@@ -80,6 +80,7 @@ import npyscreen
import livestatus

from cmk.utils.render import fmt_bytes
from cmk.utils.exceptions import MKGeneralException

#.
# .--Helpers-------------------------------------------------------------.
@@ -134,10 +135,7 @@ def fmt_datetime(seconds):
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(seconds))


class MKGeneralException(Exception):
pass


#TODO use MKTerminate from utils; cleanup hierarchy
class MKTerminate(MKGeneralException):
pass

@@ -53,11 +53,12 @@
import cmk.utils.log
import cmk.utils.paths
import cmk.utils.store
from cmk.utils.exceptions import MKException
import cmk.ec.defaults
import cmk.ec.settings


class MkpRulePackBindingError(Exception):
class MkpRulePackBindingError(MKException):
"""Base class for exceptions related to rule pack binding"""
pass

@@ -68,6 +68,7 @@
import cmk.utils.regex
import cmk.utils.debug
from cmk.utils.encoding import convert_to_unicode
from cmk.utils.exceptions import MKException
from cmk.ec.crash_reporting import ECCrashReport, CrashReportStore

# suppress "Cannot find module" error from mypy
@@ -359,15 +360,15 @@ def replace_groups(text, origtext, match_groups):
return text


class MKSignalException(Exception):
class MKSignalException(MKException):
def __init__(self, signum):
Exception.__init__(self, "Got signal %d" % signum)
MKException.__init__(self, "Got signal %d" % signum)
self._signum = signum


class MKClientError(Exception):
class MKClientError(MKException):
def __init__(self, t):
Exception.__init__(self, t)
MKException.__init__(self, t)


#.
@@ -31,7 +31,11 @@

from cmk.gui.i18n import _

from cmk.utils.exceptions import MKGeneralException, MKException, MKTimeout
from cmk.utils.exceptions import (
MKException,
MKGeneralException,
MKTimeout,
)


class RequestTimeout(MKTimeout):
@@ -40,7 +44,7 @@ class RequestTimeout(MKTimeout):
pass


class FinalizeRequest(Exception):
class FinalizeRequest(MKException):
"""Is used to end the HTTP request processing from deeper code levels"""
def __init__(self, code):
# type: (int) -> None
@@ -38,14 +38,22 @@

import cmk.utils.paths
from cmk.utils.structured_data import StructuredDataTree, Container, Numeration, Attributes
from cmk.utils.exceptions import (
MKException,
MKGeneralException,
)

import cmk.gui.pages
import cmk.gui.config as config
import cmk.gui.userdb as userdb
import cmk.gui.sites as sites
from cmk.gui.i18n import _
from cmk.gui.globals import g, html
from cmk.gui.exceptions import MKException, MKGeneralException, MKAuthException, MKUserError, RequestTimeout
from cmk.gui.exceptions import (
MKAuthException,
MKUserError,
RequestTimeout,
)


def get_inventory_data(inventory_tree, tree_path):
@@ -32,7 +32,7 @@
import cmk.utils.plugin_registry
from cmk.gui.globals import html
import cmk.gui.config as config
from cmk.gui.exceptions import MKException
from cmk.utils.exceptions import MKException
from cmk.gui.log import logger


@@ -32,13 +32,17 @@
import livestatus

import cmk.utils.plugin_registry
from cmk.utils.exceptions import (
MKException,
MKGeneralException,
)

import cmk.gui.config as config
import cmk.gui.sites as sites
from cmk.gui.log import logger
from cmk.gui.i18n import _
from cmk.gui.globals import html
from cmk.gui.exceptions import HTTPRedirect, MKGeneralException, MKException
from cmk.gui.exceptions import HTTPRedirect
from cmk.gui.plugins.sidebar import SidebarSnapin, snapin_registry


@@ -37,10 +37,14 @@
import cmk.gui.userdb as userdb
import cmk.gui.watolib as watolib
import cmk.utils.rulesets.ruleset_matcher as ruleset_matcher
from cmk.utils.exceptions import MKException

from cmk.gui.i18n import _
from cmk.gui.globals import html
from cmk.gui.exceptions import MKUserError, MKAuthException, MKException
from cmk.gui.exceptions import (
MKUserError,
MKAuthException,
)
from cmk.gui.plugins.userdb.htpasswd import hash_password
import cmk.gui.watolib.users
from cmk.gui.watolib.tags import (
@@ -45,6 +45,7 @@

from cmk.notification_plugins import utils
import cmk.utils.site as site
from cmk.utils.exceptions import MKException


def tmpl_head_html(html_section):
@@ -481,7 +482,7 @@ def tmpl_head_html(html_section):
bulk_mode = '--bulk' in sys.argv


class GraphException(Exception):
class GraphException(MKException):
pass


@@ -45,6 +45,7 @@
import cmk.utils.store
from cmk.utils.paths import tmp_dir
import cmk.utils.password_store
from cmk.utils.exceptions import MKException
from cmk.special_agents.utils import (
datetime_serializer,
DataCache,
@@ -3395,5 +3396,5 @@ def main(sys_argv=None):
return 0


class AwsAccessError(Exception):
class AwsAccessError(MKException):
pass
@@ -70,14 +70,14 @@ def title(self):
# "normal" case and no exception handling like printing a stack trace
# nor an error message should be done. The program is stopped with
# exit code 0.
class MKTerminate(Exception):
class MKTerminate(MKException):
pass


# This is raised to print an error message and then end the program.
# The program should catch this at top level and end exit the program
# with exit code 3, in order to be compatible with monitoring plugin API.
class MKBailOut(Exception):
class MKBailOut(MKException):
def __init__(self, reason):
self.reason = reason
super(MKBailOut, self).__init__(reason)
@@ -33,6 +33,7 @@
from cmk.utils.exceptions import MKTimeout
from cmk.utils.plugin_loader import load_plugins
from cmk.utils.encoding import make_utf8
from cmk.utils.exceptions import MKException

import cmk_base.utils
import cmk_base.config as config
@@ -42,7 +43,7 @@


# TODO: Inherit from MKGeneralException
class MKAutomationError(Exception):
class MKAutomationError(MKException):
def __init__(self, reason):
# TODO: This disable is needed because of a pylint bug. Remove one day.
super(MKAutomationError, self).__init__(reason) # pylint: disable=bad-super-call
@@ -38,6 +38,7 @@
from cmk.utils.labels import DiscoveredHostLabelsStore
from cmk.utils.exceptions import MKGeneralException, MKTimeout
from cmk.utils.encoding import convert_to_unicode
from cmk.utils.exceptions import MKException

import cmk_base
import cmk_base.crash_reporting
@@ -530,7 +531,7 @@ def touch(filename):
touch(discovery_filename)


class DiscoveryTimeout(Exception):
class DiscoveryTimeout(MKException):
pass


@@ -29,10 +29,13 @@

import traceback

from cmk.utils.exceptions import MKGeneralException as _MKGeneralException
from cmk.utils.exceptions import (
MKException,
MKGeneralException,
)


class MKAgentError(Exception):
class MKAgentError(MKException):
def __init__(self, reason):
super(MKAgentError, self).__init__(reason)
self.reason = reason
@@ -41,15 +44,15 @@ def __str__(self):
return self.reason


class MKIPAddressLookupError(_MKGeneralException):
class MKIPAddressLookupError(MKGeneralException):
pass


class MKEmptyAgentData(MKAgentError):
pass


class MKParseFunctionError(Exception):
class MKParseFunctionError(MKException):
def __init__(self, exception_type, exception, backtrace):
self.exception_type = exception_type
self.exception = exception
@@ -63,7 +66,7 @@ def __str__(self):
return "%r\n%s" % (self.exception, "".join(traceback.format_tb(self.backtrace)))


class MKSNMPError(Exception):
class MKSNMPError(MKException):
def __init__(self, reason):
self.reason = reason
super(MKSNMPError, self).__init__(reason)
@@ -72,5 +75,5 @@ def __str__(self):
return self.reason


class MKSkipCheck(Exception):
class MKSkipCheck(MKException):
pass

0 comments on commit 6e59643

Please sign in to comment.
You can’t perform that action at this time.