diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-08 21:18:43 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-08 21:18:43 +0000 |
commit | 10d68915c513ca9aa69862d17111acbf9ff87164 (patch) | |
tree | 1774f61dd5528c8c6d7e5270cabf264948fba95d /lib | |
parent | 4fa800805dc87a84c2af6281305e6015c44207e9 (diff) | |
download | puppet-10d68915c513ca9aa69862d17111acbf9ff87164.tar.gz puppet-10d68915c513ca9aa69862d17111acbf9ff87164.tar.xz puppet-10d68915c513ca9aa69862d17111acbf9ff87164.zip |
Adding support for a prefetch hook on individual providers, rather than only supporting it for the whole class.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2275 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/metatype/evaluation.rb | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/lib/puppet/metatype/evaluation.rb b/lib/puppet/metatype/evaluation.rb index 746375d49..58f316e2c 100644 --- a/lib/puppet/metatype/evaluation.rb +++ b/lib/puppet/metatype/evaluation.rb @@ -12,7 +12,9 @@ class Puppet::Type end @evalcount += 1 - changes = [] + if p = self.provider and p.respond_to?(:prefetch) + p.prefetch + end # this only operates on properties, not properties + children # it's important that we call retrieve() on the type instance, @@ -20,22 +22,7 @@ class Puppet::Type # the method, like pfile does self.retrieve - # properties() is a private method, returning an ordered list - unless self.class.depthfirst? - changes += propertychanges() - end - - changes << @children.collect { |child| - ch = child.evaluate - child.cache(:checked, Time.now) - ch - } - - if self.class.depthfirst? - changes += propertychanges() - end - - changes.flatten! + changes = propertychanges().flatten # now record how many changes we've resulted in if changes.length > 0 @@ -46,7 +33,8 @@ class Puppet::Type return changes.flatten end - # By default, try flushing the provider. + # Flush the provider, if it supports it. This is called by the + # transaction. def flush if self.provider and self.provider.respond_to?(:flush) self.provider.flush |