- sipb_xen_database -> invirt.database
[invirt/packages/invirt-console.git] / files / usr / bin / sipb-xen-consolefs
index d5187c5..3255b15 100755 (executable)
@@ -12,7 +12,8 @@ import errno   # for error number codes (ENOENT, etc)
 
 from syslog import *
 
-import sipb_xen_database
+from invirt.config import structs as config
+from invirt import database
 
 fuse.fuse_python_api = (0, 2)
 
@@ -85,18 +86,18 @@ class ConsoleFS(Fuse):
                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) + [''])
        
@@ -108,7 +109,7 @@ class ConsoleFS(Fuse):
                        (princ, realm) = user.split('@')
                else:
                        princ = user
-                       realm = "ATHENA.MIT.EDU"
+                       realm = config.authn[0].realm
                
                return princ.replace('.', '/') + '@' + realm
        
@@ -239,7 +240,7 @@ class ConsoleFS(Fuse):
                        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]
 """