diff options
author | Luke Kaines <luke@puppetlabs.com> | 2011-06-06 15:33:49 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-06-06 15:33:49 -0700 |
commit | d4e6c268aecabdbf36ece126f960ce2384576fcc (patch) | |
tree | d37faff4111c7a1bcef9ea48d59687ab3d2a5718 | |
parent | c5448b79e690d72536f4d98b636f450d37de627a (diff) | |
download | puppet-d4e6c268aecabdbf36ece126f960ce2384576fcc.tar.gz puppet-d4e6c268aecabdbf36ece126f960ce2384576fcc.tar.xz puppet-d4e6c268aecabdbf36ece126f960ce2384576fcc.zip |
(#7624) Manually fetch all properties in instances.
When we removed the `:audit => :all` flag on creation of an instance from a
Puppet type, we stopped fetching all the properties. This had flow-on
consequences that were visible from the outside; while some places did their
own work to ensure that properties were fetched, others didn't.
We now open-code the loop that creates and fetches those properties, to ensure
that we have the same data without going through the :audit machinery.
This resolves the excessive logging, and also eliminates the behavioural
change that we introduced in the previous commit.
Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
-rw-r--r-- | lib/puppet/type.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 586bb46f6..558491a7f 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -876,6 +876,12 @@ class Type # Put the default provider first, then the rest of the suitable providers. provider_instances = {} providers_by_source.collect do |provider| + all_properties = self.properties.find_all do |property| + provider.supports_parameter?(property) + end.collect do |property| + property.name + end + provider.instances.collect do |instance| # We always want to use the "first" provider instance we find, unless the resource # is already managed and has a different provider set @@ -886,7 +892,9 @@ class Type end provider_instances[instance.name] = instance - new(:name => instance.name, :provider => instance) + result = new(:name => instance.name, :provider => instance) + properties.each { |name| result.newattr(name) } + result end end.flatten.compact end |