From 11081ce8864dca2bc92d8c9f825c3fe7f96333f4 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sun, 26 Aug 2007 21:54:17 -0500 Subject: Multiple environment support now works, and I have even tested it in real life. This commit is mostly a bug-fix commit, resulting from the difference between real-life testing and unit testing. --- lib/puppet/parser/interpreter.rb | 3 +++ lib/puppet/parser/parser_support.rb | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index b6c61d202..93a4bc170 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -67,6 +67,9 @@ class Puppet::Parser::Interpreter parser.string = self.code elsif self.file parser.file = self.file + else + file = Puppet.config.value(:manifest, environment) + parser.file = file end parser.parse return parser diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index 401b5b1c0..660fa8169 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -15,7 +15,7 @@ class Puppet::Parser::Parser AST = Puppet::Parser::AST - attr_reader :file, :version + attr_reader :version, :environment attr_accessor :files @@ -85,6 +85,10 @@ class Puppet::Parser::Parser raise except end + def file + @lexer.file + end + def file=(file) unless FileTest.exists?(file) unless file =~ /\.pp$/ -- cgit