diff options
| author | Markus Roberts <Markus@reality.com> | 2010-01-01 23:28:19 -0800 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2010-01-02 19:51:06 +1100 |
| commit | cbc2ef003d93e5162979cebc927b5d9a69397439 (patch) | |
| tree | 84ac2d7ebe191bd34d45f0845bc9a0738931f331 /lib | |
| parent | fd631b9945cf33a1e5af849900cf6219b050e321 (diff) | |
| download | puppet-cbc2ef003d93e5162979cebc927b5d9a69397439.tar.gz puppet-cbc2ef003d93e5162979cebc927b5d9a69397439.tar.xz puppet-cbc2ef003d93e5162979cebc927b5d9a69397439.zip | |
Partial rollback of refinements to fix for #2994
The fix for #2994 had been refined to only checksum links when @links was set
to :follow to make the tests pass, but this caused partial reintroduction of
the original issue since information about the source (the real file vs.
followed link distinction) isn't available client side and thus there are
paths on which @links winds up :managed when it had originally been :followed.
In these cases the checksum is needed but not produced.
Consequently, this patch relaxes the condition, and always tries to produce a
checksum, with a rescue guard to gracefully handle cases where this is not
possible (e.g. broken links).
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/file_serving/metadata.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/puppet/file_serving/metadata.rb b/lib/puppet/file_serving/metadata.rb index 678a4ff42..6790c1a78 100644 --- a/lib/puppet/file_serving/metadata.rb +++ b/lib/puppet/file_serving/metadata.rb @@ -29,8 +29,8 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base desc << send(check) } - desc << checksum if ftype == 'file' or ftype == 'directory' or (ftype == 'link' and @links == :follow) - desc << @destination if ftype == 'link' and @links != :follow + desc << checksum + desc << @destination rescue nil if ftype == 'link' return desc.join("\t") end @@ -63,7 +63,7 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, path).to_s when "link" @destination = File.readlink(real_path) - @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, real_path).to_s if @links == :follow + @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, real_path).to_s rescue nil else raise ArgumentError, "Cannot manage files of type %s" % stat.ftype end |
