Changes in the Mailman role
This commit is contained in:
parent
6120671a89
commit
c21cb22894
3 changed files with 26 additions and 10 deletions
|
@ -34,7 +34,14 @@ class Importer(object):
|
||||||
self.existing_lists = [ l.strip() for l in
|
self.existing_lists = [ l.strip() for l in
|
||||||
cmdget(["sudo", "-u", "mailman",
|
cmdget(["sudo", "-u", "mailman",
|
||||||
MAILMAN_BIN, "lists", "-q"]).split("\n") ]
|
MAILMAN_BIN, "lists", "-q"]).split("\n") ]
|
||||||
self.excluded = opts.exclude.strip().split(",")
|
if opts.exclude:
|
||||||
|
self.excluded = opts.exclude.strip().split(",")
|
||||||
|
else:
|
||||||
|
self.excluded = []
|
||||||
|
if opts.include:
|
||||||
|
self.included = opts.include.strip().split(",")
|
||||||
|
else:
|
||||||
|
self.included = []
|
||||||
|
|
||||||
def _get_index_path(self):
|
def _get_index_path(self):
|
||||||
return None
|
return None
|
||||||
|
@ -49,10 +56,15 @@ class Importer(object):
|
||||||
if not d.startswith(".") ]
|
if not d.startswith(".") ]
|
||||||
all_listnames.sort()
|
all_listnames.sort()
|
||||||
for index, listname in enumerate(all_listnames):
|
for index, listname in enumerate(all_listnames):
|
||||||
listaddr = "%s@%s" % (listname, self.config["domain"])
|
listaddr = "%s@%s" % (listname, self.opts.domain.strip())
|
||||||
if listname in self.excluded or listaddr in self.excluded:
|
if listname in self.excluded or listaddr in self.excluded:
|
||||||
print("Skipping excluded list %s" % listaddr)
|
print("Skipping excluded list %s" % listaddr)
|
||||||
continue
|
continue
|
||||||
|
if self.included and (
|
||||||
|
listname not in self.included and
|
||||||
|
listaddr not in self.included):
|
||||||
|
print("Skipping not included list %s" % listaddr)
|
||||||
|
continue
|
||||||
print(listaddr, "(%d/%d)" % (index+1, len(all_listnames)))
|
print(listaddr, "(%d/%d)" % (index+1, len(all_listnames)))
|
||||||
confpickle = os.path.join(mm2libdir, 'lists', listname,
|
confpickle = os.path.join(mm2libdir, 'lists', listname,
|
||||||
'config.pck')
|
'config.pck')
|
||||||
|
@ -97,11 +109,20 @@ def main():
|
||||||
help="Don't import the archives, only import the list config")
|
help="Don't import the archives, only import the list config")
|
||||||
parser.add_option("-c", "--config", default="/etc/mailman-migration.conf",
|
parser.add_option("-c", "--config", default="/etc/mailman-migration.conf",
|
||||||
help="Configuration file (default: %defaults)")
|
help="Configuration file (default: %defaults)")
|
||||||
|
parser.add_option("-d", "--domain",
|
||||||
|
help="Domain for the mailing-lists")
|
||||||
parser.add_option("-x", "--exclude", default="",
|
parser.add_option("-x", "--exclude", default="",
|
||||||
help="Comma-separated list of lists to exclude")
|
help="Comma-separated list of lists to exclude")
|
||||||
|
parser.add_option("-i", "--include", default="",
|
||||||
|
help="Comma-separated list of lists to include, no other "
|
||||||
|
"list will be imported")
|
||||||
opts, args = parser.parse_args()
|
opts, args = parser.parse_args()
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
parser.error("Only one arg: the Mailman 2.1 lib dir to import")
|
parser.error("Only one arg: the Mailman 2.1 lib dir to import")
|
||||||
|
if opts.include and opts.exclude:
|
||||||
|
parser.error("Only one of 'include' or 'exclude' may be used")
|
||||||
|
if not opts.domain:
|
||||||
|
parser.error("You must provide a domain name for the lists (--domain)")
|
||||||
|
|
||||||
mm2libdir = args[0]
|
mm2libdir = args[0]
|
||||||
if not os.path.exists(mm2libdir):
|
if not os.path.exists(mm2libdir):
|
||||||
|
|
|
@ -15,11 +15,6 @@
|
||||||
# better if it is not.
|
# better if it is not.
|
||||||
base_url: http://localhost/archives/
|
base_url: http://localhost/archives/
|
||||||
|
|
||||||
# This is the public URL of your HyperKitty installation. This value will
|
|
||||||
# appear as a link at the bottom of emails sent to the list, so it must be
|
|
||||||
# publicly accessible.
|
|
||||||
public_url: http://{{ mailman_url }}/archives/
|
|
||||||
|
|
||||||
# Shared API key, must be the identical to the value in HyperKitty's
|
# Shared API key, must be the identical to the value in HyperKitty's
|
||||||
# settings.
|
# settings.
|
||||||
api_key: SecretArchiverAPIKey
|
api_key: SecretArchiverAPIKey
|
|
@ -319,9 +319,9 @@
|
||||||
# Plug HyperKitty into Mailman
|
# Plug HyperKitty into Mailman
|
||||||
#
|
#
|
||||||
- name: copy the mailman-hyperkitty conffile
|
- name: copy the mailman-hyperkitty conffile
|
||||||
template: src=mailman-hyperkitty.cfg.j2
|
copy: src=mailman-hyperkitty.cfg
|
||||||
dest="{{ mailman_webui_confdir }}/mailman-hyperkitty.cfg"
|
dest="{{ mailman_webui_confdir }}/mailman-hyperkitty.cfg"
|
||||||
owner=root group=mailman mode=0640
|
owner=root group=mailman mode=0640
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
- mailman
|
- mailman
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue