Hey OpenStackers!
I'm hoping to add CONFspirator to openstack/requirements as I'm
using it Adjutant:
https://review.opendev.org/#/c/746436/
The library has been in Adjutant for a while but I didn't add it
to openstack/requirements, so I'm trying to remedy that now. I
think it is different enough from oslo.config and I think the
features/differences are ones that are unlikely to ever make sense
in oslo.config without breaking it for people who do use it as it
is, or adding too much complexity.
I wanted to use oslo.config but quickly found that the way I was
currently doing config in Adjutant was heavily dependent on yaml,
and the ability to nest things. I was in a bind because I didn't
have a declarative config system like oslo.config, and the config
for Adjutant was a mess to maintain and understand (even for me,
and I wrote it) with random parts of the code pulling config that
may or may not have been set/declared.
After finding oslo.config was not suitable for my rather weird
needs, I took oslo.config as a starting point and ended up writing
another library specific to my requirements in Adjutant, and
rather than keeping it internal to Adjutant, moved it to an
external library.
CONFspirator was built for a weird and complex edge case, because
I have plugins that need to dynamically load config on startup,
which then has to be lazy_loaded. I also have weird overlay logic
for defaults that can be overridden, and building it into the
library made Adjutant simpler. I also have nested config groups
that need to be named dynamically to allow plugin classes to be
extended without subclasses sharing the same config group name. I
built something specific to my needs, that just so happens to also
be a potentially useful library for people wanting something like
oslo.config but that is targeted towards yaml and toml, and the
ability to nest groups.
The docs are here:
https://confspirator.readthedocs.io/
The code is here:
https://gitlab.com/catalyst-cloud/confspirator
And for those interested in how I use it in Adjutant here are some
places of interest (be warned, it may be a rabbit hole):
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/config
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/feature_set.py
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/core.py
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/api/v1/openstack.py#L35-L44
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/actions/v1/projects.py#L155-L164
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/actions/v1/base.py#L146
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/tasks/v1/base.py#L30
https://opendev.org/openstack/adjutant/src/branch/master/adjutant/tasks/v1/base.py#L293
If there are strong opinions about working to add this to
oslo.config, let's chat, as I'm not against merging this into it
somehow if we find a way that make sense, but while some aspects
where similar, I felt that this was cleaner without being part of
oslo.config because the mindset I was building towards seemed
different and oslo.config didn't need my complexity.
Cheers,
Adrian