summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-23 17:07:28 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-28 13:56:41 +0000
commit6d0df069e5c31a5f56a1bc7a8269d88e832497ee (patch)
tree18c8e5e4cf9e50f70e0463899d03e3c001c0cf50
parentf2d78e9b7221bca65cba53af3f3b50d50d90628f (diff)
downloaddefinitions-6d0df069e5c31a5f56a1bc7a8269d88e832497ee.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
-rwxr-xr-xpxeboot.write16
1 files changed, 15 insertions, 1 deletions
diff --git a/pxeboot.write b/pxeboot.write
index 399914f5..9db9b43f 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)