Issue #4293 has been reported by Alan Harder.

----------------------------------------
Bug #4293: Define and use a define within a class
http://projects.puppetlabs.com/issues/4293

Author: Alan Harder
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: compiler
Target version: 
Affected version: 2.6.0rc4
Keywords: 
Branch: 


<pre>class foo {
  define do_notify($msg) {
    notify { "Message for $name: $msg": }
  }
  do_notify { 'test_one': 'a message for you' }
}</pre>

With the above class (and simple "include foo" in the node definition) with 
2.6.0rc4 on Solaris 10 / ruby 1.8.7 I get:
<pre>err: Could not retrieve catalog from remote server: Could not intern from 
pson: Could not convert from pson: Could not find relationship target 
"Foo::Do_notify[test_one]"</pre>

Moving the define definition outside the class avoids the error.  I can also 
keep the define where it is, and put "preferred_serialization_format = marshal" 
into the [agent] section of puppet.conf.. then I don't get this error.


Full stack trace:
<pre>info: Automatically imported foo::do_notify from foo
/opt/csw/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:433:in 
`edge_from_pson'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:412:in `from_pson'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:411:in `each'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:411:in `from_pson'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util/pson.rb:11:in `pson_create'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/external/pson/pure/parser.rb:251:in 
`parse_object'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/external/pson/pure/parser.rb:97:in 
`parse'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/external/pson/common.rb:133:in `parse'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/network/formats.rb:134:in `intern'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/network/format_handler.rb:12:in `send'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/network/format_handler.rb:12:in `protect'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/network/format_handler.rb:26:in `intern'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/network/format_handler.rb:102:in 
`convert_from'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:52:in `deserialize'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:71:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/configurer.rb:225:in 
`retrieve_new_catalog'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util.rb:414:in `thinmark'
/opt/csw/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/util.rb:413:in `thinmark'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/configurer.rb:224:in 
`retrieve_new_catalog'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/configurer.rb:102:in `retrieve_catalog'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/configurer.rb:143:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:in `run'
/opt/csw/lib/ruby/1.8/sync.rb:229:in `synchronize'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent.rb:101:in `with_client'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent.rb:37:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:171:in `call'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:171:in `controlled_run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/agent.rb:35:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:114:in `onetime'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:88:in `run_command'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:301:in `run'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:398:in `exit_on_fail'
/opt/csw/lib/ruby/site_ruby/1.8/puppet/application.rb:301:in `run'
/opt/csw/bin/puppetd:4
err: Could not retrieve catalog from remote server: Could not intern from pson: 
Could not convert from pson: Could not find relationship target 
"Foo::Do_notify[test_one]"</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