-
Bug
-
Resolution: Done-Errata
-
Normal
-
6.12.0
-
False
-
-
False
-
CLOSED
-
800
-
Rocket
-
-
-
Moderate
-
None
Description of problem:
System build based on "PXELess Discovery" will always fail if the "Installation token lifetime" has been disabled in Satellite 6.12 ( even 6.10\6.11 ).
But every other type of deployment works fine under the same token disabled situation.
Version-Release number of selected component (if applicable):
Satellite 6.12
Satellite 6.11
Satellite 6.10
How reproducible:
Always
Steps to Reproduce:
1. Install a Satellite 6.12
--> Disable the "Installation token lifetime" from Satellite settings i.e.s et it to 0.
2. Set it up for "PXELess discovery" based deployments
3. Discover a system using foreman-discovery-image iso
4. Once discovered submit the "discovered host" for build
5. Observe the console of the host
6. Come back to Satellite UI --> Hosts --> All Hosts --> Open the Host entry --> go to Templates tab --> Review the "Discovery Kexec" template and look at the ks= url.
Actual results:
At step 5, The kexec happens successfully with following args :
~~
Sep 02 16:33:22 fdi foreman-proxy[1366]: Power API executing: ["/usr/sbin/kexec", "--debug", "--force", "--append=inst.ks=http://sat612.example.com/unattended/provision&static=yes inst.ks.sendmac ip=192.168.239.100::192.168.239.1:255.255.255.0:::none nameserver=192.168.239.2 ksdevice=bootif BOOTIF=01-00-50-56-b4-ca-49 nomodeset nokaslr nomodeset", "--initrd=/tmp/initrd.img", "/tmp/vmlinuz"]
Sep 02 16:33:22 fdi sudo[1595]: foreman-proxy : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/kexec --debug --force --append=inst.ks=http://sat612.example.com/unattended/provision&static=yes inst.ks.sendmac ip=192.168.239.100::192.168.239.1:255.255.255.0:::none nameserver=192.168.239.2 ksdevice=bootif BOOTIF=01-00-50-56-b4-ca-49 nomodeset nokaslr nomodeset --initrd=/tmp/initrd.img /tmp/vmlinuz
~~
But as soon as the host tries to fetch the kickstart file using the url http://sat612.example.com/unattended/provision&static=yes it fails to do so as it is an invalid URL.
Expected results:
When token is disabled, The kexec should happen with this ks url only:
http://sat612.example.com/unattended/provision
but not
http://sat612.example.com/unattended/provision&static=yes
or else it will get a 404 not found .
Additional info:
This happens as we don't consider the token situation but add "static=yes" at the end of the ks url for RedHat Discovery Kexec template.
There are two ways to fix it while not breaking anything else and honoring the token_timeout values as well.
A) if token_timeout is disabled then don't add "&static=yes"
<% if (@host.operatingsystem.name == 'Fedora' and @host.operatingsystem.major.to_i > 16) or
(@host.operatingsystem.name != 'Fedora' and @host.operatingsystem.major.to_i >= 7) -%>
<% if @host.token -%>
"append": "inst.ks=<%= foreman_url('provision') + "&static=yes" %> inst.ks.sendmac <%= "ip=#
<% else -%>
"append": "inst.ks=<%= foreman_url('provision') %> inst.ks.sendmac <%= "ip=#{ip}
::#
{gw}:#{mask}:::none nameserver=#{dns} ksdevice=bootif BOOTIF=#{bootif} nomodeset nokaslr " + options.compact.join(' ') %>",<% end -%>
<% 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(' ') %>",<% end -%>
B) Don't add "&static=yes" for any scenarios as without or without it, The build happens and gets completed just fine whether the roken_timeout is enabled or disabled.
<% 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') %> 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(' ') %>",
<% end -%>