Multiple overrides in inherited Host Groups causing multiple values on host.
After upgrading to 1.7.0 I have some hosts inside nested Host Groups who are either getting incorrect override values, or are getting multiple values for overrides.
/Base/Webfarm has override for class parameter _attributes in class opsview::monitored
/Base/Webfarm/Backup has override for the same parameter with a different value.
Hosts in /Base/Webfarm/Backup will get the override parameter from /Base/Webfarm.
If the setting "Merge overrides" is checked, then the hosts will get both override values from Base/Webfarm and base/Webfarm/Backup
The duplicate behavior occurs regardless of the "Avoid duplicates" setting as well.
Here is a Pastebin of the YAML for a host with both values for the parameter VCENTER: http://pastebin.com/c3uhFVm4
The value is overridden to 'vcenter' in Base/Webfarm and overridden to 'test-vcenter' in Base/Webfarm/Backup
Please let me know if I can provide any further information to help with the issue.
Fixes #8551 - use most specific matcher for inherited hostgroups
Host recieves correct smart_class_parameter value when multiple overrides for
inherited host groups exist for parameter.
#1 Updated by Ori Rabin over 6 years ago
- Category set to Parameters
- Status changed from New to Need more information
I would appreciate if you can provide some more information for the two problems you mentioned:
1) Hosts in /Base/Webfarm/Backup will get the override parameter from /Base/Webfarm
can you please provide the order of overrides and the matchers with their values?
2) The duplication - it looks from the yaml that you have a parameter "_attributes" that is an array and the elements in it are hashes?
I'm trying to understand how exactly the values look like.
Avoid duplicates is used so if you have [name: a] twice you will only see one of them.
If your elements are [name: a] and [name: b] then it isn't a duplicate value.
Can you please send the values of the overrides for VCENTER as they appear in the "value" box in "_attributes"?
#3 Updated by Dominic Cleal over 6 years ago
- Status changed from Need more information to New
I could reproduce this quite easily with a similar setup to the one that Matthew describes:
- Three host groups: Base, Base/Webfarm, Base/Webfarm/Backup
- Base environment set, others inherit
- 'monitor' Puppet class with one $_attributes parameter, defaults to 
- monitor Puppet class assigned to Base host group
- $_attributes parameter set to 'array' type
- hostgroup=Base/Webfarm matcher with value
- hostgroup=Base/Webfarm/Backup matcher with value
- one host with host group set to Base/Webfarm/Backup
Everything else is "default", i.e. no changes to parameter defaults, no merging or anything enabled. Then if I preview the YAML, I see:
--- classes: monitor: _attributes: - name: VCENTER value: vcenter parameters: puppetmaster: foreman.example.com hostgroup: Base/Webfarm/Backup
#8 Updated by Dominic Cleal about 6 years ago
Dominic Cleal wrote:
It seems to just match anything. If I add fqdn=foobar (not its name) with another value, my host gets that new value.
This is incorrect, I can't replicate it and it doesn't make sense from the code. The issue is just when two overrides exist for two host groups within the same hierarchy - it's not preferring the more specific host group match.