From 188978aad60d86804d57f857c7c1db40de81fa8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Fri, 21 Mar 2014 22:14:10 +0000 Subject: [PATCH] Mailman: fix pg_hba perms and improve import script --- playbooks/hosts/lists-dev.cloud.fedoraproject.org.yml | 1 + roles/mailman/files/import-mm2.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/playbooks/hosts/lists-dev.cloud.fedoraproject.org.yml b/playbooks/hosts/lists-dev.cloud.fedoraproject.org.yml index ab463ee833..ade4387040 100644 --- a/playbooks/hosts/lists-dev.cloud.fedoraproject.org.yml +++ b/playbooks/hosts/lists-dev.cloud.fedoraproject.org.yml @@ -63,6 +63,7 @@ creates=/var/lib/pgsql/data/postgresql.conf - name: copy pg_hba.conf copy: src="{{ files }}/lists-dev/pg_hba.conf" dest=/var/lib/pgsql/data/pg_hba.conf + owner=postgres group=postgres notify: - restart postgresql - name: start postgresql diff --git a/roles/mailman/files/import-mm2.py b/roles/mailman/files/import-mm2.py index 2afa10c5fa..15a01fa368 100755 --- a/roles/mailman/files/import-mm2.py +++ b/roles/mailman/files/import-mm2.py @@ -23,10 +23,11 @@ class Importer(object): def __init__(self, opts, config): self.opts = opts self.config = config + self.index_path = self._get_index_path() self.existing_lists = [ l.strip() for l in cmdget(["sudo", "-u", "mailman", "mailman3", "lists", "-q"]).split("\n") ] - self.index_path = self._get_index_path() + self.excluded = opts.exclude.strip().split(",") def _get_index_path(self): sys.path.append(self.config["confdir"]) @@ -41,6 +42,9 @@ class Importer(object): all_listnames.sort() for index, listname in enumerate(all_listnames): listaddr = "%s@%s" % (listname, self.config["domain"]) + if listname in self.excluded or listaddr in self.excluded: + print "Skipping excluded list %s" % listaddr + continue print listaddr, "(%d/%d)" % (index+1, len(all_listnames)) confpickle = os.path.join(mm2libdir, 'lists', listname, 'config.pck') @@ -84,6 +88,8 @@ def main(): help="Don't import the archives, only import the list config") parser.add_option("-c", "--config", default="/etc/mailman-migration.conf", help="Configuration file (default: %defaults)") + parser.add_option("-x", "--exclude", default="", + help="Comma-separated list of lists to exclude") opts, args = parser.parse_args() if len(args) != 1: parser.error("Only one arg: the Mailman 2.1 lib dir to import")