Ignore:
Timestamp:
Jun 2, 2008, 1:48:27 AM (16 years ago)
Author:
ecprice
Message:

Avoid a second remctl to determine whether ice3 is up

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

Legend:

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

    r550 r554  
    138138    return machine
    139139
    140 def getList(machines):
    141     """Return a dictionary mapping machine to dicts."""
     140def getList():
     141    """Return a dictionary mapping machine names to dicts."""
    142142    value_string = remctl('web', 'listvms')
    143143    value_dict = yaml.safe_load(value_string)
    144 
    145     d = dict((m, value_dict[m.name]) for m in machines if m.name in value_dict)
    146     return d
     144    return value_dict
    147145
    148146def parseStatus(s):
  • trunk/packages/sipb-xen-www/code/main.py

    r540 r554  
    204204    xmlist = g.xmlist
    205205    checkpoint.checkpoint('Got uptimes')
    206     can_clone = (controls.getList([Machine.get_by(name='ice3')])) == {}
     206    can_clone = 'ice3' in g.xmlist_raw
    207207    for m in machines:
    208208        if m not in xmlist:
  • trunk/packages/sipb-xen-www/code/webcommon.py

    r535 r554  
    4444    machines = cachedproperty(lambda self:
    4545                                  Machine.query().join('acl').select_by(user=self.user))
     46    xmlist_raw = cachedproperty(lambda self: controls.getList())
    4647    xmlist = cachedproperty(lambda self:
    47                                 controls.getList(self.machines))
     48                                dict((m, self.xmlist_raw[m.name])
     49                                     for m in self.machines
     50                                     if m.name in self.xmlist_raw))
    4851
    4952    def clear(self):
Note: See TracChangeset for help on using the changeset viewer.