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 people.update(expandName(m.administrator))
48 def refreshMachine(m):
49 people = accessList(m)
50 old_people = set(a.user for a in m.acl)
51 for removed in old_people - people:
52 ma = [x for x in m.acl if x.user == removed][0]
54 for p in people - old_people:
55 ma = MachineAccess(user=p)
57 session.save_or_update(ma)
63 machines = Machine.query().all()
68 # Atomically execute our changes
71 # Failed! Rollback all the changes.
75 if __name__ == '__main__':