Changeset 093448c for asadb/util


Ignore:
Timestamp:
Apr 29, 2015, 9:41:07 PM (10 years ago)
Author:
ASA Group Database <asa-db@…>
Branches:
master, stable
Children:
798afa8
Parents:
356174b
git-author:
Alex Dehnert <adehnert@…> (04/29/15 21:37:49)
git-committer:
ASA Group Database <asa-db@…> (04/29/15 21:41:07)
Message:

Make listdiff diff the GSC and UA Finboard lists too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/util/mailinglist.py

    rfbdde0b r093448c  
    2828
    2929    def list_members(self, ):
    30         raise NotImplementedError
     30        env = dict(KRB5CCNAME=self.ccache.name)
    3131        res = subprocess.Popen(
    3232            [BLANCHE_PATH, self.name, ],
    3333            stdout=subprocess.PIPE,
    3434            stderr=subprocess.PIPE,
     35            env=env,
    3536        )
    3637        stdout, stderr = res.communicate()
    3738        if res.returncode:
    3839            raise RuntimeError("Failed to list members: %s" % (stderr, ))
    39         members = stdout.strip().split("\n")
     40        members = [self.convert_moira_to_email(m) for m in stdout.strip().split("\n")]
    4041        return members
     42
     43    def convert_moira_to_email(self, email):
     44        typ, colon, val = email.partition(":")
     45        if typ in ('STRING', 'USER', 'LIST'):
     46            email = val + "@mit.edu"
     47        # Leave untouched: KERBEROS (shouldn't exist), untagged strings
     48        assert email.count('@') == 1, "%s has wrong number of @'s" % (email, )
     49        return email
    4150
    4251    def strip_mit(self, email):
Note: See TracChangeset for help on using the changeset viewer.