Ignore:
Timestamp:
Aug 4, 2008, 10:16:16 PM (16 years ago)
Author:
price
Message:

configurize some web code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-www/code/main.py

    r799 r863  
    3535import templates
    3636from Cheetah.Template import Template
    37 import sipb_xen_database
    38 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall
    3937import validation
    4038import cache_acls
     
    4240import controls
    4341from getafsgroups import getAfsGroupMembers
    44 import invirt.config
    45 invirt_config = invirt.config.load()
     42import sipb_xen_database
     43from invirt import database
     44from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall
     45from invirt.config import structs as config
    4646
    4747def pathSplit(path):
     
    260260    host = controls.listHost(machine)
    261261    if host:
    262         port = 10003 + [config_host["hostname"] for config_host in invirt_config["hosts"]
    263             ].index(host)
     262        port = 10003 + [h.hostname for h in config.hosts].index(host)
    264263    else:
    265264        port = 5900 # dummy
     
    285284        return nic.hostname
    286285    elif nic.machine:
    287         return nic.machine.name + '.xvm.mit.edu'
     286        return nic.machine.name + '.' + config.dns.domains[0]
    288287    else:
    289288        return None
     
    442441ParaVM machines do not support local console access over VNC.  To
    443442access the serial console of these machines, you can SSH with Kerberos
    444 to console.xvm.mit.edu, using the name of the machine as your
    445 username.""",
     443to console.%s, using the name of the machine as your
     444username.""" % config.dns.domains[0],
    446445                    'HVM/ParaVM': """
    447446HVM machines use the virtualization features of the processor, while
     
    632631    import subprocess
    633632
    634     to = 'xvm@mit.edu'
     633    to = config.web.errormail
    635634    mail = """To: %s
    636 From: root@xvm.mit.edu
     635From: root@%s
    637636Subject: %s
    638637
    639638%s
    640 """ % (to, subject, body)
     639""" % (to, config.web.hostname, subject, body)
    641640    p = subprocess.Popen(['/usr/sbin/sendmail', to], stdin=subprocess.PIPE)
    642641    p.stdin.write(mail)
     
    733732
    734733def constructor():
    735     connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
     734    connect()
    736735    return App
    737736
Note: See TracChangeset for help on using the changeset viewer.