Commit 9f458787 authored by Mark Sapiro's avatar Mark Sapiro

Merge branch 'fix_736' into 'master'

Fix mailman conf to use entire config to find sections, not just schema.

Closes #736

See merge request !666
parents 6adae1b2 5eb39451
Pipeline #160821935 passed with stage
in 16 minutes and 26 seconds
......@@ -86,7 +86,7 @@ def conf(ctx, output, section, key):
ctx.fail('No such section: {}'.format(section))
# Case 3: Section is not given, key is given.
elif section is None and key is not None:
for current_section in sorted(config.schema._section_schemas):
for current_section in sorted([section.name for section in config]):
# We have to ensure that the current section actually exists
# and that it contains the given key.
if (_section_exists(current_section) and
......@@ -97,7 +97,7 @@ def conf(ctx, output, section, key):
# Case 4: Neither section nor key are given, just display all the
# sections and their corresponding key/value pairs.
elif section is None and key is None:
for current_section in sorted(config.schema._section_schemas):
for current_section in sorted([section.name for section in config]):
# However, we have to make sure that the current sections and
# key which are being looked up actually exist before trying
# to print them.
......
......@@ -54,6 +54,21 @@ key, along with the names of the corresponding sections.
[logging.smtp] path: smtp.log
[logging.subscribe] path: mailman.log
[logging.vette] path: mailman.log
[runner.archive] path: $QUEUE_DIR/$name
[runner.bad] path: $QUEUE_DIR/$name
[runner.bounces] path: $QUEUE_DIR/$name
[runner.command] path: $QUEUE_DIR/$name
[runner.digest] path: $QUEUE_DIR/$name
[runner.in] path: $QUEUE_DIR/$name
[runner.lmtp] path:
[runner.nntp] path: $QUEUE_DIR/$name
[runner.out] path: $QUEUE_DIR/$name
[runner.pipeline] path: $QUEUE_DIR/$name
[runner.rest] path:
[runner.retry] path: $QUEUE_DIR/$name
[runner.shunt] path: $QUEUE_DIR/$name
[runner.virgin] path: $QUEUE_DIR/$name
If you specify both a section and a key, you will get the corresponding value.
......
......@@ -21,6 +21,7 @@ import unittest
from click.testing import CliRunner
from mailman.commands.cli_conf import conf
from mailman.config import config
from mailman.testing.layers import ConfigLayer
from tempfile import NamedTemporaryFile
......@@ -62,6 +63,15 @@ class TestConf(unittest.TestCase):
'Try \'conf --help\' for help.\n\n'
'Error: Section mailman: No such key: thiskeydoesnotexist\n')
def test_pushed_section_is_found(self):
config.push('test config', """\
[archiver.other]
enable: yes
""")
result = self._command.invoke(conf, ('-k', 'enable'))
self.assertIn('[archiver.other] enable: yes', result.output)
config.pop('test config')
def test_output_to_explicit_stdout(self):
result = self._command.invoke(
conf, ('-o', '-', '-s', 'shell', '-k', 'use_ipython'))
......
......@@ -32,6 +32,9 @@ Command line
subcommands have been added. These provide more options and controls than
the corresponding ``mailman members`` modes which are now deprecated.
(Closes #686)
* The ``mailman conf`` command without a ``-s/--section`` argument will now
show sections defined only in mailman.cfg in addition to those from
schema.cfg. (Closes #736)
REST
----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment