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
1=== modified file 'src/mailman/bin/master.py'
2--- src/mailman/bin/master.py 2015-03-12 16:20:52 +0000
3+++ src/mailman/bin/master.py 2015-04-20 01:29:57 +0000
4@@ -46,66 +46,6 @@
5 SUBPROC_START_WAIT = timedelta(seconds=20)
6
7
8-
9
10-class ScriptOptions(Options):
11- """Options for the master watcher."""
12-
13- usage = _("""\
14-%prog [options]
15-
16-Master subprocess watcher.
17-
18-Start and watch the configured runners and ensure that they stay alive and
19-kicking. Each runner is forked and exec'd in turn, with the master waiting on
20-their process ids. When it detects a child runner has exited, it may restart
21-it.
22-
23-The runners respond to SIGINT, SIGTERM, SIGUSR1 and SIGHUP. SIGINT, SIGTERM
24-and SIGUSR1 all cause a runner to exit cleanly. The master will restart
25-runners that have exited due to a SIGUSR1 or some kind of other exit condition
26-(say because of an uncaught exception). SIGHUP causes the master and the
27-runners to close their log files, and reopen then upon the next printed
28-message.
29-
30-The master also responds to SIGINT, SIGTERM, SIGUSR1 and SIGHUP, which it
31-simply passes on to the runners. Note that the master will close and reopen
32-its own log files on receipt of a SIGHUP. The master also leaves its own
33-process id in the file `data/master.pid` but you normally don't need to use
34-this pid directly.""")
35-
36- def add_options(self):
37- """See `Options`."""
38- self.parser.add_option(
39- '-n', '--no-restart',
40- dest='restartable', default=True, action='store_false',
41- help=_("""\
42-Don't restart the runners when they exit because of an error or a SIGUSR1.
43-Use this only for debugging."""))
44- self.parser.add_option(
45- '-f', '--force',
46- default=False, action='store_true',
47- help=_("""\
48-If the master watcher finds an existing master lock, it will normally exit
49-with an error message. With this option,the master will perform an extra
50-level of checking. If a process matching the host/pid described in the lock
51-file is running, the master will still exit, requiring you to manually clean
52-up the lock. But if no matching process is found, the master will remove the
53-apparently stale lock and make another attempt to claim the master lock."""))
54- self.parser.add_option(
55- '-r', '--runner',
56- dest='runners', action='append', default=[],
57- help=_("""\
58-Override the default set of runners that the master will invoke, which is
59-typically defined in the configuration file. Multiple -r options may be
60-given. The values for -r are passed straight through to bin/runner."""))
61-
62- def sanity_check(self):
63- """See `Options`."""
64- if len(self.arguments) > 0:
65- self.parser.error(_('Too many arguments'))
66-
67-
68-
69
70 class WatcherState(Enum):
71 """Enum for the state of the master process watcher."""
72 # No lock has been acquired by any process.
73@@ -520,7 +460,7 @@
74 def main():
75 """Main process."""
76
77- options = ScriptOptions()
78+ options = Options()
79 options.initialize()
80 # Acquire the master lock, exiting if we can't. We'll let the caller
81 # handle any clean up or lock breaking. No `with` statement here because
82
83=== modified file 'src/mailman/bin/onebounce.py'
84--- src/mailman/bin/onebounce.py 2015-01-05 01:22:39 +0000
85+++ src/mailman/bin/onebounce.py 2015-04-20 01:29:57 +0000
86@@ -28,42 +28,10 @@
87 from mailman.core.i18n import _
88 from mailman.options import Options
89
90-
91-
92
93-class ScriptOptions(Options):
94- """Options for onebounce."""
95-
96- usage = _("""\
97-%prog [options]
98-
99-Test the bounce detection for message files.""")
100-
101- def add_options(self):
102- """See `Options`."""
103- self.parser.add_option(
104- '-a', '--all',
105- default=False, action='store_true',
106- help=_("""\
107-Run the message through all the registered bounce modules. Normally this
108-script stops at the first match."""))
109- self.parser.add_option(
110- '-m', '--module',
111- type='string', help=_("""
112-Run the message through just the named bounce module."""))
113- self.parser.add_option(
114- '-l', '--list',
115- default=False, action='store_true',
116- help=_('List all available bounce modules and exit.'))
117- self.parser.add_option(
118- '-v', '--verbose',
119- default=False, action='store_true',
120- help=_('Increase verbosity.'))
121-
122-
123
124
125 def main():
126 """bin/onebounce"""
127- options = ScriptOptions()
128+ options = Options()
129 options.initialize()
130
131 if options.options.list:
132
133=== modified file 'src/mailman/commands/cli_control.py'
134--- src/mailman/commands/cli_control.py 2015-01-20 19:53:16 +0000
135+++ src/mailman/commands/cli_control.py 2015-04-20 01:29:57 +0000
136@@ -56,7 +56,7 @@
137 default=False, action='store_true',
138 help=_("""\
139 If the master watcher finds an existing master lock, it will
140- normally exit with an error message. With this option,the master
141+ normally exit with an error message. With this option, the master
142 will perform an extra level of checking. If a process matching
143 the host/pid described in the lock file is running, the master
144 will still exit, requiring you to manually clean up the lock. But