From fff6ad90d781b8fda2b93916a67ef65b3b263c66 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Wed, 30 Apr 2008 23:23:41 +1000 Subject: Fix for ticket #1209 --- lib/puppet/parser/functions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb index e0b60e161..93991275c 100644 --- a/lib/puppet/parser/functions.rb +++ b/lib/puppet/parser/functions.rb @@ -165,7 +165,7 @@ module Functions type is defined, either as a native type or a defined type, or whether a class is defined. This is useful for checking whether a class is defined and only including it if it is. This function can also test whether a resource has been defined, using resource references - (e.g., ``if defined(File['/tmp/myfile'] { ... }``). This function is unfortunately + (e.g., ``if defined(File['/tmp/myfile']) { ... }``). This function is unfortunately dependent on the parse order of the configuration when testing whether a resource is defined.") do |vals| result = false vals.each do |val| -- cgit From c57e194418b658ddcd82610c3c273bfa17ba5f8b Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 1 May 2008 14:04:52 -0500 Subject: Fixing an error message to be more clear --- lib/puppet/parser/compiler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 8fba41121..d67b3d275 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -332,7 +332,7 @@ class Puppet::Parser::Compiler unless remaining.empty? fail Puppet::ParseError, - "Could not find object(s) %s" % remaining.collect { |o| + "Could not find resource(s) %s for overriding" % remaining.collect { |o| o.ref }.join(", ") end -- cgit From 270c007672c9a0458f14189cff3ccf1ff6311963 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 12 May 2008 15:55:02 -0500 Subject: Clarifying the exception when there's a syntax error but a valid parser. This is related to #1215. --- lib/puppet/parser/interpreter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index f27c1c5c8..04ca41494 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -62,7 +62,7 @@ class Puppet::Parser::Interpreter # exception elsewhere and reuse the parser. If one doesn't # exist, then reraise. if @parsers[environment] - Puppet.err detail + Puppet.err(detail.to_s + "; using previously parsed manifests") else raise detail end -- cgit From 49dde1187e8caea10af63ec1f92e19c0e5f1a595 Mon Sep 17 00:00:00 2001 From: Adam Jacob Date: Mon, 12 May 2008 21:41:04 -0700 Subject: Adding has_variable? support, fixing ticket #1177 --- lib/puppet/parser/templatewrapper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb index 7a8f74156..4f044befc 100644 --- a/lib/puppet/parser/templatewrapper.rb +++ b/lib/puppet/parser/templatewrapper.rb @@ -19,6 +19,15 @@ class Puppet::Parser::TemplateWrapper @scope.parser.watch_file(@file) end end + + # Should return true if a variable is defined, false if it is not + def has_variable?(name) + if @scope.lookupvar(name.to_s, false) != :undefined + true + else + false + end + end # Ruby treats variables like methods, so we can cheat here and # trap missing vars like they were missing methods. -- cgit From 59b9958712d033bbd294ff6469ea3a242c45c82c Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 13 May 2008 11:58:33 -0500 Subject: Correcting whitespace in the templatewrapper code. Also slightly modified the wording of some of the tests. --- lib/puppet/parser/templatewrapper.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb index 4f044befc..4790cea30 100644 --- a/lib/puppet/parser/templatewrapper.rb +++ b/lib/puppet/parser/templatewrapper.rb @@ -19,14 +19,14 @@ class Puppet::Parser::TemplateWrapper @scope.parser.watch_file(@file) end end - + # Should return true if a variable is defined, false if it is not def has_variable?(name) - if @scope.lookupvar(name.to_s, false) != :undefined - true - else - false - end + if @scope.lookupvar(name.to_s, false) != :undefined + true + else + false + end end # Ruby treats variables like methods, so we can cheat here and -- cgit