Changeset 443 for trunk


Ignore:
Timestamp:
Apr 21, 2008, 10:50:54 PM (16 years ago)
Author:
ecprice
Message:

Support autoinstalls table for creation list.

Location:
trunk/packages
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-database/debian/changelog

    r433 r443  
     1sipb-xen-database (10.6) unstable; urgency=low
     2
     3  * Support autoinstalls table.
     4
     5 -- Eric Price <ecprice@pseudomyrmex.mit.edu>  Mon, 21 Apr 2008 22:34:46 -0400
     6
    17sipb-xen-database (10.5) unstable; urgency=low
    28
  • trunk/packages/sipb-xen-database/sipb_xen_database/models.py

    r296 r443  
    1313           'types_table',
    1414           'cdroms_table',
     15           'autoinstalls_table',
    1516           'Machine',
    1617           'MachineAccess',
     
    1819           'Disk',
    1920           'Type',
    20            'CDROM']
     21           'CDROM',
     22           'Autoinstall',
     23           ]
    2124
    2225meta = DynamicMetaData()
     
    5962       Column('description', String, nullable=False))
    6063
     64autoinstalls_table = Table('autoinstalls', meta,
     65       Column('autoinstall_id', String, primary_key=True, nullable=False),
     66       Column('description', String, nullable=False),
     67       Column('type_id', String, ForeignKey('types.type_id'), nullable=False))
     68
    6169machine_access_table = Table('machine_access', meta,
    6270       Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=False, index=True),
     
    8896        return "<CDROM %s: %s>" % (self.cdrom_id, self.description)
    8997
     98class Autoinstall(object):
     99    def __repr__(self):
     100        return "<Autoinstall %s: %s (%s)>" % (self.autoinstall_id, self.description, self.type.type_id)
     101
    90102assign_mapper(ctx, Machine, machine_table,
    91103              properties={'nics': relation(NIC, backref="machine"),
     
    98110assign_mapper(ctx, Type, types_table)
    99111assign_mapper(ctx, CDROM, cdroms_table)
     112assign_mapper(ctx, Autoinstall, autoinstalls_table)
    100113
    101114def clear_cache():
  • trunk/packages/sipb-xen-www/code/main.py

    r440 r443  
    3838from Cheetah.Template import Template
    3939import sipb_xen_database
    40 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type
     40from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall
    4141import validation
    4242from webcommon import InvalidInput, CodeError, g
     
    9999    disk = 4.0
    100100    cdrom = ''
     101    autoinstall = ''
    101102    name = ''
    102103    def __init__(self, max_memory=None, max_disk=None, **kws):
     
    222223             machines=machines,
    223224             has_vnc=has_vnc,
    224              uptimes=g.uptimes,
    225              cdroms=CDROM.select())
     225             uptimes=g.uptimes)
    226226    return d
    227227
     
    572572    checkpoint.checkpoint('Got defaults')
    573573    d = dict(user=user,
    574              cdroms=CDROM.select(),
    575574             on=status is not None,
    576575             machine=machine,
  • trunk/packages/sipb-xen-www/code/templates/functions.tmpl

    r441 r443  
    1 #def cdromList($cdroms, $default="")
    2 <select name="cdrom" id="cdromlist">
     1#def databaseList($lst, $default, $onchange, $name, $id, $valueattr, $descattr)
     2<select name="$name" id="$id"#slurp
     3#if $onchange is not None
     4onchange="$onchange"#slurp
     5#end if
     6>
    37  <option #slurp
    48#if $default then '' else 'selected'
    59 value="">None</option>
    6   #for $cdrom in $cdroms
     10  #for $item in $lst
    711  <option #slurp
    8 #if $default == $cdrom.cdrom_id then 'selected' else ''
    9  value="$cdrom.cdrom_id">
    10     $cdrom.description
     12#if $default == getattr(item, valueattr) then 'selected' else ''
     13 value="${getattr(item, valueattr)}">
     14    ${getattr(item, descattr)}
    1115  </option>
    1216  #end for
    1317</select>
     18#end def
     19
     20#def cdromList($default="", $onchange=None)
     21$databaseList(sorted($sipb_xen_database.CDROM.select(), key=lambda x: x.description),
     22              default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description')
     23#end def
     24
     25#def autoList($default="", $onchange=None)
     26$databaseList(sorted($sipb_xen_database.Autoinstall.select(), key=lambda x: x.description),
     27              default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')
     28## $databaseList(autos, default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')
    1429#end def
    1530
  • trunk/packages/sipb-xen-www/code/templates/info.tmpl

    r440 r443  
    4141        #end if
    4242      <td>Boot CD:</td>
    43       <td>$cdromList($cdroms)</td>
     43      <td>$cdromList()</td>
    4444  </tr>
    4545    <tr>
  • trunk/packages/sipb-xen-www/code/templates/list.tmpl

    r440 r443  
    4242$errorRow('vmtype', $err)
    4343        <tr>
     44          <td>Autoinstall$helppopup('autoinstall')</td>
     45          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">$autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''")
     46              (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.)
     47          </input>
     48        </tr>
     49        <tr>
    4450          <td>Boot CD</td>
    45           <td>$cdromList($cdroms, $defaults.cdrom)</td>
     51          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>$cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''")</td>
     52          </input>
    4653        </tr>
    4754$errorRow('cdrom', $err)
    48         <tr>
    49           <td>Clone image?</td>
    50           <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" onchange="onclone(event)"/>
    51               (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)
    52               <script type='text/javascript'>function onclone(e){ document.getElementById('cdromlist').value = ''; }</script></td>
    53         </tr>
    5455$errorRow('cdrom', $err)
    5556        <tr>
Note: See TracChangeset for help on using the changeset viewer.