from syslog import *
-import sipb_xen_database
+from invirt.config import structs as config
+from invirt import database
fuse.fuse_python_api = (0, 2)
older than 15 seconds"""
if time() - self.lasttime > 15:
self.lasttime = time()
- sipb_xen_database.clear_cache()
- return [machine.name for machine in sipb_xen_database.Machine.select()]
+ database.clear_cache()
+ return [machine.name for machine in database.Machine.select()]
def getUid(self, machine_name):
"""Calculate the UID of a machine-account, which is just machine_id+1000
"""
- return sipb_xen_database.Machine.get_by(name=machine_name).machine_id + 1000
+ return database.Machine.get_by(name=machine_name).machine_id + 1000
def getK5login(self, machine_name):
"""Build the ACL for a machine and turn it into a .k5login file
"""
- machine = sipb_xen_database.Machine.get_by(name=machine_name)
+ machine = database.Machine.get_by(name=machine_name)
users = [acl.user for acl in machine.acl]
return "\n".join(map(self.userToPrinc, users) + [''])
(princ, realm) = user.split('@')
else:
princ = user
- realm = "ATHENA.MIT.EDU"
+ realm = config.authn[0].realm
return princ.replace('.', '/') + '@' + realm
return os.readlink(self.mirrorPath(path))
if __name__ == '__main__':
- sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
+ database.connect()
usage="""
ConsoleFS [mount_path]
"""