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')
34 transaction = ctx.current.create_transaction()
37 machines = Machine.select()
40 people.update(expandLocker(m.owner))
41 people.update(expandName(m.administrator))
42 print '%s: %s' % (m.name, ' '.join(people))
43 old_people = set(a.user for a in m.acl)
44 for removed in old_people - people:
45 ma = [x for x in m.acl if x.user == removed][0]
46 ctx.current.delete(ma)
47 for p in people - old_people:
48 ma = MachineAccess(machine_id=m.machine_id, user=p)
52 # Atomically execute our changes
55 # Failed! Rollback all the changes.
56 transaction.rollback()
59 if __name__ == '__main__':
60 connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')