2 from invirt.database import *
3 from invirt.config import structs as config
8 def expandLocker(name):
10 groups = getafsgroups.getLockerAcl(name)
11 except getafsgroups.AfsProcessError, e:
12 if e.message.startswith("fs: You don't have the required access rights on"):
15 cell = getafsgroups.getCell(name)
19 ans.update(getafsgroups.getAfsGroupMembers(group, cell))
25 p = subprocess.Popen(['vos', 'examine', 'user.'+name],
26 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
38 return getafsgroups.getAfsGroupMembers(name, config.authz[0].cell)
39 except getafsgroups.AfsProcessError:
44 people.update(expandLocker(m.owner))
45 if m.administrator is not None:
46 people.update(expandName(m.administrator))
49 def refreshMachine(m):
50 people = accessList(m)
51 old_people = set(a.user for a in m.acl)
52 for removed in old_people - people:
53 ma = [x for x in m.acl if x.user == removed][0]
55 for p in people - old_people:
56 ma = MachineAccess(user=p)
58 session.save_or_update(ma)
64 machines = Machine.query().all()
69 # Atomically execute our changes
72 # Failed! Rollback all the changes.
76 if __name__ == '__main__':