summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oslo_policy/sphinxpolicygen.py8
-rw-r--r--oslo_policy/tests/test_sphinxpolicygen.py11
-rw-r--r--releasenotes/notes/fix-passing-exclude-deprecated-param-317745d23022e544.yaml6
3 files changed, 15 insertions, 10 deletions
diff --git a/oslo_policy/sphinxpolicygen.py b/oslo_policy/sphinxpolicygen.py
index 3987d04..8dd3009 100644
--- a/oslo_policy/sphinxpolicygen.py
+++ b/oslo_policy/sphinxpolicygen.py
@@ -85,10 +85,12 @@ def _generate_sample(app, policy_file, base_name, exclude_deprecated):
# in their documented modules. It's not allowed to register a cli arg after
# the args have been parsed once.
conf = cfg.ConfigOpts()
+ arguments = ['--config-file', config_path,
+ '--output-file', out_file]
+ if exclude_deprecated:
+ arguments += ['--exclude-deprecated']
generator.generate_sample(
- args=['--config-file', config_path,
- '--output-file', out_file,
- '--exclude-deprecated', exclude_deprecated],
+ args=arguments,
conf=conf)
diff --git a/oslo_policy/tests/test_sphinxpolicygen.py b/oslo_policy/tests/test_sphinxpolicygen.py
index 4d4fb68..8b2959a 100644
--- a/oslo_policy/tests/test_sphinxpolicygen.py
+++ b/oslo_policy/tests/test_sphinxpolicygen.py
@@ -34,8 +34,7 @@ class SingleSampleGenerationTest(base.BaseTestCase):
sample.assert_called_once_with(args=[
'--config-file', '/opt/nova/nova.conf',
- '--output-file', '/opt/nova/nova.policy.yaml.sample',
- '--exclude-deprecated', False],
+ '--output-file', '/opt/nova/nova.policy.yaml.sample'],
conf=mock.ANY)
@mock.patch('os.path.isdir')
@@ -55,7 +54,7 @@ class SingleSampleGenerationTest(base.BaseTestCase):
sample.assert_called_once_with(args=[
'--config-file', '/opt/nova/nova.conf',
'--output-file', '/opt/nova/sample.policy.yaml',
- '--exclude-deprecated', True],
+ '--exclude-deprecated'],
conf=mock.ANY)
@mock.patch('os.path.isdir')
@@ -78,11 +77,9 @@ class SingleSampleGenerationTest(base.BaseTestCase):
sample.assert_has_calls([
mock.call(args=[
'--config-file', '/opt/nova/nova.conf',
- '--output-file', '/opt/nova/nova.policy.yaml.sample',
- '--exclude-deprecated', False],
+ '--output-file', '/opt/nova/nova.policy.yaml.sample'],
conf=mock.ANY),
mock.call(args=[
'--config-file', '/opt/nova/placement.conf',
- '--output-file', '/opt/nova/placement.policy.yaml.sample',
- '--exclude-deprecated', False],
+ '--output-file', '/opt/nova/placement.policy.yaml.sample'],
conf=mock.ANY)])
diff --git a/releasenotes/notes/fix-passing-exclude-deprecated-param-317745d23022e544.yaml b/releasenotes/notes/fix-passing-exclude-deprecated-param-317745d23022e544.yaml
new file mode 100644
index 0000000..6f44389
--- /dev/null
+++ b/releasenotes/notes/fix-passing-exclude-deprecated-param-317745d23022e544.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ Fixed passing ``--exclude-deprecated`` boolean value to
+ sphinx-build command. Now ``--exclude-deprecated`` is only
+ passed when it is True without bool True/False value.