Ignore:
Timestamp:
Aug 3, 2008, 1:01:49 AM (16 years ago)
Author:
y_z
Message:
  • sipb_xen_database -> invirt.database
  • use invirt config
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-console/files/usr/bin/sipb-xen-consolefs

    r359 r841  
    1313from syslog import *
    1414
    15 import sipb_xen_database
     15from invirt.config import structs as config
     16from invirt import database
    1617
    1718fuse.fuse_python_api = (0, 2)
     
    8687                if time() - self.lasttime > 15:
    8788                        self.lasttime = time()
    88                         sipb_xen_database.clear_cache()
    89                 return [machine.name for machine in sipb_xen_database.Machine.select()]
     89                        database.clear_cache()
     90                return [machine.name for machine in database.Machine.select()]
    9091       
    9192        def getUid(self, machine_name):
    9293                """Calculate the UID of a machine-account, which is just machine_id+1000
    9394                """
    94                 return sipb_xen_database.Machine.get_by(name=machine_name).machine_id + 1000
     95                return database.Machine.get_by(name=machine_name).machine_id + 1000
    9596       
    9697        def getK5login(self, machine_name):
    9798                """Build the ACL for a machine and turn it into a .k5login file
    9899                """
    99                 machine = sipb_xen_database.Machine.get_by(name=machine_name)
     100                machine = database.Machine.get_by(name=machine_name)
    100101                users = [acl.user for acl in machine.acl]
    101102                return "\n".join(map(self.userToPrinc, users) + [''])
     
    109110                else:
    110111                        princ = user
    111                         realm = "ATHENA.MIT.EDU"
     112                        realm = config.authn[0].realm
    112113               
    113114                return princ.replace('.', '/') + '@' + realm
     
    240241
    241242if __name__ == '__main__':
    242         sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
     243        database.connect()
    243244        usage="""
    244245ConsoleFS [mount_path]
Note: See TracChangeset for help on using the changeset viewer.