- sipb_xen_database -> invirt.database
authorYang Zhang <y_z@mit.edu>
Sun, 3 Aug 2008 05:01:49 +0000 (01:01 -0400)
committerYang Zhang <y_z@mit.edu>
Sun, 3 Aug 2008 05:01:49 +0000 (01:01 -0400)
- use invirt config

svn path=/trunk/packages/sipb-xen-console/; revision=841

config.todo
files/usr/bin/sipb-xen-consolefs

index d1caef4..4ef0ca3 100644 (file)
@@ -1,5 +1,3 @@
-etc/nss-pgsql.conf
-etc/issue.net.no_tkt
-usr/bin/sipb-xen-consolefs: realm
-usr/bin/sipb-xen-consolefs: database
-etc/lots: could benefit from config-package-dev TRANSFORM for upgradeability
+files/etc/nss-pgsql.conf
+files/etc/issue.net.no_tkt
+files/etc/lots: could benefit from config-package-dev TRANSFORM for upgradeability
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]
 """