From 5f521471e1e886a27fc8e722729812928f3dd8b2 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 21 Jun 2019 14:08:02 -0400 Subject: [PATCH] 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 --- watcher/conf/placement_client.py | 2 +- watcher/tests/conf/test_list_opts.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/watcher/conf/placement_client.py b/watcher/conf/placement_client.py index 2afb887fc..81d89a6e8 100644 --- a/watcher/conf/placement_client.py +++ b/watcher/conf/placement_client.py @@ -38,4 +38,4 @@ def register_opts(conf): def list_opts(): - return [(placement_group.name, placement_opts)] + return [(placement_group, placement_opts)] diff --git a/watcher/tests/conf/test_list_opts.py b/watcher/tests/conf/test_list_opts.py index f6a63d410..fb478c83e 100755 --- a/watcher/tests/conf/test_list_opts.py +++ b/watcher/tests/conf/test_list_opts.py @@ -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))