Example #1
0
def _get_device_config_path(device_name):
    """
    Get the path where the PXE boot symlink should be placed
    for a specific device.
    """
    mac_address = data.mac_with_dashes(data.device_mac_address(device_name))
    symlink_dir = os.path.join(config.get('paths', 'tftp_root'), "pxelinux.cfg")
    return os.path.join(symlink_dir, "01-" + mac_address)
Example #2
0
def _get_device_config_path(device_name):
    """
    Get the path where the PXE boot symlink should be placed
    for a specific device.
    """
    mac_address = data.mac_with_dashes(data.device_mac_address(device_name))
    symlink_dir = os.path.join(config.get('paths', 'tftp_root'), "pxelinux.cfg")
    return os.path.join(symlink_dir, "01-" + mac_address)
Example #3
0
 def _get_second_stage(self):
     mac_address = data.mac_with_dashes(data.device_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