diff options
| author | Luke Kanies <luke@madstop.com> | 2007-08-20 22:25:00 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-08-20 22:25:00 -0500 |
| commit | 4eb87ed7c8829a6fbc558595be9149e9b3cf5b36 (patch) | |
| tree | 5c8319949022f932eb6467b17b55debaa42fa125 /lib/puppet/dsl.rb | |
| parent | 2a4e1011dbc244754f434f7eb97f3d41463e5cd4 (diff) | |
| download | puppet-4eb87ed7c8829a6fbc558595be9149e9b3cf5b36.tar.gz puppet-4eb87ed7c8829a6fbc558595be9149e9b3cf5b36.tar.xz puppet-4eb87ed7c8829a6fbc558595be9149e9b3cf5b36.zip | |
A round of bugfixing. Many more tests now pass -- I think we are largely down to tests that (yay!) fail in trunk.
Diffstat (limited to 'lib/puppet/dsl.rb')
| -rw-r--r-- | lib/puppet/dsl.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/puppet/dsl.rb b/lib/puppet/dsl.rb index 9c652f082..3a7a7f059 100644 --- a/lib/puppet/dsl.rb +++ b/lib/puppet/dsl.rb @@ -113,10 +113,6 @@ module Puppet @aspects = {} - # For now, just do some hackery so resources work - @@interp = Puppet::Parser::Interpreter.new :Code => "" - @@scope = Puppet::Parser::Scope.new(:interp => @@interp) - @@objects = Hash.new do |hash, key| hash[key] = {} end @@ -237,7 +233,7 @@ module Puppet end unless obj = @@objects[type][name] obj = Resource.new :title => name, :type => type.name, - :source => source, :scope => @@scope + :source => source, :scope => scope @@objects[type][name] = obj @resources << obj @@ -250,12 +246,26 @@ module Puppet :source => source ) - obj.set(param) + obj.send(:set_parameter, param) end obj end + def scope + unless defined?(@scope) + @interp = Puppet::Parser::Interpreter.new :Code => "" + # Load the class, so the node object class is available. + require 'puppet/network/handler/node' + @node = Puppet::Network::Handler::Node::SimpleNode.new(Facter.value(:hostname)) + @node.parameters = Facter.to_hash + @interp = Puppet::Parser::Interpreter.new :Code => "" + @config = Puppet::Parser::Configuration.new(@node, @interp.parser) + @scope = @config.topscope + end + @scope + end + def type self.name end |
