return m
def recache(self):
- """Refresh the local cache of VMs if the cache is more than 15 minutes old
- """
if time() - self.lasttime > 5:
self.lasttime = time()
database.clear_cache()
self.machines = dict((machine.name, machine) for machine in database.session.query(database.Machine).all())
def getMachines(self, **kw):
- """Get the list of VMs in the database"""
self.recache()
return self.machines.keys()
return -errno.EINVAL
def getK5login(self, machine, **kw):
- """Build the ACL for a machine and turn it into a .k5login file
- """
self.recache()
machine = self.machines[machine]
users = [acl.user for acl in machine.acl]