From 95196091f7835ed3de015728859819274a0d6911 Mon Sep 17 00:00:00 2001 From: Leos Stejskal Date: Mon, 30 Jan 2023 12:27:02 +0100 Subject: [PATCH] Fixes #36019 - Pass URL params to foreman_url as hash Some templates add URL params to the foreman_url like this: <%= foreman_url('provision') + "&static=yes" %> That cause issues when token_duration setting is set to 0, generating URL '.../unattended/provision&static=yes' instead of '.../unattended/provision?static=yes' --- .../provisioning_templates/discovery/debian_kexec.erb | 2 +- .../provisioning_templates/discovery/redhat_kexec.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/unattended/provisioning_templates/discovery/debian_kexec.erb b/app/views/unattended/provisioning_templates/discovery/debian_kexec.erb index 4f8597f95bf..d129f2d73c8 100644 --- a/app/views/unattended/provisioning_templates/discovery/debian_kexec.erb +++ b/app/views/unattended/provisioning_templates/discovery/debian_kexec.erb @@ -40,6 +40,6 @@ require: { "kernel": "<%= @kernel_uri %>", "initram": "<%= @initrd_uri %>", -"append": "url=<%= foreman_url('provision') + "&static=yes" %> interface=<%= mac %> netcfg/get_ipaddress=<%= ip %> netcfg/get_netmask=<%= mask %> netcfg/get_gateway=<%= gw %> netcfg/get_nameservers=<%= dns %> netcfg/disable_dhcp=true netcfg/get_hostname=<%= @host.name %> BOOTIF=<%= bootif %> <%= options.compact.join(' ') %>", +"append": "url=<%= foreman_url('provision', { static: 'yes' })%> interface=<%= mac %> netcfg/get_ipaddress=<%= ip %> netcfg/get_netmask=<%= mask %> netcfg/get_gateway=<%= gw %> netcfg/get_nameservers=<%= dns %> netcfg/disable_dhcp=true netcfg/get_hostname=<%= @host.name %> BOOTIF=<%= bootif %> <%= options.compact.join(' ') %>", "extra": <%= extra %> } diff --git a/app/views/unattended/provisioning_templates/discovery/redhat_kexec.erb b/app/views/unattended/provisioning_templates/discovery/redhat_kexec.erb index d3ca62c62d1..05f755989ef 100644 --- a/app/views/unattended/provisioning_templates/discovery/redhat_kexec.erb +++ b/app/views/unattended/provisioning_templates/discovery/redhat_kexec.erb @@ -52,9 +52,9 @@ require: "initram": "<%= @initrd_uri %>", <% if (@host.operatingsystem.name == 'Fedora' and @host.operatingsystem.major.to_i > 16) or (@host.operatingsystem.name != 'Fedora' and @host.operatingsystem.major.to_i >= 7) -%> - "append": "inst.ks=<%= foreman_url('provision') + "&static=yes" %> inst.ks.sendmac <%= "ip=#{ip}::#{gw}:#{mask}:::none nameserver=#{dns} ksdevice=bootif BOOTIF=#{bootif} nomodeset nokaslr " + options.compact.join(' ') %>", + "append": "inst.ks=<%= foreman_url('provision', { static: 'yes' }) %> inst.ks.sendmac <%= "ip=#{ip}::#{gw}:#{mask}:::none nameserver=#{dns} ksdevice=bootif BOOTIF=#{bootif} nomodeset nokaslr " + options.compact.join(' ') %>", <% else -%> - "append": "inst.ks=<%= foreman_url('provision') + "&static=yes" %> kssendmac nicdelay=5 <%= "ip=#{ip} netmask=#{mask} gateway=#{gw} dns=#{dns} ksdevice=#{mac} BOOTIF=#{bootif} nomodeset nokaslr " + options.compact.join(' ') %>", + "append": "inst.ks=<%= foreman_url('provision', { static: 'yes' }) %> kssendmac nicdelay=5 <%= "ip=#{ip} netmask=#{mask} gateway=#{gw} dns=#{dns} ksdevice=#{mac} BOOTIF=#{bootif} nomodeset nokaslr " + options.compact.join(' ') %>", <% end -%> "extra": <%= extra %> }