From 232172913b5e0ea6569eb19b6f674d54d8daaa5b Mon Sep 17 00:00:00 2001 From: Raildo Mascena Date: Tue, 10 Apr 2018 10:32:22 -0300 Subject: [PATCH] Base class for a configuration driver Create a base class to support a configuration driver for Oslo.config Change-Id: Idec1456c00dedb8c3628cbc4a934b870cd8dc7fc Patially-Implements: blueprint oslo-config-db --- oslo_config/sources/__init__.py | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 oslo_config/sources/__init__.py diff --git a/oslo_config/sources/__init__.py b/oslo_config/sources/__init__.py new file mode 100644 index 00000000..0fe4454e --- /dev/null +++ b/oslo_config/sources/__init__.py @@ -0,0 +1,42 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +import abc +import six + + +@six.add_metaclass(abc.ABCMeta) +class ConfigurationSourceDriver(object): + """A config driver option for Oslo.config. + + Represents an oslo.config driver to allow store configuration data in + other places, such as secret stores managed by a proper key management + store solution. + + """ + + @abc.abstractmethod + def open_source_from_opt_group(self, conf, group_name): + """Return an open option source. + + Use group_name to find the configuration settings for the new + source then open the source and return it. + + If a source cannot be open, raise an appropriate exception. + + :param conf: The active configuration option handler from which + to seek configuration values. + :type conf: ConfigOpts + :param group_name: The configuration option group name where the + options for the source are stored. + :type group_name: str + :returns: an instance of a subclass of ConfigurationSource + """