From 525ac47bb934621057904725376108f56f6c57fe Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 26 Dec 2012 22:50:35 -0500 Subject: Support lookup of value using "group.key" Let us check if the opt_name has a '.', if it does then split it into a group/key and try lookup using that combination. Since LazyPluggable uses "CONF[self.__pivot]" if we just add this capability to cfg, we get "LazyPluggable doesn't support option groups" for free. Fixes LP #1093043 Change-Id: I9cedcf22014038e9fe4ed5e66ca5427aa99b5091 --- openstack/common/cfg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'openstack/common') diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py index 8f25c5c..333a34b 100644 --- a/openstack/common/cfg.py +++ b/openstack/common/cfg.py @@ -1567,7 +1567,11 @@ class ConfigOpts(collections.Mapping): opts = group._opts if not opt_name in opts: - raise NoSuchOptError(opt_name, group) + if group is None and '.' in opt_name: + group, opt_name = opt_name.split('.') + return self._get_opt_info(opt_name, group) + else: + raise NoSuchOptError(opt_name, group) return opts[opt_name] -- cgit