diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2015-04-23 17:07:28 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-04-28 18:12:48 +0000 |
commit | 8ace3d897295e26d83c680db983093bd43a11b96 (patch) | |
tree | 0b97772f2ad819872f80939aeb24abb46b38607c /pxeboot.write | |
parent | 92402354b7ae3f039cd3acd21ea665d77eec5c97 (diff) | |
download | definitions-8ace3d897295e26d83c680db983093bd43a11b96.tar.gz |
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
Diffstat (limited to 'pxeboot.write')
-rwxr-xr-x | pxeboot.write | 16 |
1 files changed, 15 insertions, 1 deletions
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) |