Bug 1264916 - Missing variable to include Sat 6 Hostname in PXE Menus
Missing variable to include Sat 6 Hostname in PXE Menus
Product: Red Hat Satellite 6
Classification: Red Hat
Component: TFTP (Show other bugs)
Unspecified Unspecified
unspecified Severity medium (vote)
: GA
: --
Assigned To: Marek Hulan
Sachin Ghai
: Triaged
Depends On:
Blocks: 1122832
  Show dependency treegraph
Reported: 2015-09-21 08:55 EDT by Peter Vreman
Modified: 2016-07-27 07:20 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-07-27 07:20:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
foreman fqdn varibale set and it correctly rendered as PXE menu title. (17.90 KB, image/png)
2016-05-09 05:09 EDT, Sachin Ghai
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 14232 None None None 2016-04-22 11:15 EDT

  None (edit)
Description Peter Vreman 2015-09-21 08:55:58 EDT
Description of problem:
We have multiple Sat6 servers. Currently from the PXE menu it is hard to distinguish between them.
There is no variable to include in the PXE Menu Title, e.g. in "PXELinux global default", to has the Sat6 Hostname.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Have the Sat6 Hostname rendered from template variable in the PXE Menu title 
MENU TITLE Kickstart - <%= foreman_server %>

Actual results:
Missing the foreman_server name

Expected results:
Foreman Server name is included in the template

Additional info:
Comment 2 Marek Hulan 2016-03-09 04:23:13 EST
You can use following

    DEFAULT menu
    PROMPT 0
    MENU TITLE PXE Menu - <%= foreman_url.sub('/unattended/built', '') %>

You can even omit the .sub(...) part if you don't mind that url would include unattended path. The foreman_url determines the hostname by "Unattended URL" setting (Administer -> Settings -> Provision).

Would this be enough or do you want to add new helper that would remove the path from url?
Comment 3 Marek Hulan 2016-03-09 04:26:44 EST
Actually the snippet can be even a bit simpler using chomp instead of sub

    <%= foreman_url.chomp('/unattended/built') %>
Comment 4 Peter Vreman 2016-03-09 05:36:57 EST
When it works the provided solution of using foreman_url is enough. But sadly it is not alled by the Safemode jail:

Using <%= foreman_url.sub('/unattended/built', '') %>:

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XGET https://localhost/api/config_templates/build_pxe_default
failed to process template: undefined method 'sub' for NilClass::Jail (NilClass)

Using <%= foreman_url.chomp('/unattended/built') %>:

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3}" -XGET https://localhost/api/config_templates/build_pxe_default
failed to process template: Safemode doesn't allow to access 'foreman_url' on #<Safemode::ScopeObject>
Comment 5 Marek Hulan 2016-03-09 06:46:01 EST
Sorry I've tested with slightly newer version version of satellite, this will be possible with Satellite 6.2. The foreman_url function must be available though, since we use it in default PXELinux template to get url for kickstart file. It's called slightly differently, could you please try using <%= foreman_url('provision') %> instead?
Comment 6 Marek Hulan 2016-03-14 12:33:47 EDT
I didn't realize that build_pxe_default might have different rendering context, I'll verify if that's the case
Comment 7 Marek Hulan 2016-03-16 10:22:29 EDT
Created redmine issue http://projects.theforeman.org/issues/14232 from this bug
Comment 8 Marek Hulan 2016-03-16 11:49:30 EDT
Ok I was able to reproduce. There might be a workaround to use default_template_url but it's getting really hacky. I'll change it so that it will allow using foreman_url even when building pxe default template along with other useful helpers like snippet.
Comment 9 Bryan Kearney 2016-03-16 12:09:37 EDT
Upstream bug component is TFTP
Comment 10 Bryan Kearney 2016-03-22 10:09:39 EDT
Moving to POST since upstream bug http://projects.theforeman.org/issues/14232 has been closed
Marek Hulán
Applied in changeset commit:e4ed4a0db4d60f68183b5ef3bff13e136af684e6.
Comment 11 Sachin Ghai 2016-05-09 05:09:08 EDT
Verified with sat62 GA snap10.1

Now you can set the foreman_fqdn in PXE menus with variable: <%= foreman_server_fqdn %> 

Please see the attached screenshot where PXE Men Title rendered with foreman server name.
Comment 12 Sachin Ghai 2016-05-09 05:09 EDT
Created attachment 1155221 [details]
foreman fqdn varibale set and it correctly rendered as PXE menu title.
Comment 13 Bryan Kearney 2016-07-27 07:20:03 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.