Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1264916 - Missing variable to include Sat 6 Hostname in PXE Menus
Summary: Missing variable to include Sat 6 Hostname in PXE Menus
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: TFTP
Version: 6.1.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Marek Hulan
QA Contact: Sachin Ghai
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2015-09-21 12:55 UTC by Peter Vreman
Modified: 2019-09-26 17:37 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:20:03 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14232 0 None None None 2016-04-22 15:15:27 UTC

Description Peter Vreman 2015-09-21 12:55:58 UTC
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 
...
DEFAULT menu
PROMPT 0
MENU TITLE Kickstart - <%= foreman_server %>
...
2.
3.

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 09:23:13 UTC
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 09:26:44 UTC
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 10:36:57 UTC
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 11:46:01 UTC
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 16:33:47 UTC
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 14:22:29 UTC
Created redmine issue http://projects.theforeman.org/issues/14232 from this bug

Comment 8 Marek Hulan 2016-03-16 15:49:30 UTC
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 16:09:37 UTC
Upstream bug component is TFTP

Comment 10 Bryan Kearney 2016-03-22 14:09:39 UTC
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 09:09:08 UTC
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 09:09:56 UTC
Created attachment 1155221 [details]
foreman fqdn varibale set and it correctly rendered as PXE menu title.

Comment 13 Bryan Kearney 2016-07-27 11:20:03 UTC
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.

https://access.redhat.com/errata/RHBA-2016:1501


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