summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Pena <jpena@redhat.com>2016-01-26 12:22:28 +0100
committerJavier Pena <jpena@redhat.com>2016-01-26 12:26:01 +0100
commit2698e165bd4c0eeb6cb3a28c1d5d44bce75551b7 (patch)
treeb2b959604117800e04d4e6ba49c160df58036563
parent64348c58225c50e7f1b8d6a2d6fed54602826c16 (diff)
downloadoslo-config-2698e165bd4c0eeb6cb3a28c1d5d44bce75551b7.tar.gz
Do not fail on certain config option help strings3.4.0
Commit 016198b8d78870510f00a2f62b7df4c14e730632 added code to parse the help text for config files, searching for default values. This could get confused when the help text included %(project_id)s or similar strings, as seen for example in https://github.com/openstack/glance_store/blob/master/glance_store/_drivers/cinder.py#L44-L46 Fixing this by ignoring key errors, in case such strings are present. Change-Id: Ia920afa30143789a3f4bbf6386fb181009fc66d6
-rw-r--r--oslo_config/sphinxext.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/oslo_config/sphinxext.py b/oslo_config/sphinxext.py
index 68ceb47..fd4ef41 100644
--- a/oslo_config/sphinxext.py
+++ b/oslo_config/sphinxext.py
@@ -138,8 +138,9 @@ class ShowOptionsDirective(rst.Directive):
try:
help_text = opt.help % {'default': 'the value above'}
- except TypeError:
- # There is no mention of the default in the help string.
+ except (TypeError, KeyError):
+ # There is no mention of the default in the help string,
+ # or the string had some unknown key
help_text = opt.help
_add_indented(help_text)
_add('')