Issue #20408 has been updated by Erik Dalén.

it seems to me the default should be the union merge. Seems like most of the 
others would be rare cases where you would need them.

Of course the weight property of the facts should be taken into account when 
merging so that higher weight values take priority over lower weight ones in 
case two facts return values for the same thing.


Another way would be to allow facts to merge something at a lower level than 
the top. For example:

<pre>
Facter.add(:interfaces) do
  setcode do
    {
      :eth0 => {:ipaddress => '192.168.0.1},
      :lo => {:ipaddress => '127.0.0.1'},
    }
  end
end

Facter add(:"interfaces::eth0") do
  setcode do
    { :macaddress => '00:00:00:00:00:00' }
  end
end
</pre>

In this case the macaddress would be merged into the eth0 key in the interfaces 
hash. Not sure about reusing the :: notation here though :)

----------------------------------------
Feature #20408: Should be possible to merge structured facts
https://projects.puppetlabs.com/issues/20408#change-95378

* Author: Erik Dalén
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 2.0.0
* Keywords: structured facts hash
* Branch: 
* Affected Facter version: 
----------------------------------------
To be able to extend one structured fact with more data it should be possible 
to deep merge two facts.

For example it there was a "interfaces" hash containing network interfaces and 
info about them and you wanted to add LLDP information to them you could add 
another interfaces fact that would get deep merged with the original one.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to