summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-11-17 21:03:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-11-17 21:03:19 +0000
commit50821328ec637a4ec0feb822b86e208b04baae68 (patch)
tree3882a2c9a4264756b5b551dd6ba38cbd6ba41b52 /lib
parentc205bf6ba79a905c59eb99747ffe674bbaa11481 (diff)
downloadpuppet-50821328ec637a4ec0feb822b86e208b04baae68.tar.gz
puppet-50821328ec637a4ec0feb822b86e208b04baae68.tar.xz
puppet-50821328ec637a4ec0feb822b86e208b04baae68.zip
adding cfengine module, which required passing the cfengine classes all the way through the stack to the scope
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@746 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/interpreter.rb6
-rw-r--r--lib/puppet/parser/scope.rb10
-rw-r--r--lib/puppet/server/master.rb5
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index 557af958b..6a8a333e8 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -28,6 +28,10 @@ module Puppet
@usenodes = true
end
+ # Set it to either the value or nil. This is currently only used
+ # by the cfengine module.
+ @classes = hash[:Classes] || []
+
# Create our parser object
parsefiles
@@ -64,7 +68,7 @@ module Puppet
@scope.interp = self
@scope.type = "puppet"
@scope.name = "top"
- return @scope.evaluate(@ast, facts)
+ return @scope.evaluate(@ast, facts, @classes)
end
#@ast.evaluate(@scope)
rescue Puppet::DevError, Puppet::Error, Puppet::ParseError => except
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 93d97e396..c5ee0226a 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -233,13 +233,21 @@ module Puppet
# silly method, in that it just calls evaluate on the passed-in
# objects, and then calls to_trans on itself. It just conceals
# a paltry amount of info from whomever's using the scope object.
- def evaluate(objects, facts = {})
+ def evaluate(objects, facts = {}, classes = [])
facts.each { |var, value|
self.setvar(var, value)
}
objects.safeevaluate(self)
+ # These classes would be passed in manually, via something like
+ # a cfengine module
+ classes.each { |klass|
+ if code = self.lookuptype(klass)
+ code.safeevaluate(self, {}, klass, klass)
+ end
+ }
+
return self.to_trans
end
diff --git a/lib/puppet/server/master.rb b/lib/puppet/server/master.rb
index 261d93d97..e86663d0f 100644
--- a/lib/puppet/server/master.rb
+++ b/lib/puppet/server/master.rb
@@ -44,6 +44,11 @@ class Server
args[:UseNodes] = false
end
+ # This is only used by the cfengine module
+ if hash.include?(:Classes)
+ args[:Classes] = hash[:Classes]
+ end
+
begin
@interpreter = Puppet::Parser::Interpreter.new(args)
rescue => detail