summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/type/file/content.rb2
-rwxr-xr-xlib/puppet/type/file/source.rb10
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 0d0bb5571..f5b65d3fd 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -166,6 +166,8 @@ module Puppet
yield source_or_content
elsif source_or_content.nil?
yield read_file_from_filebucket
+ elsif Puppet.settings[:name] == "apply"
+ yield source_or_content.content
elsif source_or_content.local?
chunk_file_from_disk(source_or_content) { |chunk| yield chunk }
else
diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb
index 0e7aac72d..7d03de2b0 100755
--- a/lib/puppet/type/file/source.rb
+++ b/lib/puppet/type/file/source.rb
@@ -94,6 +94,16 @@ module Puppet
metadata && metadata.checksum
end
+ # Look up (if necessary) and return remote content.
+ cached_attr(:content) do
+ raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source
+
+ unless tmp = Puppet::FileServing::Content.find(metadata.source)
+ fail "Could not find any content at %s" % metadata.source
+ end
+ tmp.content
+ end
+
# Copy the values from the source to the resource. Yay.
def copy_source_values
devfail "Somehow got asked to copy source values without any metadata" unless metadata