summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/ast/resource.rb7
-rw-r--r--lib/puppet/parser/compiler.rb4
-rw-r--r--lib/puppet/parser/lexer.rb3
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index bd15d9935..ce3c499c5 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -53,10 +53,11 @@ class Resource < AST::Branch
:strict => true
)
- # And then store the resource in the compiler.
- # At some point, we need to switch all of this to return
- # resources instead of storing them like this.
+ if resource.resource_type.is_a? Puppet::Resource::Type
+ resource.resource_type.instantiate_resource(scope, resource)
+ end
scope.compiler.add_resource(scope, resource)
+ scope.compiler.evaluate_classes([resource_title],scope,false) if fully_qualified_type == 'class'
resource
end
}
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index e1227e753..c60e1d4fb 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -144,7 +144,7 @@ class Puppet::Parser::Compiler
if klass = scope.find_hostclass(name)
found << name and next if scope.class_scope(klass)
- resource = klass.mk_plain_resource(scope)
+ resource = klass.ensure_in_catalog(scope)
# If they've disabled lazy evaluation (which the :include function does),
# then evaluate our resource immediately.
@@ -220,7 +220,7 @@ class Puppet::Parser::Compiler
# Create a resource to model this node, and then add it to the list
# of resources.
- resource = astnode.mk_plain_resource(topscope)
+ resource = astnode.ensure_in_catalog(topscope)
resource.evaluate
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 9036d652e..31d39ae2f 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -522,13 +522,14 @@ class Puppet::Parser::Lexer
# backslash; the caret is there to match empty strings
str = @scanner.scan_until(/([^\\]|^|[^\\])([\\]{2})*[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'"
@line += str.count("\n") # literal carriage returns add to the line count.
- str.gsub!(/\\(.)/) {
+ str.gsub!(/\\(.)/m) {
ch = $1
if escapes.include? ch
case ch
when 'n'; "\n"
when 't'; "\t"
when 's'; " "
+ when "\n": ''
else ch
end
else