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 1685708 - Editing a host tries to inherit the operating system properties from it's host-group instead of the CV and Lifecycle Environment assigned
Summary: Editing a host tries to inherit the operating system properties from it's hos...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.4.2
Hardware: All
OS: Linux
high
high
Target Milestone: 6.11.0
Assignee: Ian Ballou
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-05 20:56 UTC by Sayan Das
Modified: 2024-03-25 15:14 UTC (History)
13 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.19-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:27:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 33591 0 Normal Closed Wrong kickstart repo shown in Edit Host page 2022-03-29 10:28:44 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:28:20 UTC

Description Sayan Das 2019-03-05 20:56:43 UTC
Description of problem:

Create a host group with only puppet related properties defined but no Lifecycle Environment\CV\Operating System and post building a host using the same host group, if one tries to edit the host, it's been observed that irrespective of whatever the CV\Environment manually was assigned, the host always displays the operating system related details by inheriting the properties from its host group.

Version-Release number of selected component (if applicable):
Red Hat Satellite 6.4.X

How reproducible:
100%

Steps to Reproduce:


1. Create a hostgroup with no CV\Lifecycle Env\Operating system defined.

2. Only defined properties will be Content Source and Puppet related fields.

3. Sync any kickstart repository(Say 7.6) and create a Custom installation media from that repository by some random name and assign it to the same operating system.

4. Now OS (7.6) is having both synced and Custom Media available.

---------------------------------

Scenario 1:

4.A) Create a host using above hostgroup, fill up the details of CV and lifecycle environment manually and build the host with Network-Based provisioning, "All Media" for Media selection and select Custom Media.


Actual results:

4.B) Once Build completed, Edit Host and try and change from "All Media" to "Synced Content" - can't because the options will be grayed out.

4.C) While on the same page change Operating system to something different then change back to actual one, "Synced Content" option becomes available.


Expected Results :

The fields should not come as greyed out and should allow changing the media to synced media without the need for changing the Operating System back & forth.

----------------------------------------


5. Scenario 2:

5.A) Create a host using the same above host group, fill up the details of CV and lifecycle environment manually and build the host with Network-Based provisioning, and synced content selected.

5.B) Edit the host with "Synced Content" set and notice "Synced Content" is greyed out and nothing selected.

5.C) Don't change anything and just submit the host.


Actual results :

1) Edit the host again and in operating system tab, It will be found that "Media" field is blank.

2) At this point, if anyone will try to render the provisioning template for that host it won't be possible.


Expected results :

Synced Content should not show grayed out at all.



Additional info:

The reason due to which I have mentioned both of the scenarios in this bug is, It seems that post building the host when we are editing the host again satellite is showing the operating system related properties by referring to the properties of assigned host group(i.e. no CV\Env defined) but not referring to the content view or environment that was assigned to the host manually during building the same.

Both of the above scenarios won't occur if the hostgroup have all possible content information already defined i.e. Content View and LifeCycle Environment.

Comment 3 Sayan Das 2019-03-05 21:00:52 UTC
I am working on a case 02328458, where Customer would like to have this problem fixed ASAP. 

The reason behind why the build their host group in such way(without any Lifecycle Env\CV) is because they just use them for populating puppet related information.

This is what the observation shared from Customer's end.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The behavior is a problem because what if I have a hostgroup that is shared between RHEL6 and RHEL7 hosts.  I have several hostgroups in my environment that are both RHEL6 and RHEL7.  I do not find it a valid solution that different operating systems should have different hostgroups.  I have several hostgroups in my environment that have both RHEL6 and RHEL7 hosts and changing that would cause some serious problems for us since we use hostgroups for Puppet.

If you look at how the data for a host is stored in the database or in Rails the values during "create" are copied from the hostgroup and saved for that host.  So if a hostgroup has environment 'test' then the default value for a host would be 'test' but it can be changed and regardless of what value is selected during creation that environment ID would get saved for that host and would always be associated with that host.  When you go to view the host the value you see is the value saved for the host, not the hostgroup.

I looked at the schema and the code.  The katello_content_facets table associates hosts so kickstart repositories.  This means when viewing a host the value shown should be the value for that host, not the hostgroup.  The value is saved for the host when a host is created or updated and should behave by showing you that value.

The fact the value you see is influenced by the hostgroup's value is NOT the behavior one gets for any other host attribute except this one.  Because of this issue the application suddenly limits hostgroups to a specific operating system which again is a huge limiting factor.  I think all 3 scenarios are bugs and the fix for all 3 is likely the same code since the rails view helper that determines what you see if used by all 3 scenarios.

I have been using Foreman for years, since before Satellite 6.  Hostgroups are NOT operating system specific and never have been.  The fact you can set a default OS is just a helper when creating hosts.  The fact the OS and other values are saved specific to a host regardless of hostgroup shows that the value of hostgroup does not influence a host after creation.  The only way hostgroups have influenced hosts after creation is via inheritance of things like parameters and puppet classes.

So look at katello_content_facets table, that's where the synced content ID is stored.

The view being used to set Synced Content: https://github.com/Katello/katello/blob/master/app/views/overrides/activation_keys/_host_synced_content_select.html.erb

The helpers are in /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.46/app/helpers/katello/hosts_and_hostgroups_helper.r or https://github.com/Katello/katello/blob/master/app/helpers/katello/hosts_and_hostgroups_helper.rb

I'm guessing the logic in "kickstart_repository_options" is flawed because everywhere else the code is looking at the correct kickstart_repository_id of the host but ends up using the value of the hostgroup.

The correct logic should be to find kickstart repositories available to the HOST based on that host's content view.  What's the point in setting a content view on a host if it's just going to use the hostgroup's value?  The value is saved to the host so that's what the view in Rails is supposed to show.  It's very poor design to save values for a host then host hostgroup values instead.  This is a bug.

