예제 #1
0
파일: runtests.py 프로젝트: armenzg/mozpool
 def testListDevicesDetails(self):
     add_image('img1', id=23)
     add_device('device2', last_image_id=23, server='server1')
     self.assertEquals(data.list_devices(detail=True), {'devices': [
         udict(id=1, name='device1', fqdn='device1', inventory_id=1,
               mac_address='000000000000', imaging_server='server1',
               relay_info='relay-1:bank1:relay1', state='offline',
               comments=None, last_image=None, boot_config=u'{}',
               environment=None),
         udict(id=2, name='device2', fqdn='device2', inventory_id=2,
               mac_address='000000000000', imaging_server='server1',
               relay_info='', state='offline', comments=None,
               last_image='img1', boot_config=u'{}', environment=None),
         ]})
예제 #2
0
    def _populate(self):
        fqdn = config.get('server', 'fqdn')
        for dev_dict in data.list_devices(detail=True)['devices']:
            # only emulate devices managed by this imaging sever
            if dev_dict['imaging_server'] != fqdn:
                continue

            # only emulate devices with relay info starting with 'localhost' 
            hostname, bank, relay = dev_dict['relay_info'].rsplit(":", 2)
            if not hostname.startswith('localhost:'):
                continue

            if hostname not in self.chassis:
                self.chassis[hostname] = Chassis(self, hostname)
            chassis = self.chassis[hostname]

            device = Device(self, dev_dict['name'], dev_dict)
            self.devices[dev_dict['name']] = device
            self.devices_by_fqdn[dev_dict['fqdn']] = device
            chassis.add_device(int(bank[4:]), int(relay[5:]), device)
예제 #3
0
파일: handlers.py 프로젝트: armenzg/mozpool
 def GET(self):
     args, _ = templeton.handlers.get_request_parms()
     return data.list_devices(detail='details' in args)
예제 #4
0
파일: runtests.py 프로젝트: armenzg/mozpool
 def testListDevices(self):
     self.assertEquals(data.list_devices(), { 'devices' : [ 'device1' ] })
예제 #5
0
 def GET(self):
     args, _ = templeton.handlers.get_request_parms()
     if 'details' in args:
         return dict(devices=data.dump_devices())
     else:
         return data.list_devices()
예제 #6
0
 def GET(self):
     args, _ = templeton.handlers.get_request_parms()
     if 'details' in args:
         return dict(devices=data.dump_devices())
     else:
         return data.list_devices()