]>
Commit | Line | Data |
---|---|---|
d2e6a577 FG |
1 | import os |
2 | ||
3 | ||
4 | class ConfigurationError(Exception): | |
5 | ||
6 | def __init__(self, cluster_name='ceph', path='/etc/ceph', abspath=None): | |
7 | self.cluster_name = cluster_name | |
8 | self.path = path | |
9 | self.abspath = abspath or "%s.conf" % os.path.join(self.path, self.cluster_name) | |
10 | ||
11 | def __str__(self): | |
12 | return 'Unable to load expected Ceph config at: %s' % self.abspath | |
13 | ||
14 | ||
15 | class ConfigurationSectionError(Exception): | |
16 | ||
17 | def __init__(self, section): | |
18 | self.section = section | |
19 | ||
20 | def __str__(self): | |
21 | return 'Unable to find expected configuration section: "%s"' % self.section | |
22 | ||
23 | ||
24 | class ConfigurationKeyError(Exception): | |
25 | ||
26 | def __init__(self, section, key): | |
27 | self.section = section | |
28 | self.key = key | |
29 | ||
30 | def __str__(self): | |
31 | return 'Unable to find expected configuration key: "%s" from section "%s"' % ( | |
32 | self.key, | |
33 | self.section | |
34 | ) | |
35 | ||
36 | ||
37 | class SuffixParsingError(Exception): | |
38 | ||
39 | def __init__(self, suffix, part=None): | |
40 | self.suffix = suffix | |
41 | self.part = part | |
42 | ||
43 | def __str__(self): | |
44 | return 'Unable to parse the %s from systemd suffix: %s' % (self.part, self.suffix) | |
45 | ||
46 | ||
47 | class SuperUserError(Exception): | |
48 | ||
49 | def __str__(self): | |
50 | return 'This command needs to be executed with sudo or as root' | |
51 | ||
52 | ||
1adf2230 AA |
53 | class SizeAllocationError(Exception): |
54 | ||
55 | def __init__(self, requested, available): | |
56 | self.requested = requested | |
57 | self.available = available | |
58 | ||
59 | def __str__(self): | |
60 | msg = 'Unable to allocate size (%s), not enough free space (%s)' % ( | |
61 | self.requested, self.available | |
62 | ) | |
63 | return msg |