Mailman: improve the import script
This commit is contained in:
parent
270d9c273d
commit
f41b3c862e
1 changed files with 12 additions and 3 deletions
|
@ -72,6 +72,10 @@ class Importer(object):
|
||||||
print("Missing configuration pickle:", confpickle)
|
print("Missing configuration pickle:", confpickle)
|
||||||
continue
|
continue
|
||||||
list_is_new = bool(listaddr not in self.existing_lists)
|
list_is_new = bool(listaddr not in self.existing_lists)
|
||||||
|
if self.opts.recreate and not list_is_new:
|
||||||
|
call(["sudo", "-u", "mailman", MAILMAN_BIN, "remove",
|
||||||
|
listaddr])
|
||||||
|
list_is_new = True
|
||||||
if list_is_new:
|
if list_is_new:
|
||||||
call(["sudo", "-u", "mailman", MAILMAN_BIN, "create", "-d",
|
call(["sudo", "-u", "mailman", MAILMAN_BIN, "create", "-d",
|
||||||
listaddr])
|
listaddr])
|
||||||
|
@ -95,6 +99,7 @@ class Importer(object):
|
||||||
if self.index_path:
|
if self.index_path:
|
||||||
call(["sudo", "chown", "mailman:apache", "-R", self.index_path])
|
call(["sudo", "chown", "mailman:apache", "-R", self.index_path])
|
||||||
call(["sudo", "chmod", "g+w", self.index_path])
|
call(["sudo", "chmod", "g+w", self.index_path])
|
||||||
|
if not self.opts.no_sync:
|
||||||
call(["sudo", "django-admin", "mailman_sync",
|
call(["sudo", "django-admin", "mailman_sync",
|
||||||
"--pythonpath", self.config["confdir"],
|
"--pythonpath", self.config["confdir"],
|
||||||
"--settings", "settings"])
|
"--settings", "settings"])
|
||||||
|
@ -116,6 +121,10 @@ def main():
|
||||||
parser.add_option("-i", "--include", default="",
|
parser.add_option("-i", "--include", default="",
|
||||||
help="Comma-separated list of lists to include, no other "
|
help="Comma-separated list of lists to include, no other "
|
||||||
"list will be imported")
|
"list will be imported")
|
||||||
|
parser.add_option("-R", "--recreate", action="store_true",
|
||||||
|
help="Recreate the lists and re-import their configuration")
|
||||||
|
parser.add_option("-S", "--no-sync", action="store_true",
|
||||||
|
help="Don't run the mailman_sync admin command")
|
||||||
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")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue