Merge lp:~sumanah/mailman/mailman into lp:mailman

Proposed by Sumana Harihareswara
Status: Merged
Merge reported by: Barry Warsaw
Merged at revision: not available
Proposed branch: lp:~sumanah/mailman/mailman
Merge into: lp:mailman
Diff against target: 140 lines (+3/-95)
3 files modified
src/mailman/bin/master.py (+1/-61)
src/mailman/bin/onebounce.py (+1/-33)
src/mailman/commands/cli_control.py (+1/-1)
To merge this branch: bzr merge lp:~sumanah/mailman/mailman
Reviewer Review Type Date Requested Status
Barry Warsaw Approve
Mark Sapiro Pending
Yasuhito FUTATSUKI at POEM Pending
Review via email: mp+244077@code.launchpad.net

Description of the change

ScriptOptions removal to fix bug #1191796

To post a comment you must log in.
Revision history for this message
Sumana Harihareswara (sumanah) wrote :

Barry mentioned in IRC that he's thinking of making some large refactor-style changes to this area of the code anyway.....

lp:~sumanah/mailman/mailman updated
7275. By Sumana Harihareswara

merged in master

7276. By Sumana Harihareswara

merge from master

7277. By Sumana Harihareswara

fixing comma

7278. By Sumana Harihareswara

merge

Revision history for this message
Barry Warsaw (barry) wrote :

Hi Sumana. I've ported this over to the git repo, done some refactoring and other cleanups. Thanks for the heads start!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/mailman/bin/master.py'
--- src/mailman/bin/master.py 2015-03-12 16:20:52 +0000
+++ src/mailman/bin/master.py 2015-04-20 01:29:57 +0000
@@ -46,66 +46,6 @@
46SUBPROC_START_WAIT = timedelta(seconds=20)46SUBPROC_START_WAIT = timedelta(seconds=20)
4747
4848
49
5049
51class ScriptOptions(Options):
52 """Options for the master watcher."""
53
54 usage = _("""\
55%prog [options]
56
57Master subprocess watcher.
58
59Start and watch the configured runners and ensure that they stay alive and
60kicking. Each runner is forked and exec'd in turn, with the master waiting on
61their process ids. When it detects a child runner has exited, it may restart
62it.
63
64The runners respond to SIGINT, SIGTERM, SIGUSR1 and SIGHUP. SIGINT, SIGTERM
65and SIGUSR1 all cause a runner to exit cleanly. The master will restart
66runners that have exited due to a SIGUSR1 or some kind of other exit condition
67(say because of an uncaught exception). SIGHUP causes the master and the
68runners to close their log files, and reopen then upon the next printed
69message.
70
71The master also responds to SIGINT, SIGTERM, SIGUSR1 and SIGHUP, which it
72simply passes on to the runners. Note that the master will close and reopen
73its own log files on receipt of a SIGHUP. The master also leaves its own
74process id in the file `data/master.pid` but you normally don't need to use
75this pid directly.""")
76
77 def add_options(self):
78 """See `Options`."""
79 self.parser.add_option(
80 '-n', '--no-restart',
81 dest='restartable', default=True, action='store_false',
82 help=_("""\
83Don't restart the runners when they exit because of an error or a SIGUSR1.
84Use this only for debugging."""))
85 self.parser.add_option(
86 '-f', '--force',
87 default=False, action='store_true',
88 help=_("""\
89If the master watcher finds an existing master lock, it will normally exit
90with an error message. With this option,the master will perform an extra
91level of checking. If a process matching the host/pid described in the lock
92file is running, the master will still exit, requiring you to manually clean
93up the lock. But if no matching process is found, the master will remove the
94apparently stale lock and make another attempt to claim the master lock."""))
95 self.parser.add_option(
96 '-r', '--runner',
97 dest='runners', action='append', default=[],
98 help=_("""\
99Override the default set of runners that the master will invoke, which is
100typically defined in the configuration file. Multiple -r options may be
101given. The values for -r are passed straight through to bin/runner."""))
102
103 def sanity_check(self):
104 """See `Options`."""
105 if len(self.arguments) > 0:
106 self.parser.error(_('Too many arguments'))
107
108
109
11050
111class WatcherState(Enum):51class WatcherState(Enum):
112 """Enum for the state of the master process watcher."""52 """Enum for the state of the master process watcher."""
113 # No lock has been acquired by any process.53 # No lock has been acquired by any process.
@@ -520,7 +460,7 @@
520def main():460def main():
521 """Main process."""461 """Main process."""
522462
523 options = ScriptOptions()463 options = Options()
524 options.initialize()464 options.initialize()
525 # Acquire the master lock, exiting if we can't. We'll let the caller465 # Acquire the master lock, exiting if we can't. We'll let the caller
526 # handle any clean up or lock breaking. No `with` statement here because466 # handle any clean up or lock breaking. No `with` statement here because
527467
=== modified file 'src/mailman/bin/onebounce.py'
--- src/mailman/bin/onebounce.py 2015-01-05 01:22:39 +0000
+++ src/mailman/bin/onebounce.py 2015-04-20 01:29:57 +0000
@@ -28,42 +28,10 @@
28from mailman.core.i18n import _28from mailman.core.i18n import _
29from mailman.options import Options29from mailman.options import Options
3030
31
32
3331
34class ScriptOptions(Options):
35 """Options for onebounce."""
36
37 usage = _("""\
38%prog [options]
39
40Test the bounce detection for message files.""")
41
42 def add_options(self):
43 """See `Options`."""
44 self.parser.add_option(
45 '-a', '--all',
46 default=False, action='store_true',
47 help=_("""\
48Run the message through all the registered bounce modules. Normally this
49script stops at the first match."""))
50 self.parser.add_option(
51 '-m', '--module',
52 type='string', help=_("""
53Run the message through just the named bounce module."""))
54 self.parser.add_option(
55 '-l', '--list',
56 default=False, action='store_true',
57 help=_('List all available bounce modules and exit.'))
58 self.parser.add_option(
59 '-v', '--verbose',
60 default=False, action='store_true',
61 help=_('Increase verbosity.'))
62
63
6432
6533
66def main():34def main():
67 """bin/onebounce"""35 """bin/onebounce"""
68 options = ScriptOptions()36 options = Options()
69 options.initialize()37 options.initialize()
7038
71 if options.options.list:39 if options.options.list:
7240
=== modified file 'src/mailman/commands/cli_control.py'
--- src/mailman/commands/cli_control.py 2015-01-20 19:53:16 +0000
+++ src/mailman/commands/cli_control.py 2015-04-20 01:29:57 +0000
@@ -56,7 +56,7 @@
56 default=False, action='store_true',56 default=False, action='store_true',
57 help=_("""\57 help=_("""\
58 If the master watcher finds an existing master lock, it will58 If the master watcher finds an existing master lock, it will
59 normally exit with an error message. With this option,the master59 normally exit with an error message. With this option, the master
60 will perform an extra level of checking. If a process matching60 will perform an extra level of checking. If a process matching
61 the host/pid described in the lock file is running, the master61 the host/pid described in the lock file is running, the master
62 will still exit, requiring you to manually clean up the lock. But62 will still exit, requiring you to manually clean up the lock. But