Bug 1010575 - [RFE] Support deep merging of hash structures in smart class parameters
[RFE] Support deep merging of hash structures in smart class parameters
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Provisioning (Show other bugs)
6.0.1
Unspecified Unspecified
low Severity low (vote)
: Unspecified
: --
Assigned To: orabin
Tazim Kolhar
http://projects.theforeman.org/issues...
: FutureFeature, Triaged
: 1175885 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-21 13:16 EDT by Dominic Cleal
Modified: 2017-02-23 16:19 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-12 01:07:35 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dominic Cleal 2013-09-21 13:16:57 EDT
Description of problem:
When storing complex hashes in smart variables/class parameters (i.e. JSON/YAML), the matchers simply override previous values with a certain precedence order.

Instead, we want to be able to deep merge data across the matchers, so a hash can be built up with a culmination of data.

Steps to Reproduce:
1. set a parameter/variable matcher order to "fqdn", "hostgroup", set data type to JSON
2. add an override of "hostgroup=Example" (change as appropriate), value: {"example":{"foo":"bar"}}
3. add an override of "fqdn=foo.example.com" (change), value: {"example":{"bar":"baz"}}
4. check YAML output on foo.example.com's host page

Actual results:
example:
  bar: baz

Expected results:
example:
  foo: bar
  bar: baz

Additional info:
http://www.theforeman.org/manuals/1.2/index.html#4.2.5ParameterizedClasses
http://www.youtube.com/watch?v=Ksr0tilbmcc
Comment 3 Dominic Cleal 2013-09-22 14:58:52 EDT
We should probably do the same for arrays too, e.g.

admin_users = []

hostgroup = [user1, user2]
location  = [user3, user4]

admin users = [user(1..4)]

(thanks Ohad)
Comment 6 Bryan Kearney 2014-10-22 08:01:20 EDT
Moving to POST since upstream bug http://projects.theforeman.org/issues/3309 has been closed
-------------
Ori Rabin
Applied in changeset commit:ea4eec44b30b977bfd863d47b4fe3dd248816673.
Comment 9 Tazim Kolhar 2015-03-31 10:01:32 EDT
please provide verification steps
thanks
Comment 10 orabin 2015-03-31 10:53:19 EDT
Tazim, besides the deep dive I sent you these are some of the things that need varification:
- The steps to reproduce from the beginning using the type 'hash' for the variable/parameter
- The merge override button is only enabled for array/hash parameter type
- The avoid duplicates is only available for arrays
- Using "avoid duplicates": use the steps from the beginning with the values ['a'] for both matchers
Comment 11 Tazim Kolhar 2015-04-01 08:01:34 EDT
VERIFIED :

# rpm -qa | grep foreman
foreman-postgresql-1.7.2.15-1.el6_6sat.noarch
foreman-ovirt-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.3-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.5-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.7-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.3-1.el6_6sat.noarch
foreman-1.7.2.15-1.el6_6sat.noarch
foreman-gce-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
foreman-debug-1.7.2.15-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.4-1.el6_6sat.noarch
foreman-selinux-1.7.2.13-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-1.0-2.noarch
foreman-compute-1.7.2.15-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.7-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.9-1.el6_6sat.noarch
foreman-libvirt-1.7.2.15-1.el6_6sat.noarch
foreman-proxy-1.7.2.4-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
foreman-vmware-1.7.2.15-1.el6_6sat.noarch

able to select parameters with Override enable
the merge override button is only enabled for array/hash parameter type
the avoid duplicates is only available for arrays
Comment 12 Bryan Kearney 2015-04-14 17:08:21 EDT
*** Bug 1175885 has been marked as a duplicate of this bug. ***
Comment 13 Bryan Kearney 2015-08-11 09:33:40 EDT
This bug is slated to be released with Satellite 6.1.
Comment 14 errata-xmlrpc 2015-08-12 01:07:35 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.

https://access.redhat.com/errata/RHSA-2015:1592

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