From: Alfredo Deza Date: Wed, 19 Sep 2018 16:04:17 +0000 (-0400) Subject: ceph-volume configuration be able to set conf.ceph X-Git-Tag: v14.0.1~184^2~9 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4f8226f359d94a86a39492ed653d9a9e5d8dd8f9;p=ceph.git ceph-volume configuration be able to set conf.ceph Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/configuration.py b/src/ceph-volume/ceph_volume/configuration.py index 2b9cd9fdc7f13..6379ef67a7d82 100644 --- a/src/ceph-volume/ceph_volume/configuration.py +++ b/src/ceph-volume/ceph_volume/configuration.py @@ -6,7 +6,7 @@ import contextlib import logging import os import re -from ceph_volume import terminal +from ceph_volume import terminal, conf from ceph_volume import exceptions @@ -31,7 +31,16 @@ class _TrimIndentFile(object): return iter(self.readline, '') +def load_ceph_conf_path(cluster_name='ceph'): + abspath = '/etc/ceph/%s.conf' % cluster_name + conf.path = os.getenv('CEPH_CONF', abspath) + conf.cluster = cluster_name + + def load(abspath=None): + if abspath is None: + abspath = conf.path + if not os.path.exists(abspath): raise exceptions.ConfigurationError(abspath=abspath) @@ -42,6 +51,7 @@ def load(abspath=None): trimmed_conf = _TrimIndentFile(ceph_file) with contextlib.closing(ceph_file): parser.readfp(trimmed_conf) + conf.ceph = parser return parser except configparser.ParsingError as error: logger.exception('Unable to parse INI-style file: %s' % abspath)