summaryrefslogtreecommitdiffstats
path: root/lib/puppet/file_serving
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/file_serving')
-rw-r--r--lib/puppet/file_serving/base.rb2
-rw-r--r--lib/puppet/file_serving/configuration.rb8
-rw-r--r--lib/puppet/file_serving/configuration/parser.rb16
-rw-r--r--lib/puppet/file_serving/fileset.rb4
-rw-r--r--lib/puppet/file_serving/indirection_hooks.rb2
-rw-r--r--lib/puppet/file_serving/metadata.rb10
-rw-r--r--lib/puppet/file_serving/mount.rb4
-rw-r--r--lib/puppet/file_serving/mount/file.rb6
8 files changed, 26 insertions, 26 deletions
diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb
index 3543df8d7..8e55f742a 100644
--- a/lib/puppet/file_serving/base.rb
+++ b/lib/puppet/file_serving/base.rb
@@ -38,7 +38,7 @@ class Puppet::FileServing::Base
begin
send param.to_s + "=", value
rescue NoMethodError
- raise ArgumentError, "Invalid option %s for %s" % [param, self.class]
+ raise ArgumentError, "Invalid option #{param} for #{self.class}"
end
end
end
diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb
index 9034caed1..69b1f9329 100644
--- a/lib/puppet/file_serving/configuration.rb
+++ b/lib/puppet/file_serving/configuration.rb
@@ -41,7 +41,7 @@ class Puppet::FileServing::Configuration
end
if environment.module(mount_name)
- Puppet::Util::Warnings.notice_once "DEPRECATION NOTICE: Files found in modules without specifying 'modules' in file path will be deprecated in the next major release. Please fix module '%s' when no 0.24.x clients are present" % mount_name
+ Puppet::Util::Warnings.notice_once "DEPRECATION NOTICE: Files found in modules without specifying 'modules' in file path will be deprecated in the next major release. Please fix module '#{mount_name}' when no 0.24.x clients are present"
return mounts["modules"]
end
@@ -70,12 +70,12 @@ class Puppet::FileServing::Configuration
mount_name, path = request.key.split(File::Separator, 2)
- raise(ArgumentError, "Cannot find file: Invalid path '%s'" % mount_name) unless mount_name =~ %r{^[-\w]+$}
+ raise(ArgumentError, "Cannot find file: Invalid path '#{mount_name}'") unless mount_name =~ %r{^[-\w]+$}
return nil unless mount = find_mount(mount_name, request.environment)
if mount.name == "modules" and mount_name != "modules"
# yay backward-compatibility
- path = "%s/%s" % [mount_name, path]
+ path = "#{mount_name}/#{path}"
end
if path == ""
@@ -119,7 +119,7 @@ class Puppet::FileServing::Configuration
@mounts = newmounts
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Error parsing fileserver configuration: %s; using old configuration" % detail
+ Puppet.err "Error parsing fileserver configuration: #{detail}; using old configuration"
end
ensure
diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb
index d8bf30477..f40a554e3 100644
--- a/lib/puppet/file_serving/configuration/parser.rb
+++ b/lib/puppet/file_serving/configuration/parser.rb
@@ -7,8 +7,8 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# Parse our configuration file.
def parse
- raise("File server configuration %s does not exist" % self.file) unless FileTest.exists?(self.file)
- raise("Cannot read file server configuration %s" % self.file) unless FileTest.readable?(self.file)
+ raise("File server configuration #{self.file} does not exist") unless FileTest.exists?(self.file)
+ raise("Cannot read file server configuration #{self.file}") unless FileTest.readable?(self.file)
@mounts = {}
@count = 0
@@ -36,10 +36,10 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
when "deny"
deny(mount, value)
else
- raise ArgumentError.new("Invalid argument '%s'" % var, @count, file)
+ raise ArgumentError.new("Invalid argument '#{var}'", @count, file)
end
else
- raise ArgumentError.new("Invalid line '%s'" % line.chomp, @count, file)
+ raise ArgumentError.new("Invalid line '#{line.chomp}'", @count, file)
end
}
}
@@ -56,7 +56,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = value.split(/\s*,\s*/).each { |val|
begin
- mount.info "allowing %s access" % val
+ mount.info "allowing #{val} access"
mount.allow(val)
rescue AuthStoreError => detail
@@ -73,7 +73,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = value.split(/\s*,\s*/).each { |val|
begin
- mount.info "denying %s access" % val
+ mount.info "denying #{val} access"
mount.deny(val)
rescue AuthStoreError => detail
@@ -88,7 +88,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# Create a new mount.
def newmount(name)
if @mounts.include?(name)
- raise ArgumentError, "%s is already mounted at %s" % [@mounts[name], name], @count, file
+ raise ArgumentError, "#{@mounts[name]} is already mounted at #{name}", @count, file
end
case name
when "modules"
@@ -108,7 +108,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
begin
mount.path = value
rescue ArgumentError => detail
- Puppet.err "Removing mount %s: %s" % [mount.name, detail]
+ Puppet.err "Removing mount #{mount.name}: #{detail}"
@mounts.delete(mount.name)
end
else
diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb
index 41765164e..4155685d6 100644
--- a/lib/puppet/file_serving/fileset.rb
+++ b/lib/puppet/file_serving/fileset.rb
@@ -81,7 +81,7 @@ class Puppet::FileServing::Fileset
def links=(links)
links = links.to_sym
- raise(ArgumentError, "Invalid :links value '%s'" % links) unless [:manage, :follow].include?(links)
+ raise(ArgumentError, "Invalid :links value '#{links}'") unless [:manage, :follow].include?(links)
@links = links
@stat_method = links == :manage ? :lstat : :stat
end
@@ -99,7 +99,7 @@ class Puppet::FileServing::Fileset
begin
send(method, value)
rescue NoMethodError
- raise ArgumentError, "Invalid option '%s'" % option
+ raise ArgumentError, "Invalid option '#{option}'"
end
end
end
diff --git a/lib/puppet/file_serving/indirection_hooks.rb b/lib/puppet/file_serving/indirection_hooks.rb
index 5fd7985e7..d1219f0c1 100644
--- a/lib/puppet/file_serving/indirection_hooks.rb
+++ b/lib/puppet/file_serving/indirection_hooks.rb
@@ -25,7 +25,7 @@ module Puppet::FileServing::IndirectionHooks
end
if request.protocol and PROTOCOL_MAP[request.protocol].nil?
- raise(ArgumentError, "URI protocol '%s' is not currently supported for file serving" % request.protocol)
+ raise(ArgumentError, "URI protocol '#{request.protocol}' is not currently supported for file serving")
end
# If we're still here, we're using the file_server or modules.
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
diff --git a/lib/puppet/file_serving/mount.rb b/lib/puppet/file_serving/mount.rb
index 7ee11a99b..420b6f73e 100644
--- a/lib/puppet/file_serving/mount.rb
+++ b/lib/puppet/file_serving/mount.rb
@@ -23,7 +23,7 @@ class Puppet::FileServing::Mount < Puppet::Network::AuthStore
# Create our object. It must have a name.
def initialize(name)
unless name =~ %r{^[-\w]+$}
- raise ArgumentError, "Invalid mount name format '%s'" % name
+ raise ArgumentError, "Invalid mount name format '#{name}'"
end
@name = name
@@ -35,7 +35,7 @@ class Puppet::FileServing::Mount < Puppet::Network::AuthStore
end
def to_s
- "mount[%s]" % @name
+ "mount[#{@name}]"
end
# A noop.
diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb
index 8a619e962..c876cc2c0 100644
--- a/lib/puppet/file_serving/mount/file.rb
+++ b/lib/puppet/file_serving/mount/file.rb
@@ -56,10 +56,10 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
@expandable = true
else
unless FileTest.directory?(path)
- raise ArgumentError, "%s does not exist or is not a directory" % path
+ raise ArgumentError, "#{path} does not exist or is not a directory"
end
unless FileTest.readable?(path)
- raise ArgumentError, "%s is not readable" % path
+ raise ArgumentError, "#{path} is not readable"
end
@expandable = false
end
@@ -96,7 +96,7 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
if node
map = clientmap(node)
else
- Puppet.notice "No client; expanding '%s' with local host" % path
+ Puppet.notice "No client; expanding '#{path}' with local host"
# Else, use the local information
map = localmap()
end