summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/ast.rb2
-rw-r--r--lib/puppet/parser/ast/arithmetic_operator.rb6
-rw-r--r--lib/puppet/parser/ast/boolean_operator.rb2
-rw-r--r--lib/puppet/parser/ast/branch.rb2
-rw-r--r--lib/puppet/parser/ast/collexpr.rb7
-rw-r--r--lib/puppet/parser/ast/comparison_operator.rb2
-rw-r--r--lib/puppet/parser/ast/function.rb10
-rw-r--r--lib/puppet/parser/ast/leaf.rb4
-rw-r--r--lib/puppet/parser/ast/match_operator.rb2
-rw-r--r--lib/puppet/parser/ast/minus.rb2
-rw-r--r--lib/puppet/parser/ast/resource_override.rb2
-rw-r--r--lib/puppet/parser/ast/selector.rb2
-rw-r--r--lib/puppet/parser/collector.rb8
-rw-r--r--lib/puppet/parser/compiler.rb8
-rw-r--r--lib/puppet/parser/functions.rb16
-rw-r--r--lib/puppet/parser/functions/file.rb2
-rw-r--r--lib/puppet/parser/functions/include.rb2
-rw-r--r--lib/puppet/parser/functions/inline_template.rb2
-rw-r--r--lib/puppet/parser/functions/require.rb2
-rw-r--r--lib/puppet/parser/functions/split.rb2
-rw-r--r--lib/puppet/parser/functions/template.rb4
-rw-r--r--lib/puppet/parser/lexer.rb4
-rw-r--r--lib/puppet/parser/parser_support.rb12
-rw-r--r--lib/puppet/parser/resource.rb10
-rw-r--r--lib/puppet/parser/resource/param.rb2
-rw-r--r--lib/puppet/parser/scope.rb20
-rw-r--r--lib/puppet/parser/templatewrapper.rb6
-rw-r--r--lib/puppet/parser/type_loader.rb2
28 files changed, 72 insertions, 73 deletions
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index f407c78d6..dffc30a8a 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -46,7 +46,7 @@ class Puppet::Parser::AST
# of the contained children and evaluates them in turn, returning a
# list of all of the collected values, rejecting nil values
def evaluate(*options)
- raise Puppet::DevError, "Did not override #evaluate in %s" % self.class
+ raise Puppet::DevError, "Did not override #evaluate in #{self.class}"
end
# Throw a parse error.
diff --git a/lib/puppet/parser/ast/arithmetic_operator.rb b/lib/puppet/parser/ast/arithmetic_operator.rb
index 8d9cef86a..b4c0215cc 100644
--- a/lib/puppet/parser/ast/arithmetic_operator.rb
+++ b/lib/puppet/parser/ast/arithmetic_operator.rb
@@ -18,12 +18,12 @@ class Puppet::Parser::AST
lval = @lval.safeevaluate(scope)
lval = Puppet::Parser::Scope.number?(lval)
if lval == nil
- raise ArgumentError, "left operand of %s is not a number" % @operator
+ raise ArgumentError, "left operand of #{@operator} is not a number"
end
rval = @rval.safeevaluate(scope)
rval = Puppet::Parser::Scope.number?(rval)
if rval == nil
- raise ArgumentError, "right operand of %s is not a number" % @operator
+ raise ArgumentError, "right operand of #{@operator} is not a number"
end
# compute result
@@ -34,7 +34,7 @@ class Puppet::Parser::AST
super
unless %w{+ - * / << >>}.include?(@operator)
- raise ArgumentError, "Invalid arithmetic operator %s" % @operator
+ raise ArgumentError, "Invalid arithmetic operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/boolean_operator.rb b/lib/puppet/parser/ast/boolean_operator.rb
index 89725d73b..9214afbd5 100644
--- a/lib/puppet/parser/ast/boolean_operator.rb
+++ b/lib/puppet/parser/ast/boolean_operator.rb
@@ -41,7 +41,7 @@ class Puppet::Parser::AST
super
unless %w{and or}.include?(@operator)
- raise ArgumentError, "Invalid boolean operator %s" % @operator
+ raise ArgumentError, "Invalid boolean operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/branch.rb b/lib/puppet/parser/ast/branch.rb
index 0c481ffe6..c0fa0da30 100644
--- a/lib/puppet/parser/ast/branch.rb
+++ b/lib/puppet/parser/ast/branch.rb
@@ -31,7 +31,7 @@ class Puppet::Parser::AST
@children.each { |child|
unless child.is_a?(AST)
raise Puppet::DevError,
- "child %s is a %s instead of ast" % [child, child.class]
+ "child #{child} is a #{child.class} instead of ast"
end
}
end
diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb
index eae2b0e42..95fb5a94f 100644
--- a/lib/puppet/parser/ast/collexpr.rb
+++ b/lib/puppet/parser/ast/collexpr.rb
@@ -68,11 +68,10 @@ class CollExpr < AST::Branch
when "tag"
str = "puppet_tags.name #{oper} '#{str2}'"
else
- str = "param_values.value #{oper} '#{str2}' and " +
- "param_names.name = '#{str1}'"
+ str = "param_values.value #{oper} '#{str2}' and param_names.name = '#{str1}'"
end
else
- str = "(%s) %s (%s)" % [str1, oper, str2]
+ str = "(#{str1}) #{oper} (#{str2})"
end
return str, code
@@ -82,7 +81,7 @@ class CollExpr < AST::Branch
super
unless %w{== != and or}.include?(@oper)
- raise ArgumentError, "Invalid operator %s" % @oper
+ raise ArgumentError, "Invalid operator #{@oper}"
end
end
end
diff --git a/lib/puppet/parser/ast/comparison_operator.rb b/lib/puppet/parser/ast/comparison_operator.rb
index 0d2f8b16d..85903ec31 100644
--- a/lib/puppet/parser/ast/comparison_operator.rb
+++ b/lib/puppet/parser/ast/comparison_operator.rb
@@ -34,7 +34,7 @@ class Puppet::Parser::AST
super
unless %w{== != < > <= >=}.include?(@operator)
- raise ArgumentError, "Invalid comparison operator %s" % @operator
+ raise ArgumentError, "Invalid comparison operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/function.rb b/lib/puppet/parser/ast/function.rb
index 98204b14a..c3769cbd4 100644
--- a/lib/puppet/parser/ast/function.rb
+++ b/lib/puppet/parser/ast/function.rb
@@ -14,28 +14,28 @@ class Puppet::Parser::AST
# Make sure it's a defined function
unless Puppet::Parser::Functions.function(@name)
- raise Puppet::ParseError, "Unknown function %s" % @name
+ raise Puppet::ParseError, "Unknown function #{@name}"
end
# Now check that it's been used correctly
case @ftype
when :rvalue
unless Puppet::Parser::Functions.rvalue?(@name)
- raise Puppet::ParseError, "Function '%s' does not return a value" % @name
+ raise Puppet::ParseError, "Function '#{@name}' does not return a value"
end
when :statement
if Puppet::Parser::Functions.rvalue?(@name)
raise Puppet::ParseError,
- "Function '%s' must be the value of a statement" % @name
+ "Function '#{@name}' must be the value of a statement"
end
else
- raise Puppet::DevError, "Invalid function type %s" % @ftype.inspect
+ raise Puppet::DevError, "Invalid function type #{@ftype.inspect}"
end
# We don't need to evaluate the name, because it's plaintext
args = @arguments.safeevaluate(scope)
- return scope.send("function_" + @name, args)
+ return scope.send("function_#{@name}", args)
end
def initialize(hash)
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index 30c4a958f..6ef346123 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -40,7 +40,7 @@ class Puppet::Parser::AST
unless @value == true or @value == false
raise Puppet::DevError,
- "'%s' is not a boolean" % @value
+ "'#{@value}' is not a boolean"
end
@value
end
@@ -108,7 +108,7 @@ class Puppet::Parser::AST
@value = @value.to_s.downcase unless @value.is_a?(Regex)
if @value =~ /[^-\w.]/
raise Puppet::DevError,
- "'%s' is not a valid hostname" % @value
+ "'#{@value}' is not a valid hostname"
end
end
diff --git a/lib/puppet/parser/ast/match_operator.rb b/lib/puppet/parser/ast/match_operator.rb
index 17e27826e..c528a90e5 100644
--- a/lib/puppet/parser/ast/match_operator.rb
+++ b/lib/puppet/parser/ast/match_operator.rb
@@ -24,7 +24,7 @@ class Puppet::Parser::AST
super
unless %w{!~ =~}.include?(@operator)
- raise ArgumentError, "Invalid regexp operator %s" % @operator
+ raise ArgumentError, "Invalid regexp operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/minus.rb b/lib/puppet/parser/ast/minus.rb
index b0779a8ee..52d158e0b 100644
--- a/lib/puppet/parser/ast/minus.rb
+++ b/lib/puppet/parser/ast/minus.rb
@@ -15,7 +15,7 @@ class Puppet::Parser::AST
val = @value.safeevaluate(scope)
val = Puppet::Parser::Scope.number?(val)
if val == nil
- raise ArgumentError, "minus operand %s is not a number" % val
+ raise ArgumentError, "minus operand #{val} is not a number"
end
return -val
end
diff --git a/lib/puppet/parser/ast/resource_override.rb b/lib/puppet/parser/ast/resource_override.rb
index f667ed23a..f9071fe96 100644
--- a/lib/puppet/parser/ast/resource_override.rb
+++ b/lib/puppet/parser/ast/resource_override.rb
@@ -13,7 +13,7 @@ class Puppet::Parser::AST
# Iterate across all of our children.
def each
[@object,@parameters].flatten.each { |param|
- #Puppet.debug("yielding param %s" % param)
+ #Puppet.debug("yielding param #{param}")
yield param
}
end
diff --git a/lib/puppet/parser/ast/selector.rb b/lib/puppet/parser/ast/selector.rb
index 647bdcde1..8eb930cc4 100644
--- a/lib/puppet/parser/ast/selector.rb
+++ b/lib/puppet/parser/ast/selector.rb
@@ -34,7 +34,7 @@ class Puppet::Parser::AST
# Unless we found something, look for the default.
return default.value.safeevaluate(scope) if default
- self.fail Puppet::ParseError, "No matching value for selector param '%s'" % paramvalue
+ self.fail Puppet::ParseError, "No matching value for selector param '#{paramvalue}'"
ensure
scope.unset_ephemeral_var(level)
end
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb
index 9283d06ae..3f1432af2 100644
--- a/lib/puppet/parser/collector.rb
+++ b/lib/puppet/parser/collector.rb
@@ -80,7 +80,7 @@ class Puppet::Parser::Collector
@equery = equery
@vquery = vquery
- raise(ArgumentError, "Invalid query form %s" % form) unless [:exported, :virtual].include?(form)
+ raise(ArgumentError, "Invalid query form #{form}") unless [:exported, :virtual].include?(form)
@form = form
end
@@ -106,7 +106,7 @@ class Puppet::Parser::Collector
search = "(exported=? AND restype=?)"
values = [true, @type]
- search += " AND (%s)" % @equery if @equery
+ search += " AND (#{@equery})" if @equery
# note:
# we're not eagerly including any relations here because
@@ -125,7 +125,7 @@ class Puppet::Parser::Collector
# We're going to collect objects from rails, but we don't want any
# objects from this host.
- search = ("host_id != ? AND %s" % search) and values.unshift(host.id) if host
+ search = ("host_id != ? AND #{search}") and values.unshift(host.id) if host
query[:conditions] = [search, *values]
@@ -207,7 +207,7 @@ class Puppet::Parser::Collector
return nil if existing.rails_id == obj.id
# This is the one we've already collected
- raise Puppet::ParseError, "Exported resource %s cannot override local resource" % [obj.ref]
+ raise Puppet::ParseError, "Exported resource #{obj.ref} cannot override local resource"
end
resource = obj.to_resource(self.scope)
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index e64ec4ba3..a2186b2c9 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -158,7 +158,7 @@ class Puppet::Parser::Compiler
resource.evaluate unless lazy_evaluate
found << name
else
- Puppet.info "Could not find class %s for %s" % [name, node.name]
+ Puppet.info "Could not find class #{name} for #{node.name}"
@catalog.tag(name)
end
end
@@ -181,7 +181,7 @@ class Puppet::Parser::Compiler
begin
send(param.to_s + "=", value)
rescue NoMethodError
- raise ArgumentError, "Compiler objects do not accept %s" % param
+ raise ArgumentError, "Compiler objects do not accept #{param}"
end
end
@@ -222,7 +222,7 @@ class Puppet::Parser::Compiler
end
unless (astnode ||= known_resource_types.node("default"))
- raise Puppet::ParseError, "Could not find default node or by name with '%s'" % node.names.join(", ")
+ raise Puppet::ParseError, "Could not find default node or by name with '#{node.names.join(", ")}'"
end
# Create a resource to model this node, and then add it to the list
@@ -355,7 +355,7 @@ class Puppet::Parser::Compiler
end
unless remaining.empty?
- raise Puppet::ParseError, "Failed to realize virtual resources %s" % remaining.join(', ')
+ raise Puppet::ParseError, "Failed to realize virtual resources #{remaining.join(', ')}"
end
end
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index a99e8dc95..5b07a9c09 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -41,16 +41,16 @@ module Puppet::Parser::Functions
name = symbolize(name)
if functions.include?(name)
- raise Puppet::DevError, "Function %s already defined" % name
+ raise Puppet::DevError, "Function #{name} already defined"
end
ftype = options[:type] || :statement
unless ftype == :statement or ftype == :rvalue
- raise Puppet::DevError, "Invalid statement type %s" % ftype.inspect
+ raise Puppet::DevError, "Invalid statement type #{ftype.inspect}"
end
- fname = "function_" + name.to_s
+ fname = "function_#{name}"
environment_module.send(:define_method, fname, &block)
# Someday we'll support specifying an arity, but for now, nope
@@ -66,12 +66,12 @@ module Puppet::Parser::Functions
name = symbolize(name)
unless functions.include? name
- raise Puppet::DevError, "Function %s is not defined" % name
+ raise Puppet::DevError, "Function #{name} is not defined"
end
functions.delete name
- fname = "function_" + name.to_s
+ fname = "function_#{name}"
environment_module.send(:remove_method, fname)
end
@@ -92,15 +92,15 @@ module Puppet::Parser::Functions
ret = ""
functions.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, hash|
- #ret += "%s\n%s\n" % [name, hash[:type]]
- ret += "%s\n%s\n" % [name, "-" * name.to_s.length]
+ #ret += "#{name}\n#{hash[:type]}\n"
+ ret += "#{name}\n#{"-" * name.to_s.length}\n"
if hash[:doc]
ret += Puppet::Util::Docs.scrub(hash[:doc])
else
ret += "Undocumented.\n"
end
- ret += "\n\n- **Type**: %s\n\n" % hash[:type]
+ ret += "\n\n- **Type**: #{hash[:type]}\n\n"
end
return ret
diff --git a/lib/puppet/parser/functions/file.rb b/lib/puppet/parser/functions/file.rb
index f78823d3a..d13b01ede 100644
--- a/lib/puppet/parser/functions/file.rb
+++ b/lib/puppet/parser/functions/file.rb
@@ -18,6 +18,6 @@
if ret
ret
else
- raise Puppet::ParseError, "Could not find any files from %s" % vals.join(", ")
+ raise Puppet::ParseError, "Could not find any files from #{vals.join(", ")}"
end
end
diff --git a/lib/puppet/parser/functions/include.rb b/lib/puppet/parser/functions/include.rb
index 213a04136..a8b6f175b 100644
--- a/lib/puppet/parser/functions/include.rb
+++ b/lib/puppet/parser/functions/include.rb
@@ -19,7 +19,7 @@ Puppet::Parser::Functions::newfunction(:include, :doc => "Evaluate one or more c
str += " " + missing.join(", ")
if n = namespaces and ! n.empty? and n != [""]
- str += " in namespaces %s" % @namespaces.join(", ")
+ str += " in namespaces #{@namespaces.join(", ")}"
end
self.fail Puppet::ParseError, str
end
diff --git a/lib/puppet/parser/functions/inline_template.rb b/lib/puppet/parser/functions/inline_template.rb
index fde8006b4..6c0485d1e 100644
--- a/lib/puppet/parser/functions/inline_template.rb
+++ b/lib/puppet/parser/functions/inline_template.rb
@@ -14,7 +14,7 @@ Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :doc
wrapper.result(string)
rescue => detail
raise Puppet::ParseError,
- "Failed to parse inline template: %s" % [detail]
+ "Failed to parse inline template: #{detail}"
end
end.join("")
end
diff --git a/lib/puppet/parser/functions/require.rb b/lib/puppet/parser/functions/require.rb
index 45b89c77a..c5c4c851f 100644
--- a/lib/puppet/parser/functions/require.rb
+++ b/lib/puppet/parser/functions/require.rb
@@ -43,7 +43,7 @@ fail if used with earlier clients.
if classobj = find_hostclass(klass)
klass = classobj.name
else
- raise Puppet::ParseError, "Could not find class %s" % klass
+ raise Puppet::ParseError, "Could not find class #{klass}"
end
# This is a bit hackish, in some ways, but it's the only way
diff --git a/lib/puppet/parser/functions/split.rb b/lib/puppet/parser/functions/split.rb
index 405a5bc9a..c3466ba4a 100644
--- a/lib/puppet/parser/functions/split.rb
+++ b/lib/puppet/parser/functions/split.rb
@@ -23,7 +23,7 @@ way to do that for a single character is to enclose it in square
brackets.") do |args|
if args.length != 2
- raise Puppet::ParseError, ("split(): wrong number of arguments" + " (#{args.length}; must be 2)")
+ raise Puppet::ParseError, ("split(): wrong number of arguments (#{args.length}; must be 2)")
end
return args[0].split(Regexp.compile(args[1]))
diff --git a/lib/puppet/parser/functions/template.rb b/lib/puppet/parser/functions/template.rb
index 35c54c66a..6c4873efe 100644
--- a/lib/puppet/parser/functions/template.rb
+++ b/lib/puppet/parser/functions/template.rb
@@ -8,7 +8,7 @@ Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :doc =>
vals.collect do |file|
# Use a wrapper, so the template can't get access to the full
# Scope object.
- debug "Retrieving template %s" % file
+ debug "Retrieving template #{file}"
wrapper = Puppet::Parser::TemplateWrapper.new(self)
wrapper.file = file
@@ -16,7 +16,7 @@ Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :doc =>
wrapper.result
rescue => detail
raise Puppet::ParseError,
- "Failed to parse template %s: %s" % [file, detail]
+ "Failed to parse template #{file}: #{detail}"
end
end.join("")
end
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 5d1ce8bc7..b5eab9fc8 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -63,7 +63,7 @@ class Puppet::Parser::Lexer
# Create a new token.
def add_token(name, regex, options = {}, &block)
token = Token.new(regex, name)
- raise(ArgumentError, "Token %s already exists" % name) if @tokens.include?(name)
+ raise(ArgumentError, "Token #{name} already exists") if @tokens.include?(name)
@tokens[token.name] = token
if token.string
@string_tokens << token
@@ -487,7 +487,7 @@ class Puppet::Parser::Lexer
if @previous_token.name == :DEFINE
if indefine?
- msg = "Cannot nest definition %s inside %s" % [value, @indefine]
+ msg = "Cannot nest definition #{value} inside #{@indefine}"
self.indefine = false
raise Puppet::ParseError, msg
end
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 24ee5fab3..f2fd710cf 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -21,9 +21,9 @@ class Puppet::Parser::Parser
def addcontext(message, obj = nil)
obj ||= @lexer
- message += " on line %s" % obj.line
+ message += " on line #{obj.line}"
if file = obj.file
- message += " in file %s" % file
+ message += " in file #{file}"
end
return message
@@ -91,7 +91,7 @@ class Puppet::Parser::Parser
file = file + ".pp"
end
unless FileTest.exist?(file)
- raise Puppet::Error, "Could not find file %s" % file
+ raise Puppet::Error, "Could not find file #{file}"
end
end
raise Puppet::AlreadyImportedError, "Import loop detected" if known_resource_types.watching_file?(file)
@@ -161,12 +161,12 @@ class Puppet::Parser::Parser
if token == 0 # denotes end of file
value = 'end of file'
else
- value = "'%s'" % value[:value]
+ value = "'#{value[:value]}'"
end
- error = "Syntax error at %s" % [value]
+ error = "Syntax error at #{value}"
if brace = @lexer.expected
- error += "; expected '%s'" % brace
+ error += "; expected '#{brace}'"
end
except = Puppet::ParseError.new(error)
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index e1af32fba..257440ab4 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -248,7 +248,7 @@ class Puppet::Parser::Resource < Puppet::Resource
def add_defaults
scope.lookupdefaults(self.type).each do |name, param|
unless @parameters.include?(name)
- self.debug "Adding default for %s" % name
+ self.debug "Adding default for #{name}"
@parameters[name] = param.dup
end
@@ -286,15 +286,15 @@ class Puppet::Parser::Resource < Puppet::Resource
# The parameter is already set. Fail if they're not allowed to override it.
unless param.source.child_of?(current.source)
puts caller if Puppet[:trace]
- msg = "Parameter '%s' is already set on %s" % [param.name, self.to_s]
+ msg = "Parameter '#{param.name}' is already set on #{self}"
if current.source.to_s != ""
- msg += " by %s" % current.source
+ msg += " by #{current.source}"
end
if current.file or current.line
fields = []
fields << current.file if current.file
fields << current.line.to_s if current.line
- msg += " at %s" % fields.join(":")
+ msg += " at #{fields.join(":")}"
end
msg += "; cannot redefine"
raise Puppet::ParseError.new(msg, param.line, param.file)
@@ -331,7 +331,7 @@ class Puppet::Parser::Resource < Puppet::Resource
params.each do |param|
# Don't set the same parameter twice
if @parameters[param.name]
- self.fail Puppet::ParseError, "Duplicate parameter '%s' for on %s" % [param.name, self.to_s]
+ self.fail Puppet::ParseError, "Duplicate parameter '#{param.name}' for on #{self}"
end
set_parameter(param)
diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb
index 26b067703..3514f1d0c 100644
--- a/lib/puppet/parser/resource/param.rb
+++ b/lib/puppet/parser/resource/param.rb
@@ -22,6 +22,6 @@ class Puppet::Parser::Resource::Param
end
def to_s
- "%s => %s" % [self.name, self.value]
+ "#{self.name} => #{self.value}"
end
end
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index d9ea3cc8f..02dd3e733 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -142,7 +142,7 @@ class Puppet::Parser::Scope
if self.respond_to? method
self.send(method, val)
else
- raise Puppet::DevError, "Invalid scope argument %s" % name
+ raise Puppet::DevError, "Invalid scope argument #{name}"
end
}
@@ -227,11 +227,11 @@ class Puppet::Parser::Scope
klassname = parts.join("::")
klass = find_hostclass(klassname)
unless klass
- warning "Could not look up qualified variable '%s'; class %s could not be found" % [name, klassname]
+ warning "Could not look up qualified variable '#{name}'; class #{klassname} could not be found"
return usestring ? "" : :undefined
end
unless kscope = class_scope(klass)
- warning "Could not look up qualified variable '%s'; class %s has not been evaluated" % [name, klassname]
+ warning "Could not look up qualified variable '#{name}'; class #{klassname} has not been evaluated"
return usestring ? "" : :undefined
end
return kscope.lookupvar(shortname, usestring)
@@ -320,7 +320,7 @@ class Puppet::Parser::Scope
#Puppet.debug "Default for %s is %s => %s" %
# [type,ary[0].inspect,ary[1].inspect]
if table.include?(param.name)
- raise Puppet::ParseError.new("Default already defined for %s { %s }; cannot redefine" % [type, param.name], param.line, param.file)
+ raise Puppet::ParseError.new("Default already defined for #{type} { #{param.name} }; cannot redefine", param.line, param.file)
end
table[param.name] = param
}
@@ -335,9 +335,9 @@ class Puppet::Parser::Scope
# [name.inspect,value,self.level, append]
if table.include?(name)
unless options[:append]
- error = Puppet::ParseError.new("Cannot reassign variable %s" % name)
+ error = Puppet::ParseError.new("Cannot reassign variable #{name}")
else
- error = Puppet::ParseError.new("Cannot append, variable %s is defined in this scope" % name)
+ error = Puppet::ParseError.new("Cannot append, variable #{name} is defined in this scope")
end
if options[:file]
error.file = options[:file]
@@ -400,10 +400,10 @@ class Puppet::Parser::Scope
else
str = "Unrecognised escape sequence '#{ss.matched}'"
if file
- str += " in file %s" % file
+ str += " in file #{file}"
end
if line
- str += " at line %s" % line
+ str += " at line #{line}"
end
Puppet.warning str
out << ss.matched
@@ -416,7 +416,7 @@ class Puppet::Parser::Scope
tmp = ss.scan(/[^\\$]+/)
# Puppet.debug("Got other: pos:%d; m:%s" % [ss.pos, tmp])
unless tmp
- error = Puppet::ParseError.new("Could not parse string %s" % string.inspect)
+ error = Puppet::ParseError.new("Could not parse string #{string.inspect}")
{:file= => file, :line= => line}.each do |m,v|
error.send(m, v) if v
end
@@ -438,7 +438,7 @@ class Puppet::Parser::Scope
# Used mainly for logging
def to_s
- "Scope(%s)" % @resource.to_s
+ "Scope(#{@resource})"
end
# Undefine a variable; only used for testing.
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 61c74e970..36dc62261 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -62,13 +62,13 @@ class Puppet::Parser::TemplateWrapper
else
# Just throw an error immediately, instead of searching for
# other missingmethod things or whatever.
- raise Puppet::ParseError, "Could not find value for '%s'" % name
+ raise Puppet::ParseError, "Could not find value for '#{name}'"
end
end
def file=(filename)
unless @file = Puppet::Parser::Files.find_template(filename, scope.compiler.environment.to_s)
- raise Puppet::ParseError, "Could not find template '%s'" % filename
+ raise Puppet::ParseError, "Could not find template '#{filename}'"
end
# We'll only ever not have a parser in testing, but, eh.
@@ -109,6 +109,6 @@ class Puppet::Parser::TemplateWrapper
end
def to_s
- "template[%s]" % (file ? file : "inline")
+ "template[#{(file ? file : "inline")}]"
end
end
diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb
index 5f779cb8d..e0b4143fc 100644
--- a/lib/puppet/parser/type_loader.rb
+++ b/lib/puppet/parser/type_loader.rb
@@ -99,7 +99,7 @@ class Puppet::Parser::TypeLoader
return [name.sub(/^::/, '').gsub("::", File::SEPARATOR)] if name =~ /^::/
result = namespaces.inject([]) do |names_to_try, namespace|
- fullname = (namespace + "::" + name).sub(/^::/, '')
+ fullname = (namespace + "::#{name}").sub(/^::/, '')
# Try to load the module init file if we're a qualified name
if fullname.include?("::")