blob: 354fb169f791845783fc0ad0b108aa2d5b7457bd [file] [log] [blame]
Alex0989ecf2022-03-29 13:43:21 -05001# Author: Alex Savatieiev (osavatieiev@mirantis.com; a.savex@gmail.com)
2# Copyright 2019-2022 Mirantis, Inc.
Alex Savatieiev5118de02019-02-20 15:50:42 -06003class CheckerBaseExceptions(Exception):
Alex Savatieievd48994d2018-12-13 12:13:00 +01004 pass
5
6
Alex Savatieiev5118de02019-02-20 15:50:42 -06007class CheckerException(CheckerBaseExceptions):
Alex Savatieievd48994d2018-12-13 12:13:00 +01008 def __init__(self, message, *args, **kwargs):
9 super(CheckerException, self).__init__(message, *args, **kwargs)
10 # get the trace
11 # TODO: get and log traceback
12
13 # prettify message
Alex Savatieievf808cd22019-03-01 13:17:59 -060014 self.message = "# CheckerException: {}".format(message)
Alex Savatieievd48994d2018-12-13 12:13:00 +010015
16
17class ConfigException(CheckerException):
18 def __init__(self, message, *args, **kwargs):
19 super(ConfigException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060020 self.message = "# Configuration error: {}".format(message)
Alex Savatieiev63576832019-02-27 15:46:26 -060021
22
Alex9a4ad212020-10-01 18:04:25 -050023class CommandNotSupportedException(CheckerException):
24 def __init__(self, message, *args, **kwargs):
25 super(CommandNotSupportedException, self).__init__(
26 message,
27 *args,
28 **kwargs
29 )
30 self.message = "# Command not supported: {}".format(message)
31
32
33class CommandTypeNotSupportedException(CheckerException):
34 def __init__(self, message, *args, **kwargs):
35 super(CommandTypeNotSupportedException, self).__init__(
36 message,
37 *args,
38 **kwargs
39 )
40 self.message = "# Command type not supported: {}".format(message)
41
42
Alex Savatieiev63576832019-02-27 15:46:26 -060043class SaltException(CheckerException):
44 def __init__(self, message, *args, **kwargs):
45 super(SaltException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060046 self.message = "# Salt error: {}".format(message)
Alex Savatieiev63576832019-02-27 15:46:26 -060047
48
Alex9a4ad212020-10-01 18:04:25 -050049class KubeException(CheckerException):
50 def __init__(self, message, *args, **kwargs):
51 super(KubeException, self).__init__(message, *args, **kwargs)
52 self.message = "# Kube client error: {}".format(message)
53
54
Alex Savatieiev63576832019-02-27 15:46:26 -060055class InvalidReturnException(CheckerException):
56 def __init__(self, message, *args, **kwargs):
57 super(InvalidReturnException, self).__init__(message, *args, **kwargs)
Alex Savatieievf808cd22019-03-01 13:17:59 -060058 self.message = "# Unexpected return value: {}".format(message)
Alex3ebc5632019-04-18 16:47:18 -050059
60
Alex9a4ad212020-10-01 18:04:25 -050061class TimeoutException(CheckerException):
62 def __init__(self, message, *args, **kwargs):
63 super(TimeoutException, self).__init__(message, *args, **kwargs)
64 self.message = "# Timed out waiting: {}".format(message)
65
66
Alex3ebc5632019-04-18 16:47:18 -050067class ErrorMappingException(CheckerException):
68 def __init__(self, message, *args, **kwargs):
69 super(ErrorMappingException, self).__init__(message, *args, **kwargs)
70 self.message = "# Unexpected error mapping/type: {}".format(message)