Exemplo n.º 1
0
def _get_device_config_path(mac_address):
    """
    Get the path where the PXE boot symlink should be placed
    for a specific device.
    """
    mac_address = util.mac_with_dashes(mac_address)
    symlink_dir = os.path.join(config.get('paths', 'tftp_root'), "pxelinux.cfg")
    return os.path.join(symlink_dir, "01-" + mac_address)
def _get_device_config_path(mac_address):
    """
    Get the path where the PXE boot symlink should be placed
    for a specific device.
    """
    mac_address = util.mac_with_dashes(mac_address)
    symlink_dir = os.path.join(config.get('paths', 'tftp_root'),
                               "pxelinux.cfg")
    return os.path.join(symlink_dir, "01-" + mac_address)
Exemplo n.º 3
0
 def _get_second_stage(self):
     mac_address = util.mac_with_dashes(
             self.db.devices.get_mac_address(self.name))
     dir = os.path.join(config.get('paths', 'tftp_root'), "pxelinux.cfg")
     filename = os.path.join(dir, "01-" + mac_address)
     if os.path.exists(filename):
         with open(filename) as f:
             cfg = f.read()
             mo = re.search('mobile-imaging-url=[^ ]*/([^ ]*).sh', cfg)
             if mo:
                 return mo.group(1)
             else:
                 self.logger.warn('PXE config does not contain a mobile-imaging-url; not PXE booting')
     # if nothing's found, return None
     return None
Exemplo n.º 4
0
 def _get_second_stage(self):
     mac_address = util.mac_with_dashes(
         self.db.devices.get_mac_address(self.name))
     dir = os.path.join(config.get('paths', 'tftp_root'), "pxelinux.cfg")
     filename = os.path.join(dir, "01-" + mac_address)
     if os.path.exists(filename):
         with open(filename) as f:
             cfg = f.read()
             mo = re.search('mobile-imaging-url=[^ ]*/([^ ]*).sh', cfg)
             if mo:
                 return mo.group(1)
             else:
                 self.logger.warn(
                     'PXE config does not contain a mobile-imaging-url; not PXE booting'
                 )
     # if nothing's found, return None
     return None
Exemplo n.º 5
0
 def test_mac_with_dashes(self):
     self.assertEqual(util.mac_with_dashes('112233445566', '11-22-33-44-55-66'))