It looks like the intended behavior is that kickstart_repository_options helper function uses the host object if viewing a host page.  I am still unsure why the results are for the hostgroup but it looks pretty obvious the intended behavior from code is NOT what's happening.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment 9 Sayan Das 2019-08-16 10:50:50 UTC
Hello All,


I have tested the reported concern on satellite 6.5 as well and it remains the same.

Steps:
1. Hostgroup created without any content details selected i.e only information present is about puppet environments\puppet master\ansible roles etc.
2. Host created and manually selected content source\LCE\CV\OS details.
3. Built the host.


Test 1:
1. Edit the host which is built and found that OS is selected but synced media is blank and grayed out and partition table is blank.
2. The surprising fact is, even with the condition on Step 4, If I click on "Build" and reboot the host, it did build the host properly with the correct operating system.


Test 2:
1. Edit the same host and just click on Ok to submit it Or Change something in the host e.g. ansible roles\puppet environments etc and submit the host.
2. Now click on build again, and that will be getting failed and will complain about partition template.
3. If we now again edit the host and check the OS Architecture is selected but synced media is grayed out and Operating System and Partition table are blank.

Above won't be happening if the host group have the content details\Operating systems properly selected but I expect to have the manual changes to be retained even if the host group doesn't have the information about OS.

I believe and this is a point of concern and would like to know an ETA of addressing the same.



Regards,

Sayan

Comment 12 Shale 2019-09-20 16:07:59 UTC
I am working the escalation of the BZ case with the customer, I asked him for an update outline of the issue, because he feels the issues has changed in the months it has been happening. We are asking for some feedback on the investigation based on this new outline of the situation. 


This is his current description of the overall issue. 

The initial issue was trying to change from static Media/Kickstart repo set at hostgroup to using Content view Media on Host and this wasn't possible. There were work arounds but the issue is much easier to describe this way:

1) Crease Hostgroup: base
2) Create Hostgroup: base/test
* Set Lifecycle Environment - production
* Set Content View - OSC_RHE7 (composite view used by all RHEL7 hosts)
* Set Content Source - satellite-test.infra.osc.edu
* Operating System:
** Set Architecture - x86_64
** Set Operating System - RHEL 7.7
** Set Media Selection - Synced Content
** Set Synced Content - RHEL 7.7 Kickstart
3) Create Host
* Set Hostgroup - base/test
* Change Content View - OSC_RHEL8 (composite view used by all RHEL 8 hosts)
* Operating System:
** Change Operating System to RHEL 8.0
** Synced Content to RHEL8.0 Kickstart
* Save Host
4) Edit Host
* ISSUE: Media Selection moved to "All Media" and unable to put back onto "Synced Content" which was the value used in Step #3. Field is greyed out.
* ISSUE: Media has no option selected despite having selected RHEL 8.0 Kickstart in Step #3 and field is greyed out and can't be changed

In step #4 the issues are similar to what I had before except this involves only Synced Content where the hostgroup has different content settings than the host. The issues have a work around of changing the OS to 7.7 then back to 8.0 and I can re-apply the settings given in Step #3 but that should be entirely unnecessary in order to edit a host.

The issue I encountered today I think manifested itself from same bug but in a different way. What happened was I selected a hostgroup and was unable to save the host using different OS version and Media than the host group but I'm now unable to figure out what about the hostgroup made this happen as my work around in that case was to remove all OS settings from the host group.

Now that RHEL 8 is out I will have many hostgroups with RHEL 7 and RHEL 8 hosts as I move systems to RHEL 8. I  think the only way to continue using my existing host groups is to change them to have new defaults for OS settings which shouldn't be necessary and will cause problems if I go to rebuild RHEL 7 hosts. Using different hostgroups isn't an option as I use the Hostgroup value in Puppet to define what a host should be configured to do.

Comment 19 Bryan Kearney 2020-04-23 13:56:29 UTC
We have looked at he bug and it is valid, but we have not scheduled it for a release.

Comment 22 Mike McCune 2020-12-09 22:17:13 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in approximately a month. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 26 Mike McCune 2021-01-19 21:22:07 UTC
There will be upcoming work to revamp the host edit/details pages and will keep this bug in consideration during the redesign of these pages. Will leave this open.

Comment 27 Mike McCune 2021-03-11 18:50:51 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in one month's time. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 30 Mike McCune 2021-06-08 21:13:08 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 32 Mike McCune 2021-07-13 21:54:48 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 38 Partha Aji 2021-09-29 07:35:54 UTC
Connecting redmine issue https://projects.theforeman.org/issues/33581 from this bug

Comment 39 Partha Aji 2021-09-29 15:32:19 UTC
Connecting redmine issue https://projects.theforeman.org/issues/33591 from this bug

Comment 40 Partha Aji 2021-09-29 15:38:10 UTC
Deleted the original redmine issue. The fix for Scenario 2 will be tracked by a different issue #33591.

Comment 44 Bryan Kearney 2022-03-24 00:01:05 UTC
Upstream bug assigned to iballou

Comment 45 Bryan Kearney 2022-03-24 00:01:07 UTC
Upstream bug assigned to iballou

Comment 46 Bryan Kearney 2022-03-29 00:00:57 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33591 has been resolved.

Comment 55 Stephen Wadeley 2022-04-26 17:48:06 UTC
Hello

this bug is now resolved.

Be aware that if you omit some value and the host configuration fails to save, you must check the Host tab and OS tab settings again as they will be reset to default values.

Thank you

Comment 58 errata-xmlrpc 2022-07-05 14:27:51 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 (Moderate: Satellite 6.11 Release), 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-2022:5498


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