From 9a0aeb504b9fbc4a41e13900335390e00ddb5aa1 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Sun, 3 Aug 2008 01:01:49 -0400 Subject: [PATCH] - sipb_xen_database -> invirt.database - use invirt config svn path=/trunk/packages/sipb-xen-console/; revision=841 --- config.todo | 8 +++----- files/usr/bin/sipb-xen-consolefs | 15 ++++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/config.todo b/config.todo index d1caef4..4ef0ca3 100644 --- a/config.todo +++ b/config.todo @@ -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 diff --git a/files/usr/bin/sipb-xen-consolefs b/files/usr/bin/sipb-xen-consolefs index d5187c5..3255b15 100755 --- a/files/usr/bin/sipb-xen-consolefs +++ b/files/usr/bin/sipb-xen-consolefs @@ -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] """ -- 1.7.9.5