diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-09 18:45:51 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-09 18:45:51 +0000 |
| commit | 2dbd7e19de0caa683f7e0b4da5654eb15bc419da (patch) | |
| tree | 298ac3b9f49804e32fd135842bae38de3b5d4b46 /lib/puppet/parser/ast | |
| parent | 7756f9a57fa83e811888298edd339978bb6a9c83 (diff) | |
| download | puppet-2dbd7e19de0caa683f7e0b4da5654eb15bc419da.tar.gz puppet-2dbd7e19de0caa683f7e0b4da5654eb15bc419da.tar.xz puppet-2dbd7e19de0caa683f7e0b4da5654eb15bc419da.zip | |
Fixing #96. Defaults are now set when the object is passed out by the scope, rather than when the object is created. This is nice because it also moves awareness of the scope internals out of the AST object and back into the scope.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@996 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast')
| -rw-r--r-- | lib/puppet/parser/ast/objectdef.rb | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/lib/puppet/parser/ast/objectdef.rb b/lib/puppet/parser/ast/objectdef.rb index 0a9ba23cd..9acf56b49 100644 --- a/lib/puppet/parser/ast/objectdef.rb +++ b/lib/puppet/parser/ast/objectdef.rb @@ -65,8 +65,7 @@ class Puppet::Parser::AST end end - # Retrieve the defaults for our type - hash = getdefaults(objtype, scope) + hash = {} # then set all of the specified params @params.each { |param| @@ -105,52 +104,9 @@ class Puppet::Parser::AST error.backtrace = detail.backtrace raise error end -# else -# # but things like components create a new type; if we find -# # one of those, evaluate that with our arguments -# #Puppet.debug("Calling object '%s' with arguments %s" % -# # [object.name, hash.inspect]) -# #obj = object.safeevaluate(scope,hash,objtype,objname) -# obj = object.safeevaluate( -# :scope => scope, -# :arguments => hash, -# :type => objtype, -# :name => objname -# ) -# -# # and pass the result on -# obj -# end }.reject { |obj| obj.nil? } end - # Retrieve the defaults for our type - def getdefaults(objtype, scope) - # first, retrieve the defaults - begin - defaults = scope.lookupdefaults(objtype) - if defaults.length > 0 - #Puppet.debug "Got defaults for %s: %s" % - # [objtype,defaults.inspect] - end - rescue => detail - raise Puppet::DevError, - "Could not lookup defaults for %s: %s" % - [objtype, detail.to_s] - end - - hash = {} - # Add any found defaults to our argument list - defaults.each { |var,value| - Puppet.debug "Found default %s for %s" % - [var,objtype] - - hash[var] = value - } - - return hash - end - # Create our ObjectDef. Handles type checking for us. def initialize(hash) @checked = false |
