Bug 2002533 - Child hostgroup shows wrong "inherit parent" value in the selection options [NEEDINFO]
Summary: Child hostgroup shows wrong "inherit parent" value in the selection options
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Group
Version: 6.9.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-09 06:30 UTC by Hao Chang Yu
Modified: 2023-07-28 05:23 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:
jalviso: needinfo? (satellite6-bugs)


Attachments (Terms of Use)

Description Hao Chang Yu 2021-09-09 06:30:12 UTC
Description of problem:
If a child host group attribute is not currently inherit from the parent host group. The selection option will show the incorrect "inherit parent" value.


Steps to Reproduce:
1. In web ui, Create a parent host group and set the "Deploy On" to a compute resource. For example, "Brisbane Vcenter"
2. In web ui, Create a child host group and set the "Deploy On" to a different compute resource. For example, "Sydney Vcenter".
3. After creating the child host group. Edit the child host group, click the "Deploy on" select box

Actual results:
It is showing "Inherit parent (Sydney Vcenter)".

Expected results:
It should be showing "Inherit parent (Brisbane Vcenter)

Additional info:

Make the following change seems to fix the issue

--- a/helpers/form_helper.rb	2021-09-09 16:22:49.684921775 +1000
+++ b/helpers/form_helper.rb	2021-09-09 16:23:05.679076650 +1000
@@ -345,7 +345,7 @@
 
   def blank_or_inherit_f(f, attr, blank_value: _("no value"))
     return true unless f.object.respond_to?(:parent_id) && f.object.parent_id
-    inherited_value   = f.object.send(attr)
+    inherited_value   = f.object.respond_to?(:nested) ? f.object.nested(attr) : f.object.send(attr)
     inherited_value   = inherited_value.name_method if inherited_value.present? && inherited_value.respond_to?(:name_method)
     inherited_value ||= blank_value
     _("Inherit parent (%s)") % inherited_value


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