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)
32 return getafsgroups.getAfsGroupMembers(name, 'athena.mit.edu')
33 except getafsgroups.AfsProcessError:
38 people.update(expandLocker(m.owner))
39 people.update(expandName(m.administrator))
42 def refreshMachine(m):
43 people = accessList(m)
44 old_people = set(a.user for a in m.acl)
45 for removed in old_people - people:
46 ma = [x for x in m.acl if x.user == removed][0]
47 ctx.current.delete(ma)
48 for p in people - old_people:
49 ma = MachineAccess(machine_id=m.machine_id, user=p)
53 transaction = ctx.current.create_transaction()
56 machines = Machine.select()
61 # Atomically execute our changes
64 # Failed! Rollback all the changes.
65 transaction.rollback()
68 if __name__ == '__main__':
69 connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')