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')
35 people.update(expandLocker(m.owner))
36 people.update(expandName(m.administrator))
39 def refreshMachine(m):
40 people = accessList(m)
41 old_people = set(a.user for a in m.acl)
42 for removed in old_people - people:
43 ma = [x for x in m.acl if x.user == removed][0]
44 ctx.current.delete(ma)
45 for p in people - old_people:
46 ma = MachineAccess(machine_id=m.machine_id, user=p)
50 transaction = ctx.current.create_transaction()
53 machines = Machine.select()
58 # Atomically execute our changes
61 # Failed! Rollback all the changes.
62 transaction.rollback()
65 if __name__ == '__main__':
66 connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')