Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
5eb39451 by Mark Sapiro at 2020-06-26T21:06:05+00:00
Fix mailman conf to use entire config to find sections, not just schema.

- - - - -
9f458787 by Mark Sapiro at 2020-06-26T21:06:05+00:00
Merge branch 'fix_736' into 'master'

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

Closes #736

See merge request mailman/mailman!666
- - - - -


4 changed files:

- src/mailman/commands/cli_conf.py
- src/mailman/commands/docs/conf.rst
- src/mailman/commands/tests/test_cli_conf.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/commands/cli_conf.py
=====================================
@@ -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.


=====================================
src/mailman/commands/docs/conf.rst
=====================================
@@ -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.
 


=====================================
src/mailman/commands/tests/test_cli_conf.py
=====================================
@@ -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'))


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -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
 ----



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6adae1b2fe287aaaad47b9fd2d73cd123c84c60e...9f45878796f6db2968171375193b5fb5d2a0ff86

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/6adae1b2fe287aaaad47b9fd2d73cd123c84c60e...9f45878796f6db2968171375193b5fb5d2a0ff86
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to