blob: 4ee3a99569dc182a333b2d5b4109b7e18d105349 [file] [log] [blame]
Alex Savatieievd48994d2018-12-13 12:13:00 +01001
Alex Savatieiev5118de02019-02-20 15:50:42 -06002class CheckerBaseExceptions(Exception):
Alex Savatieievd48994d2018-12-13 12:13:00 +01003 pass
4
5
Alex Savatieiev5118de02019-02-20 15:50:42 -06006class CheckerException(CheckerBaseExceptions):
Alex Savatieievd48994d2018-12-13 12:13:00 +01007 def __init__(self, message, *args, **kwargs):
8 super(CheckerException, self).__init__(message, *args, **kwargs)
9 # get the trace
10 # TODO: get and log traceback
11
12 # prettify message
Alex Savatieievf808cd22019-03-01 13:17:59 -060013 self.message = "# CheckerException: {}".format(message)
Alex Savatieievd48994d2018-12-13 12:13:00 +010014
15
16class ConfigException(CheckerException):
17 def __init__(self, message, *args, **kwargs):
18 super(ConfigException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060019 self.message = "# Configuration error: {}".format(message)
Alex Savatieiev63576832019-02-27 15:46:26 -060020
21
Alex9a4ad212020-10-01 18:04:25 -050022class CommandNotSupportedException(CheckerException):
23 def __init__(self, message, *args, **kwargs):
24 super(CommandNotSupportedException, self).__init__(
25 message,
26 *args,
27 **kwargs
28 )
29 self.message = "# Command not supported: {}".format(message)
30
31
32class CommandTypeNotSupportedException(CheckerException):
33 def __init__(self, message, *args, **kwargs):
34 super(CommandTypeNotSupportedException, self).__init__(
35 message,
36 *args,
37 **kwargs
38 )
39 self.message = "# Command type not supported: {}".format(message)
40
41
Alex Savatieiev63576832019-02-27 15:46:26 -060042class SaltException(CheckerException):
43 def __init__(self, message, *args, **kwargs):
44 super(SaltException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060045 self.message = "# Salt error: {}".format(message)
Alex Savatieiev63576832019-02-27 15:46:26 -060046
47
Alex9a4ad212020-10-01 18:04:25 -050048class KubeException(CheckerException):
49 def __init__(self, message, *args, **kwargs):
50 super(KubeException, self).__init__(message, *args, **kwargs)
51 self.message = "# Kube client error: {}".format(message)
52
53
Alex Savatieiev63576832019-02-27 15:46:26 -060054class InvalidReturnException(CheckerException):
55 def __init__(self, message, *args, **kwargs):
56 super(InvalidReturnException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060057 self.message = "# Unexpected return value: {}".format(message)
Alex3ebc5632019-04-18 16:47:18 -050058
59
Alex9a4ad212020-10-01 18:04:25 -050060class TimeoutException(CheckerException):
61 def __init__(self, message, *args, **kwargs):
62 super(TimeoutException, self).__init__(message, *args, **kwargs)
63 self.message = "# Timed out waiting: {}".format(message)
64
65
Alex3ebc5632019-04-18 16:47:18 -050066class ErrorMappingException(CheckerException):
67 def __init__(self, message, *args, **kwargs):
68 super(ErrorMappingException, self).__init__(message, *args, **kwargs)
69 self.message = "# Unexpected error mapping/type: {}".format(message)