summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/ast.rb1
-rw-r--r--lib/puppet/parser/functions.rb5
-rw-r--r--lib/puppet/parser/interpreter.rb19
-rw-r--r--lib/puppet/parser/lexer.rb1
-rw-r--r--lib/puppet/parser/parser.rb1
-rw-r--r--lib/puppet/parser/resource/param.rb1
-rw-r--r--lib/puppet/parser/templatewrapper.rb1
7 files changed, 12 insertions, 17 deletions
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index ce5e8263e..14b686e2f 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -117,4 +117,3 @@ end
require 'puppet/parser/ast/leaf'
-# $Id$
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index 7ffdb6ccb..1d07122d4 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -200,11 +200,9 @@ module Functions
end
newfunction(:template, :type => :rvalue, :doc => "Evaluate a template and
- return its value. See `the templating docs`_
+ return its value. See `the templating docs </trac/puppet/wiki/PuppetTemplating>`_
for more information. Note that if multiple templates are specified, their
output is all concatenated and returned as the output of the function.
-
- .. _the templating docs: /trac/puppet/wiki/PuppetTemplating
") do |vals|
require 'erb'
@@ -304,4 +302,3 @@ module Functions
end
end
-# $Id$
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index 81867c84b..0b8c035ba 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -25,7 +25,8 @@ class Puppet::Parser::Interpreter
# evaluate our whole tree
def compile(node)
- return Puppet::Parser::Compile.new(node, parser(node.environment), :ast_nodes => usenodes?).compile
+ raise Puppet::ParseError, "Could not parse configuration; cannot compile" unless env_parser = parser(node.environment)
+ return Puppet::Parser::Compile.new(node, env_parser, :ast_nodes => usenodes?).compile
end
# create our interpreter
@@ -74,15 +75,14 @@ class Puppet::Parser::Interpreter
parser.parse
return parser
rescue => detail
- if Puppet[:trace]
- puts detail.backtrace
- end
msg = "Could not parse"
if environment and environment != ""
msg += " for environment %s" % environment
end
- msg += ": %s" % detail
- raise Puppet::Error, detail
+ msg += ": %s" % detail.to_s
+ error = Puppet::Error.new(msg)
+ error.set_backtrace(detail.backtrace)
+ raise error
end
end
@@ -96,8 +96,11 @@ class Puppet::Parser::Interpreter
tmp = create_parser(environment)
@parsers[environment].clear if @parsers[environment]
@parsers[environment] = tmp
- rescue
- # Nothing, yo.
+ rescue => detail
+ # If a parser already exists, than assume that we logged the
+ # exception elsewhere and reuse the parser. If one doesn't
+ # exist, then reraise.
+ raise detail unless @parsers[environment]
end
end
@parsers[environment]
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 360ed4254..086d82c09 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -330,4 +330,3 @@ module Puppet
end
end
-# $Id$
diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb
index b4e9b84d7..c3279d4e7 100644
--- a/lib/puppet/parser/parser.rb
+++ b/lib/puppet/parser/parser.rb
@@ -39,7 +39,6 @@ require 'puppet/parser/parser_support'
# mode: ruby
# End:
-# $Id$
..end grammar.ra modeval..id9134b179f4
diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb
index 4332bee85..6bde0674e 100644
--- a/lib/puppet/parser/resource/param.rb
+++ b/lib/puppet/parser/resource/param.rb
@@ -88,4 +88,3 @@ class Puppet::Parser::Resource::Param
end
end
-# $Id$
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index f863e31aa..13823d483 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -51,4 +51,3 @@ class Puppet::Parser::TemplateWrapper
end
end
-# $Id$