2 from sipb_xen_database import *
7 def expandLocker(name):
8 groups = getafsgroups.getLockerAcl(name)
9 cell = getafsgroups.getCell(name)
13 ans.update(getafsgroups.getAfsGroupMembers(group, cell))
19 p = subprocess.Popen(['vos', 'examine', 'user.'+name],
20 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
31 return getafsgroups.getAfsGroupMembers(name, 'athena.mit.edu')
33 if __name__ == '__main__':
34 connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')
36 transaction = ctx.current.create_transaction()
39 machines = Machine.select()
42 people.update(expandLocker(m.owner))
43 people.update(expandName(m.administrator))
44 print '%s: %s' % (m.name, ' '.join(people))
45 old_people = set(a.user for a in m.acl)
46 for removed in old_people - people:
47 ma = [x for x in m.acl if x.user == removed][0]
48 ctx.current.delete(ma)
49 for p in people - old_people:
50 ma = MachineAccess(machine_id=m.machine_id, user=p)
54 # Atomically execute our changes
57 # Failed! Rollback all the changes.
58 transaction.rollback()