]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: make is_valid() optional 46730/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 9 Jun 2022 08:33:31 +0000 (10:33 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 23 Jun 2022 07:04:07 +0000 (09:04 +0200)
There are cases where `ceph-volume` doesn't have to require
a `ceph.conf` file that has the `fsid` parameter.

See: https://github.com/rook/rook/pull/10333#pullrequestreview-994958873

Fixes: https://tracker.ceph.com/issues/55970
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 7ffea899921dc9996f20ef88531bd1daf82d44aa)

src/ceph-volume/ceph_volume/configuration.py
src/ceph-volume/ceph_volume/util/encryption.py

index 2fee47ffab910ad4c4310bbc6581c5c769a0bd9f..e0f7ef1f0c6551e89385643cf77ec51e3d1f02b2 100644 (file)
@@ -86,13 +86,14 @@ class Conf(conf_parentclass):
         s = '_'.join(s.split())
         return s
 
-    def get_safe(self, section, key, default=None):
+    def get_safe(self, section, key, default=None, check_valid=True):
         """
         Attempt to get a configuration value from a certain section
         in a ``cfg`` object but returning None if not found. Avoids the need
         to be doing try/except {ConfigParser Exceptions} every time.
         """
-        self.is_valid()
+        if check_valid:
+            self.is_valid()
         try:
             return self.get(section, key)
         except (configparser.NoSectionError, configparser.NoOptionError):
index 2a2c03337b61f0db47d34c6349435f11f6c16f0b..0639ab14a2cdfbd3eafef8b2d0a0125566049b70 100644 (file)
@@ -18,7 +18,7 @@ def get_key_size_from_conf():
     key_size = conf.ceph.get_safe(
         'osd',
         'osd_dmcrypt_key_size',
-        default='512')
+        default='512', check_valid=False)
 
     if key_size not in ['256', '512']:
         logger.warning(("Invalid value set for osd_dmcrypt_key_size ({}). "