Example #1
0
def set_pxe(device_name, image_name, boot_config):
    """
    Set the boot configuration for the given device to the start up with PXE
    config from IMAGE_NAME and supply an additional JSON configuration BOOT_CONFIG.
    """
    logs.device_logs.add(device_name, "setting PXE config to '%s'" % (image_name,), 'bmm')
    pxe.set_pxe(device_name, image_name, boot_config)
 def test_set_pxe(self):
     config.set('server', 'ipaddress', '1.2.3.4')
     cfg_dir = os.path.join(self.tempdir, 'tftp', 'pxelinux.cfg')
     cfg_filename = os.path.join(cfg_dir, '01-aa-bb-cc-dd-ee-ff')
     self.assertFalse(os.path.exists(cfg_dir))
     pxe.set_pxe('aabbccddeeff', 'IMG1 ip=%IPADDRESS%')
     self.assertEqual(open(cfg_filename).read(), 'IMG1 ip=1.2.3.4')
Example #3
0
def set_pxe(device_name, image_name, boot_config):
    """
    Set the boot configuration for the given device to the start up with PXE
    config from IMAGE_NAME and supply an additional JSON configuration BOOT_CONFIG.
    """
    logs.device_logs.add(device_name,
                         "setting PXE config to '%s'" % (image_name, ), 'bmm')
    pxe.set_pxe(device_name, image_name, boot_config)
 def set_pxe(self, device_name, pxe_config_name):
     """
     Set the boot configuration for the given device to the start up with
     PXE config from PXE_CONFIG_NAME and supply an additional JSON
     configuration BOOT_CONFIG.
     """
     pxe_config = self.db.pxe_configs.get(pxe_config_name)['contents']
     mac_address = self.db.devices.get_mac_address(device_name)
     pxe.set_pxe(mac_address, pxe_config)
Example #5
0
 def test_set_pxe(self):
     pxe.set_pxe('device1', 'img1', 'config')
     cfg_filename = os.path.join(os.path.join(self.tempdir, 'tftp', 'pxelinux.cfg'), '01-aa-bb-cc-dd-ee-ff')
     self.assertEqual(open(cfg_filename).read(), 'IMG1 ip=1.2.3.4')