From d67761178668b2f2680729a422517a7a91f756b8 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 6 Jul 2017 11:58:08 -0400 Subject: [PATCH] ceph-volume: exceptions: add configuration errors Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/exceptions.py | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/ceph-volume/ceph_volume/exceptions.py b/src/ceph-volume/ceph_volume/exceptions.py index da6fd11efb866..75c6b6c640536 100644 --- a/src/ceph-volume/ceph_volume/exceptions.py +++ b/src/ceph-volume/ceph_volume/exceptions.py @@ -1,3 +1,37 @@ +import os + + +class ConfigurationError(Exception): + + def __init__(self, cluster_name='ceph', path='/etc/ceph', abspath=None): + self.cluster_name = cluster_name + self.path = path + self.abspath = abspath or "%s.conf" % os.path.join(self.path, self.cluster_name) + + def __str__(self): + return 'Unable to load expected Ceph config at: %s' % self.abspath + + +class ConfigurationSectionError(Exception): + + def __init__(self, section): + self.section = section + + def __str__(self): + return 'Unable to find expected configuration section: "%s"' % self.section + + +class ConfigurationKeyError(Exception): + + def __init__(self, section, key): + self.section = section + self.key = key + + def __str__(self): + return 'Unable to find expected configuration key: "%s" from section "%s"' % ( + self.key, + self.section + ) class SuffixParsingError(Exception): -- 2.39.5