[openstack-dev] [oslo] Option registration convention?
Zhongyue Luo
zhongyue.nah at intel.com
Thu Jun 13 16:28:15 UTC 2013
On Thu, Jun 13, 2013 at 11:24 PM, Kevin L. Mitchell <
kevin.mitchell at rackspace.com> wrote:
> On Thu, 2013-06-13 at 13:35 +0800, Zhongyue Luo wrote:
> > First method is to change how generate.py works. Rake all modules in
> > project which imports oslo.config.cfg and create a module object of it
> > to inspect the cfg.CONF object inside. We can cache all the options
> > which were already seen and print out newly discovered options. The
> > downside of this solution is that we have to call a private function
> > in ConfigOpts called _all_opt_infos() to look at all options
> > registered.
> >
> https://github.com/openstack/oslo.config/blob/master/oslo/config/cfg.py#L1822
> >
> > We would have to create a public api version of it.
> >
> >
> >
> > The second option is to make it a convention that all options should
> > be declared in global view and also registered in the same module
> > where they were defined. However it would be difficult to write a
> > hacking.py routine to check this and there will be significant amount
> > of code we have to change.
>
> A third option is to create a decorator that sets an attribute on these
> functions that install config options; then, you just look for functions
> with that attribute set and make sure they get called. Then just go
> through all the projects and make sure that decorator is set up on all
> such functions. That should require minimal code changes across the
> OpenStack projects while still giving you what you need to auto-generate
> sample configurations and documentation…
> --
> Kevin L. Mitchell <kevin.mitchell at rackspace.com>
>
>
Kevin, that does sound like a good idea but seems like a lot of effort will
be needed IMO. Periodically checking whether a new option has been added to
a project is already quite a hassle. Resolving each case according to how
they are registered would be another problem. IMHO if we want minimal code
change, I think following the option declaration convention would be the
best solution.
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
--
*Intel SSG/STOD/DCST/CIT*
880 Zixing Road, Zizhu Science Park, Minhang District, 200241, Shanghai,
China
+862161166500
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130614/1307a70c/attachment.html>
More information about the OpenStack-dev
mailing list