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 1351766 - Can't access inherited parameters from host
Summary: Can't access inherited parameters from host
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Users & Roles
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: Unspecified
Assignee: orabin
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On: 1296662
Blocks: rhci-common-installer
TreeView+ depends on / blocked
 
Reported: 2016-06-30 18:50 UTC by Fabian von Feilitzsch
Modified: 2019-09-26 16:19 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 15599 0 Normal Closed Unattended controller can't access host parameters in kickstart templates 2020-06-15 17:34:44 UTC

Description Fabian von Feilitzsch 2016-06-30 18:50:19 UTC
Description of problem:

The latest downstream Foreman release added some permissions checks to inherited parameter lookups for managed hosts. This breaks our (QCI) deployments, as the host is not be able to find an associated activation key (inherited from the hostgroup), will not register with subscription-manager (snippet is conditional on activation key in the kickstart), and will fail to install or configure puppet. The BZ that prompted the breaking change is https://bugzilla.redhat.com/show_bug.cgi?id=1296662 . The UI shows the 

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

How reproducible:
100%

Steps to Reproduce:
1. Create a hostgroup
2. Add parameters to that hostgroup
3. Convert a discovered host to a managed host.
4. From the rails console, load up the hostgroup and host
5. Set the host's hostgroup to the newly created one and save the host
6. Check host.params

Actual results:
An empty dictionary

Expected results:
Consistent with previous behavior and the web UI, you would see the parameters that the host inherited from the hostgroup.


Additional comments:
Even though the WebUI shows the inherited parameters correctly, and checking the generated kickstart looks correct, when we actually trigger a build on the host, the kickstart it gets does not have access to any of the host's inherited parameters, consistent with the behavior on the console.

Comment 1 Fabian von Feilitzsch 2016-06-30 20:16:24 UTC
I did some additional looking, it seems that if I set User.current in the console to one of the admin users I am able to view the host parameters, however the generated kickstart still does not get access to them. Is it possible that if the kickstart is fetched by an API call that User.current would not be set?

Comment 3 Fabian von Feilitzsch 2016-07-05 15:22:59 UTC
This seems to actually break builds where the host inherits an activation key from the hostgroup completely, outside of the Quickstart Cloud Installer plugin. If I set an activation key in the hostgroup parameters, add that hostgroup to a host, and then trigger a build, this check in the kickstart template is false, and the host is not registered to Satellite:

    <% if @host.params['kt_activation_keys'] %>

I have verified that host.params['kt_activation_keys'] is present on the command line with the user set to any of the users in the database. I have tried setting the User manually on the QCI side, but it doesn't seem to carry over to whatever Foreman does when it triggers the build and tries to access host.params. 

I can't think of another way to work around it on the QCI side, and it breaks all QCI deployments. I have gotten my team pinned one commit behind, and we will not be able to update until this issue is fixed or a workaround is found.

Comment 9 John Matthews 2016-07-06 13:20:59 UTC
Ori,

Will this commit fix the issue described in the BZ?
  https://github.com/theforeman/foreman/pull/3624

As per BZ 1296662

Comment 10 orabin 2016-07-06 13:33:17 UTC
No, it shouldn't be related.

The issue here seems to be a user that is missing the view_params permission but it's not clear which user.

The user that can reproduce the steps from comment 1 - can that role be checked out to make sure it has view_params?

Comment 11 Fabian von Feilitzsch 2016-07-06 20:13:56 UTC
So the request that is getting the provisioning template is being processed by the UnattendedController, which doesn't seem to set a User. I debugged a bit and saw that when the kickstart is requested, inside the host.params method User.current is nil. I added the line "set_admin_user" to the UnattendedController.host_template method, before render_template is called. This made the provisioning work as expected. 

I also tried adding view_params to every Role in the database, it had no effect, the kickstart still did not render correctly, which makes sense since it seems there was no set User for the unattended routes.

Comment 12 orabin 2016-07-07 07:49:29 UTC
For the record - as discussed on irc, the steps to reproduce without the kickstart are also reproducible only when User.current is nil.

Since there is no user changing the roles won't help.

Comment 13 orabin 2016-07-07 08:09:33 UTC
Created redmine issue http://projects.theforeman.org/issues/15599 from this bug

Comment 14 Bryan Kearney 2016-07-07 10:15:34 UTC
Upstream bug assigned to orabin

Comment 15 Bryan Kearney 2016-07-07 10:15:37 UTC
Upstream bug component is Users & Roles

Comment 16 Bryan Kearney 2016-07-07 10:15:39 UTC
Upstream bug assigned to orabin

Comment 17 Bryan Kearney 2016-07-11 14:15:37 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15599 has been closed

Comment 23 Bryan Kearney 2016-07-13 16:15:08 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15599 has been closed

Comment 27 Peter Ondrejka 2017-10-24 15:01:18 UTC
Verified in satellite-6.3.0-21.0.beta.el7sat.noarch

Comment 28 Peter Ondrejka 2017-10-24 15:02:59 UTC
Host group parameters are correctly inherited when discovered host is provisioned with the set hostgroup, also when a hostgroup is changed afterwards new parameters are inherited

Comment 29 Bryan Kearney 2018-02-21 17:32:43 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/RHSA-2018:0336

Comment 30 Bryan Kearney 2018-02-21 17:33:12 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/RHSA-2018:0336


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