summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/commands/docs/inject.rst2
-rw-r--r--src/mailman/core/runner.py13
-rw-r--r--src/mailman/core/switchboard.py16
-rw-r--r--src/mailman/docs/NEWS.rst5
-rw-r--r--src/mailman/interfaces/runner.py6
-rw-r--r--src/mailman/rest/tests/test_root.py12
-rw-r--r--src/mailman/runners/lmtp.py8
-rw-r--r--src/mailman/runners/rest.py2
-rw-r--r--src/mailman/runners/tests/test_lmtp.py15
9 files changed, 42 insertions, 37 deletions
diff --git a/src/mailman/commands/docs/inject.rst b/src/mailman/commands/docs/inject.rst
index e8987128c..5d07e0458 100644
--- a/src/mailman/commands/docs/inject.rst
+++ b/src/mailman/commands/docs/inject.rst
@@ -34,11 +34,9 @@ It's easy to find out which queues are available.
command
digest
in
- lmtp
nntp
out
pipeline
- rest
retry
shunt
virgin
diff --git a/src/mailman/core/runner.py b/src/mailman/core/runner.py
index 7cfa38b5c..a8412195d 100644
--- a/src/mailman/core/runner.py
+++ b/src/mailman/core/runner.py
@@ -52,7 +52,7 @@ elog = logging.getLogger('mailman.error')
@implementer(IRunner)
class Runner:
intercept_signals = True
- is_non_queue_runner = False
+ is_queue_runner = True
def __init__(self, name, slice=None):
"""Create a runner.
@@ -68,14 +68,15 @@ class Runner:
substitutions = config.paths
substitutions['name'] = name
numslices = int(section.instances)
- # Check whether the runner is queue runner or not; non queue runner should not have queue_directory or switchboard instance.
- if self.is_non_queue_runner:
- self.queue_directory = None
- self.switchboard= None
- else:
+ # Check whether the runner is queue runner or not; non-queue runner
+ # should not have queue_directory or switchboard instance.
+ if self.is_queue_runner:
self.queue_directory = expand(section.path, substitutions)
self.switchboard = Switchboard(
name, self.queue_directory, slice, numslices, True)
+ else:
+ self.queue_directory = None
+ self.switchboard= None
self.sleep_time = as_timedelta(section.sleep_time)
# sleep_time is a timedelta; turn it into a float for time.sleep().
self.sleep_float = (86400 * self.sleep_time.days +
diff --git a/src/mailman/core/switchboard.py b/src/mailman/core/switchboard.py
index 6e603f3c9..ec0231ed7 100644
--- a/src/mailman/core/switchboard.py
+++ b/src/mailman/core/switchboard.py
@@ -90,10 +90,9 @@ class Switchboard:
'Not a power of 2: {0}'.format(numslices))
self.name = name
self.queue_directory = queue_directory
- self.non_queue_runner={'lmtp','rest'}
# If configured to, create the directory if it doesn't yet exist.
if config.create_paths:
- makedirs(self.queue_directory,0770)
+ makedirs(self.queue_directory, 0770)
# Fast track for no slices
self._lower = None
self._upper = None
@@ -144,11 +143,11 @@ class Switchboard:
data['_parsemsg'] = (protocol == 0)
# Write to the pickle file the message object and metadata.
with open(tmpfile, 'w') as fp:
- fp.write(msgsave)
- cPickle.dump(data, fp, protocol)
- fp.flush()
- os.fsync(fp.fileno())
- os.rename(tmpfile, filename)
+ fp.write(msgsave)
+ cPickle.dump(data, fp, protocol)
+ fp.flush()
+ os.fsync(fp.fileno())
+ os.rename(tmpfile, filename)
return filebase
def dequeue(self, filebase):
@@ -267,7 +266,8 @@ def handle_ConfigurationUpdatedEvent(event):
name = conf.name.split('.')[-1]
assert name not in config.switchboards, (
'Duplicate runner name: {0}'.format(name))
- # Path is empty for non queue runners. hence check for path and create switchboard instance only for queue runner.
+ # Path is empty for non-queue runners. Check for path and create
+ # switchboard instances only for queue runners.
if conf.path:
substitutions = config.paths
substitutions['name'] = name
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst
index b2e643fe7..fcf9a26c0 100644
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -12,6 +12,11 @@ Here is a history of user visible changes to Mailman.
===============================
(2013-XX-XX)
+Bugs
+----
+ * Non-queue runners should not create ``var/queue`` subdirectories. Fixed by
+ Sandesh Kumar Agrawal. (LP: #1095422)
+
3.0 beta 3 -- "Here Again"
==========================
diff --git a/src/mailman/interfaces/runner.py b/src/mailman/interfaces/runner.py
index 39948592d..1dfe7e266 100644
--- a/src/mailman/interfaces/runner.py
+++ b/src/mailman/interfaces/runner.py
@@ -50,9 +50,9 @@ class IRunner(Interface):
def stop():
"""Stop the runner on the next iteration through the loop."""
-
- is_non_queue_runner = Attribute("""\
- A boolean variable to keep track of whether the runner is a queue runner or not.
+
+ is_queue_runner = Attribute("""\
+ A boolean variable describing whether the runner is a queue runner.
""")
queue_directory = Attribute(
diff --git a/src/mailman/rest/tests/test_root.py b/src/mailman/rest/tests/test_root.py
index 6e08ce1f5..4cf12da30 100644
--- a/src/mailman/rest/tests/test_root.py
+++ b/src/mailman/rest/tests/test_root.py
@@ -21,6 +21,7 @@ from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
+ 'TestSystem',
]
@@ -69,8 +70,9 @@ class TestSystem(unittest.TestCase):
'receive_own_postings': True,
}, method='PUT')
self.assertEqual(cm.exception.code, 405)
-
- def test_rest_queue_directory(self):
- # Rest is a non queue runner, so it should not have a directory in var/queue
- is_directory = os.path.isdir(os.path.join(config.paths['QUEUE_DIR'],'rest'))
- self.assertEqual(is_directory,False)
+
+ def test_queue_directory(self):
+ # The REST runner is not queue runner, so it should not have a
+ # directory in var/queue.
+ queue_directory = os.path.join(config.QUEUE_DIR, 'rest')
+ self.assertFalse(os.path.isdir(queue_directory))
diff --git a/src/mailman/runners/lmtp.py b/src/mailman/runners/lmtp.py
index cd9538829..31d7723f5 100644
--- a/src/mailman/runners/lmtp.py
+++ b/src/mailman/runners/lmtp.py
@@ -49,7 +49,6 @@ import asyncore
from email.utils import parseaddr
from zope.component import getUtility
-from mailman.interfaces.messages import IMessageStore
from mailman.config import config
from mailman.core.runner import Runner
@@ -154,9 +153,9 @@ class LMTPRunner(Runner, smtpd.SMTPServer):
# Only __init__ is called on startup. Asyncore is responsible for later
# connections from the MTA. slice and numslices are ignored and are
# necessary only to satisfy the API.
-
- is_non_queue_runner = True
-
+
+ is_queue_runner = False
+
def __init__(self, slice=None, numslices=1):
localaddr = config.mta.lmtp_host, int(config.mta.lmtp_port)
# Do not call Runner's constructor because there's no QDIR to create
@@ -185,7 +184,6 @@ class LMTPRunner(Runner, smtpd.SMTPServer):
# Do basic post-processing of the message, checking it for defects or
# other missing information.
message_id = msg.get('message-id')
- message_store = getUtility(IMessageStore)
if message_id is None:
return ERR_550_MID
if msg.defects:
diff --git a/src/mailman/runners/rest.py b/src/mailman/runners/rest.py
index e6a851bb7..468d9a95c 100644
--- a/src/mailman/runners/rest.py
+++ b/src/mailman/runners/rest.py
@@ -41,7 +41,7 @@ log = logging.getLogger('mailman.http')
class RESTRunner(Runner):
intercept_signals = False
- is_non_queue_runner = True
+ is_queue_runner = False
def run(self):
log.info('Starting REST server')
diff --git a/src/mailman/runners/tests/test_lmtp.py b/src/mailman/runners/tests/test_lmtp.py
index f58125eb8..a5c2105d9 100644
--- a/src/mailman/runners/tests/test_lmtp.py
+++ b/src/mailman/runners/tests/test_lmtp.py
@@ -25,9 +25,9 @@ __all__ = [
]
+import os
import smtplib
import unittest
-import os
from datetime import datetime
@@ -66,7 +66,7 @@ Subject: This has no Message-ID header
# (e.g., mailbox not found, no access, or command rejected for policy
# reasons)
self.assertEqual(cm.exception.smtp_code, 550)
- self.assertEqual(cm.exception.smtp_error,
+ self.assertEqual(cm.exception.smtp_error,
'No Message-ID header provided')
def test_message_id_hash_is_added(self):
@@ -111,8 +111,9 @@ Message-ID: <ant>
self.assertEqual(len(messages), 1)
self.assertEqual(messages[0].msgdata['received_time'],
datetime(2005, 8, 1, 7, 49, 23))
-
- def test_lmtp_queue_directory(self):
- # Lmtp is a non queue runner, so it should not have a directory in var/queue
- is_directory = os.path.isdir(os.path.join(config.paths['QUEUE_DIR'],'lmtp'))
- self.assertEqual(is_directory,False)
+
+ def test_queue_directory(self):
+ # The LMTP runner is not queue runner, so it should not have a
+ # directory in var/queue.
+ queue_directory = os.path.join(config.QUEUE_DIR, 'lmtp')
+ self.assertFalse(os.path.isdir(queue_directory))