From 16617dc155fc4e4cf90254bca02f0245abbb4ca5 Mon Sep 17 00:00:00 2001
From: Alexandre MERLIN <alexandre.merlin@inria.fr>
Date: Wed, 2 Jun 2021 10:38:42 +0200
Subject: [PATCH] [gen/kavlan] add pxe.pathprefix

---
 lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb b/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb
index 8c2d182f934..36341972076 100644
--- a/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb
+++ b/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb
@@ -48,12 +48,20 @@ class "PXE" {
         # Set the  vendor-class-identifier field to PXEClient in dhcp answer
         # if this field is not set the pxe client will ignore the answer !
         #
+        option pxelinux.pathprefix "http://kadeploy.<%= "#{site_uid}.grid5000.fr" %>;
         option vendor-class-identifier "PXEClient";
         vendor-option-space PXE;
         option PXE.mtftp-ip 0.0.0.0;
     }
 }
 
+# force dhcp parameter request to include the pathprefix (210 = 0xd2) even if
+# the dhcp client did not request it
+
+if exists dhcp-parameter-request-list {
+  option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list, d2);
+}
+
 <%
 kavlan = refapi['sites'][site_uid]['kavlans'][kavlan_id.to_s] # TODO fix needed conversion
 kavlan_ip = IPAddress::IPv4::new(kavlan['network'])
-- 
GitLab