Ubuntu HWE variant support

Ubuntu have the concept of HWE/LTSEnablementStack which is a variant providing newer kernel for existing LTS releases. This is somewhat difficult to implement in Foreman currently as the location of the boot images live in a different place and the boot files URL is hard coded in Foreman. Example:




As workaround, use two operating systems in Foreman where one use “xenial” as release name and the other use “xenial-updates”, then:

+++ app/models/operatingsystems/debian.rb	2018-12-14 04:02:59.970908346 +0000
@@ -14,7 +14,14 @@

   def boot_files_uri(medium, architecture, host = nil)
-    super(medium, architecture, host).each{ |img_uri| img_uri.path = img_uri.path.gsub('x86_64', 'amd64') }
+    super(medium, architecture, host).each{ |img_uri|
+      # Debian use amd64 instead of x86_64
+      img_uri.path = img_uri.path.gsub('x86_64','amd64')
+      # Debian use arm64 instead of aarch64
+      img_uri.path = img_uri.path.gsub('aarch64','arm64')
+      # Support the HWE/LTSEnablement boot images for Ubuntu if parameter netboot=hwe
+      img_uri.path = img_uri.path.gsub('netboot','hwe-netboot') if host.params['netboot'] == 'hwe'
+    }

   def available_loaders

This hack allows you to specify a “netboot” parameter in Foreman to use hwe-netboot from xenial-updates instead of netboot from xenial. While this works it is probably not ideal and I would like to understand if there is a better approach to deal with this variant of Ubuntu.

I think you should go ahead and open a PR for this. Maybe actually two. The aarch64 is definitely worth having.

Just a quick style comment: Please use do ... end instead of {} for multiline blocks.

The aarch64 bit has already been done :slight_smile:


Hi Magne,

What version of Foreman are you using for this?