Fix placement_client group help docs generation

To get the placement_client OptGroup help text to generate
in the docs, we have to use the OptGroup object in the
list_opts() method rather than a string for the group name.

https://docs.openstack.org/oslo.config/latest/cli/generator.html#defining-option-discovery-entry-points

Change-Id: Ie728081caa205ded2435c6b95f5e8d4bbd23372c
This commit is contained in:
Matt Riedemann
2019-06-21 14:08:02 -04:00
parent d98f51c452
commit 5f521471e1
2 changed files with 10 additions and 3 deletions

View File

@@ -38,4 +38,4 @@ def register_opts(conf):
def list_opts():
return [(placement_group.name, placement_opts)]
return [(placement_group, placement_opts)]

View File

@@ -16,6 +16,7 @@
# limitations under the License.
import mock
from oslo_config import cfg
from stevedore import extension
from watcher.conf import opts
@@ -74,7 +75,10 @@ class TestListOpts(base.TestCase):
result = opts.list_opts()
self.assertIsNotNone(result)
for section_name, options in result:
for name_or_group, options in result:
section_name = name_or_group
if isinstance(name_or_group, cfg.OptGroup):
section_name = name_or_group.name
self.assertIn(section_name, expected_sections)
self.assertTrue(len(options))
@@ -106,7 +110,10 @@ class TestListOpts(base.TestCase):
result = opts.list_opts()
self.assertIsNotNone(result)
for section_name, options in result:
for name_or_group, options in result:
section_name = name_or_group
if isinstance(name_or_group, cfg.OptGroup):
section_name = name_or_group.name
self.assertIn(section_name, expected_sections)
self.assertTrue(len(options))