diff options
Diffstat (limited to 'lib/puppet')
-rwxr-xr-x | lib/puppet/type/file/content.rb | 12 | ||||
-rwxr-xr-x | lib/puppet/type/file/source.rb | 14 |
2 files changed, 11 insertions, 15 deletions
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index b6c671b98..cc2494b00 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -96,17 +96,9 @@ module Puppet end return true if ! @resource.replace? + return true unless self.should - if self.should - result = super - elsif source = resource.parameter(:source) - fail "Got a remote source with no checksum" unless source.checksum - result = (is == source.checksum) - else - # We've got no content specified, and no source from which to - # get content. - return true - end + result = super if ! result and Puppet[:show_diff] string_file_diff(@resource[:path], actual_content) diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index 838dabb27..7eb3d019a 100755 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -112,11 +112,15 @@ module Puppet # Take each of the stats and set them as states on the local file # if a value has not already been provided. - [:owner, :mode, :group, :checksum].each do |param| - next if param == :owner and Puppet::Util::SUIDManager.uid != 0 - next if param == :checksum and metadata.ftype == "directory" - unless value = resource[param] and value != :absent - resource[param] = metadata.send(param) + [:owner, :mode, :group, :checksum].each do |metadata_method| + param_name = (metadata_method == :checksum) ? :content : metadata_method + next if metadata_method == :owner and Puppet::Util::SUIDManager.uid != 0 + next if metadata_method == :checksum and metadata.ftype == "directory" + + if resource[param_name].nil? or resource[param_name] == :absent + v = metadata.send(metadata_method) + resource.info "Setting #{param_name} to #{v}" + resource[param_name] = metadata.send(metadata_method) end end |