Project

General

Profile

Actions

Bug #8551

closed

Multiple overrides in inherited Host Groups causing multiple values on host.

Added by Matthew Little over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

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.
Example:
Host Group:
/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.

Actions #1

Updated by Ori Rabin over 9 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"?

Actions #2

Updated by Dominic Cleal over 9 years ago

  • translation missing: en.field_release set to 29

Just adding to the 1.7.1 tracker as this sounds like a regression.

Actions #3

Updated by Dominic Cleal over 9 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:

  1. Three host groups: Base, Base/Webfarm, Base/Webfarm/Backup
  2. Base environment set, others inherit
  3. 'monitor' Puppet class with one $_attributes parameter, defaults to []
  4. monitor Puppet class assigned to Base host group
  5. $_attributes parameter set to 'array' type
  6. hostgroup=Base/Webfarm matcher with value [{"name":"VCENTER","value":"vcenter"}]
  7. hostgroup=Base/Webfarm/Backup matcher with value [{"name":"VCENTER","value":"test-vcenter"}]
  8. 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
Actions #4

Updated by Dominic Cleal over 9 years ago

Arrays and hashes seem irrelevant too, I can reproduce it with a string data type and the same matchers.

Actions #5

Updated by Dominic Cleal over 9 years ago

It seems to just match anything. If I add fqdn=foobar (not its name) with another value, my host gets that new value.

Actions #6

Updated by Ori Rabin over 9 years ago

  • Assignee set to Ori Rabin
Actions #7

Updated by The Foreman Bot over 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1996 added
  • Pull request deleted ()
Actions #8

Updated by Dominic Cleal over 9 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.

Actions #9

Updated by Ori Rabin over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF