Changeset 863 for trunk


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

configurize some web code

Location:
trunk/packages/sipb-xen-www/code
Files:
3 edited

Legend:

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

    r589 r863  
    11#!/usr/bin/python
    2 from sipb_xen_database import *
     2from invirt.database import *
    33import sys
    44import getafsgroups
     
    6868
    6969if __name__ == '__main__':
    70     connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')
     70    connect()
    7171    refreshCache()
  • trunk/packages/sipb-xen-www/code/controls.py

    r695 r863  
    33"""
    44
    5 from sipb_xen_database import Machine, Disk, Type, NIC, CDROM, ctx, meta
    65import validation
    76from webcommon import CodeError, InvalidInput
     
    1413import yaml
    1514
     15from invirt.config import structs as config
     16from invirt.database import Machine, Disk, Type, NIC, CDROM, ctx, meta
     17
    1618# ... and stolen from xend/uuid.py
    1719def randomUUID():
     
    2628# end stolen code
    2729
    28 def kinit(username = 'daemon/sipb-xen.mit.edu', keytab = '/etc/sipb-xen.keytab'):
     30def kinit():
    2931    """Kinit with a given username and keytab"""
    30 
    31     p = subprocess.Popen(['kinit', "-k", "-t", keytab, username],
     32    p = subprocess.Popen(['kinit', "-k", "-t", '/etc/invirt/keytab',
     33                          'daemon/'+config.web.hostname],
    3234                         stderr=subprocess.PIPE)
    3335    e = p.wait()
     
    4749    """
    4850    checkKinit()
    49     p = subprocess.Popen(['remctl', 'remote.mit.edu']
     51    p = subprocess.Popen(['remctl', config.remote.hostname]
    5052                         + list(args),
    5153                         stdout=subprocess.PIPE,
  • 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.