Issue #5237 has been updated by Dan Bode.

Category set to API
Affected Puppet version set to 2.6.3rc2


----------------------------------------
Bug #5237: attribute defaults do not work with Ruby dsl classes
https://projects.puppetlabs.com/issues/5237

Author: Dan Bode
Status: Unreviewed
Priority: Normal
Assignee: 
Category: API
Target version: 
Affected Puppet version: 2.6.3rc2
Keywords: 
Branch: 


The below code works correctly
<pre>
define 'foo', :bar => 'string' do
  notify @name, :message => @bar
end

node 'default' do
  foo 'name', 'bar'=>'baz'
end
</pre>
<pre>
#>puppet  foo.rb
notice: baz
notice: /Stage[main]//Node[default]/Foo[name]/Notify[name]/message: defined 
'message' as 'baz'
</pre>

However, if I dont supply a value for the attribute 'bar' when I declare foo, 
it results in an error

<pre>
define 'foo', :bar => 'string' do
  notify @name, :message => @bar
end

node 'default' do
  foo 'name'
end
</pre>

<pre>
# puppet  foo.rb  --trace --debug
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:229:in 
`set_resource_parameters'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:222:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:222:in 
`set_resource_parameters'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:74:in `evaluate_code'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:71:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:255:in 
`evaluate_definitions'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:255:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:255:in 
`evaluate_definitions'
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:35:in `exceptwrap'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:254:in 
`evaluate_definitions'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:270:in 
`evaluate_generators'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:265:in `loop'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:265:in 
`evaluate_generators'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:107:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:18:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:188:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/usr/bin/puppet:4
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:21:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:188:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/usr/bin/puppet:4
Puppet::Parser::Compiler failed with error NoMethodError: undefined method 
`safeevaluate' for "string":String on node localhost.localdomain

</pre>



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to