ConfigurationSource base class

Creates and abstract base class for configuration sources
to be implemented off of.

Change-Id: I238930df61749a77b0a0aa4f033375972a159931
Blueprint: oslo-config-drivers
This commit is contained in:
Samuel Pilla 2018-04-06 12:49:52 -05:00 committed by Moises Guimaraes de Medeiros
parent 232172913b
commit c5e57c0aef
1 changed files with 26 additions and 0 deletions

View File

@ -40,3 +40,29 @@ class ConfigurationSourceDriver(object):
:type group_name: str
:returns: an instance of a subclass of ConfigurationSource
"""
@six.add_metaclass(abc.ABCMeta)
class ConfigurationSource(object):
"""A configuration source option for oslo.config.
A configuration source is able to fetch configuration values based on
a (group, option) key from an external source that supports key-value
mapping such as INI files, key-value stores, secret stores, and so on.
"""
@abc.abstractmethod
def get(self, group_name, option_name, opt):
"""Return the value of the option from the group.
:param group_name: Name of the group.
:type group_name: str
:param option_name: Name of the option.
:type option_name: str
:param opt: The option definition.
:type opt: Opt
:returns: A tuple (value, location) where value is the option value
or oslo_config.sources._NoValue if the (group, option) is
not present in the source, and location is a LocationInfo.
"""