Changeset 443
- Timestamp:
- Apr 21, 2008, 10:50:54 PM (17 years ago)
- Location:
- trunk/packages
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-database/debian/changelog
r433 r443 1 sipb-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 1 7 sipb-xen-database (10.5) unstable; urgency=low 2 8 -
trunk/packages/sipb-xen-database/sipb_xen_database/models.py
r296 r443 13 13 'types_table', 14 14 'cdroms_table', 15 'autoinstalls_table', 15 16 'Machine', 16 17 'MachineAccess', … … 18 19 'Disk', 19 20 'Type', 20 'CDROM'] 21 'CDROM', 22 'Autoinstall', 23 ] 21 24 22 25 meta = DynamicMetaData() … … 59 62 Column('description', String, nullable=False)) 60 63 64 autoinstalls_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 61 69 machine_access_table = Table('machine_access', meta, 62 70 Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=False, index=True), … … 88 96 return "<CDROM %s: %s>" % (self.cdrom_id, self.description) 89 97 98 class Autoinstall(object): 99 def __repr__(self): 100 return "<Autoinstall %s: %s (%s)>" % (self.autoinstall_id, self.description, self.type.type_id) 101 90 102 assign_mapper(ctx, Machine, machine_table, 91 103 properties={'nics': relation(NIC, backref="machine"), … … 98 110 assign_mapper(ctx, Type, types_table) 99 111 assign_mapper(ctx, CDROM, cdroms_table) 112 assign_mapper(ctx, Autoinstall, autoinstalls_table) 100 113 101 114 def clear_cache(): -
trunk/packages/sipb-xen-www/code/main.py
r440 r443 38 38 from Cheetah.Template import Template 39 39 import sipb_xen_database 40 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type 40 from sipb_xen_database import Machine, CDROM, ctx, connect, MachineAccess, Type, Autoinstall 41 41 import validation 42 42 from webcommon import InvalidInput, CodeError, g … … 99 99 disk = 4.0 100 100 cdrom = '' 101 autoinstall = '' 101 102 name = '' 102 103 def __init__(self, max_memory=None, max_disk=None, **kws): … … 222 223 machines=machines, 223 224 has_vnc=has_vnc, 224 uptimes=g.uptimes, 225 cdroms=CDROM.select()) 225 uptimes=g.uptimes) 226 226 return d 227 227 … … 572 572 checkpoint.checkpoint('Got defaults') 573 573 d = dict(user=user, 574 cdroms=CDROM.select(),575 574 on=status is not None, 576 575 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 4 onchange="$onchange"#slurp 5 #end if 6 > 3 7 <option #slurp 4 8 #if $default then '' else 'selected' 5 9 value="">None</option> 6 #for $ cdrom in $cdroms10 #for $item in $lst 7 11 <option #slurp 8 #if $default == $cdrom.cdrom_idthen 'selected' else ''9 value="$ cdrom.cdrom_id">10 $ cdrom.description12 #if $default == getattr(item, valueattr) then 'selected' else '' 13 value="${getattr(item, valueattr)}"> 14 ${getattr(item, descattr)} 11 15 </option> 12 16 #end for 13 17 </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') 14 29 #end def 15 30 -
trunk/packages/sipb-xen-www/code/templates/info.tmpl
r440 r443 41 41 #end if 42 42 <td>Boot CD:</td> 43 <td>$cdromList( $cdroms)</td>43 <td>$cdromList()</td> 44 44 </tr> 45 45 <tr> -
trunk/packages/sipb-xen-www/code/templates/list.tmpl
r440 r443 42 42 $errorRow('vmtype', $err) 43 43 <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> 44 50 <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> 46 53 </tr> 47 54 $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>54 55 $errorRow('cdrom', $err) 55 56 <tr>
Note: See TracChangeset
for help on using the changeset viewer.