diff options
Diffstat (limited to 'lib/puppet/file_serving/metadata.rb')
-rw-r--r-- | lib/puppet/file_serving/metadata.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/puppet/file_serving/metadata.rb b/lib/puppet/file_serving/metadata.rb index 848a5f963..697de1055 100644 --- a/lib/puppet/file_serving/metadata.rb +++ b/lib/puppet/file_serving/metadata.rb @@ -36,7 +36,7 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base end def checksum_type=(type) - raise(ArgumentError, "Unsupported checksum type %s" % type) unless respond_to?("%s_file" % type) + raise(ArgumentError, "Unsupported checksum type #{type}") unless respond_to?("#{type}_file") @checksum_type = type end @@ -57,15 +57,15 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base case stat.ftype when "file" - @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, real_path).to_s + @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s when "directory" # Always just timestamp the directory. @checksum_type = "ctime" - @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, path).to_s + @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", path).to_s when "link" @destination = File.readlink(real_path) - @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, real_path).to_s rescue nil + @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s rescue nil else - raise ArgumentError, "Cannot manage files of type %s" % stat.ftype + raise ArgumentError, "Cannot manage files of type #{stat.ftype}" end end |