summaryrefslogtreecommitdiff
path: root/src/mailman/mta/postfix.py
diff options
context:
space:
mode:
authorJimmy Bergman2012-09-24 08:26:50 +0200
committerJimmy Bergman2012-09-24 08:26:50 +0200
commita3516893922c74b88f71ce62227adf5a683baa00 (patch)
tree838f38fd2a6d571da443a6c0335c17044ff86371 /src/mailman/mta/postfix.py
parent8271738ba287c4688173ff760118996c1590b84f (diff)
parent12b9839a5e7f1e9fda477c5e40ed190e08292da7 (diff)
downloadmailman-a3516893922c74b88f71ce62227adf5a683baa00.tar.gz
mailman-a3516893922c74b88f71ce62227adf5a683baa00.tar.zst
mailman-a3516893922c74b88f71ce62227adf5a683baa00.zip
Diffstat (limited to 'src/mailman/mta/postfix.py')
-rw-r--r--src/mailman/mta/postfix.py60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/mailman/mta/postfix.py b/src/mailman/mta/postfix.py
index 4fc097ffc..c04e38f02 100644
--- a/src/mailman/mta/postfix.py
+++ b/src/mailman/mta/postfix.py
@@ -64,7 +64,6 @@ class LMTP:
# We can ignore the mlist argument because for LMTP delivery, we just
# generate the entire file every time.
self.regenerate()
- self.regenerate_domain()
delete = create
@@ -108,46 +107,6 @@ class LMTP:
log.error(msg, command, status, errstr)
raise RuntimeError(msg % (command, status, errstr))
- def regenerate_domain(self, output=None):
- """The map for all list domains
-
- The format for Postfix's LMTP transport map is defined here:
- http://www.postfix.org/transport.5.html
- """
- # Acquire a lock file to prevent other processes from racing us here.
- lock_file = os.path.join(config.LOCK_DIR, 'mta')
- with Lock(lock_file):
- # If output is a filename, open up a backing file and write the
- # output there, then do the atomic rename dance. First though, if
- # it's None, we use a calculated path.
- if output is None:
- path = os.path.join(config.DATA_DIR, 'postfix_domains')
- path_new = path + '.new'
- elif isinstance(output, basestring):
- path = output
- path_new = output + '.new'
- else:
- path = path_new = None
- if path_new is None:
- self._do_write_file_domains(output)
- # There's nothing to rename, and we can't generate the .db
- # file, so we're done.
- return
- # Write the file.
- with open(path_new, 'w') as fp:
- self._do_write_file_domains(fp)
- # Atomically rename to the intended path.
- os.rename(path + '.new', path)
- # Now that the new file is in place, we must tell Postfix to
- # generate a new .db file.
- command = config.mta.postfix_map_cmd + ' ' + path
- status = (os.system(command) >> 8) & 0xff
- if status:
- msg = 'command failure: %s, %s, %s'
- errstr = os.strerror(status)
- log.error(msg, command, status, errstr)
- raise RuntimeError(msg % (command, status, errstr))
-
def _do_write_file(self, fp):
"""Do the actual file writes for list creation."""
# Sort all existing mailing list names first by domain, then by local
@@ -178,22 +137,3 @@ class LMTP:
for alias in aliases:
print(ALIASTMPL.format(alias, config, width), file=fp)
print(file=fp)
-
- def _do_write_file_domains(self, fp):
- """Do the actual file writes of the domain map for list creation."""
- # Sort all existing mailing list names first by domain, then my local
- # part. For postfix we need a dummy entry for the domain.
- by_domain = []
- for list_name, mail_host in getUtility(IListManager).name_components:
- by_domain.append(mail_host)
- print("""\
-# AUTOMATICALLY GENERATED BY MAILMAN ON {0}
-#
-# This file is generated by Mailman, and is kept in sync with the binary hash
-# file. YOU SHOULD NOT MANUALLY EDIT THIS FILE unless you know what you're
-# doing, and can keep the two files properly in sync. If you screw it up,
-# you're on your own.
-""".format(now().replace(microsecond=0)), file=fp)
- for domain in sorted(by_domain):
- print("""{0} {0}""".format(domain), file=fp)
-