From 8ace3d897295e26d83c680db983093bd43a11b96 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 23 Apr 2015 17:07:28 +0000 Subject: pxeboot: Add symlink to pxeboot config file also for local deployments This functionality was added for remote deployments in a6d7d3a8. Some bootloaders look for a pxelinux configuration file on the TFTP server whose name is the normalized MAC address of the NIC prefixed with '01-' Change-Id: I6a5dc0cd71f72bf6cea6bbed05ebbeda765af805 --- pxeboot.write | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index 399914f5..7e4a995a 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -313,6 +313,14 @@ class PXEBoot(morphlib.writeexts.WriteExtension): self.status(msg='Removing %(dst)s', dst=dst) os.unlink(dst) + @contextlib.contextmanager + def _local_symlink(self, src, dst): + os.symlink(src, dst) + try: + yield + finally: + os.unlink(dst) + def local_pxelinux(self, tftproot): return self._local_copy('/usr/share/syslinux/pxelinux.0', os.path.join(tftproot, 'pxelinux.0')) @@ -431,8 +439,14 @@ class PXEBoot(morphlib.writeexts.WriteExtension): self._write_pxe_config(fh=f, kernel_tftp_url=kernel_tftp_url, rootfs_nfs_url=rootfs_nfs_url, extra_args=os.environ.get('KERNEL_ARGS','')) + try: - yield + with self._local_symlink( + src=pxe_cfg_filename, + dst=os.path.join(tftproot, + 'pxelinux.cfg', + '01-' + pxe_cfg_filename)): + yield finally: os.unlink(pxe_cfg_path) -- cgit v1.2.1