Issue #3667 has been updated by Luke Kanies. Status changed from Accepted to Ready for Testing Assigned to changed from Luke Kanies to Brice Figureau
Works for me (albeit it's in deep need of a rebase). ---------------------------------------- Bug #3667: Namespace issue in classes in testing http://projects.puppetlabs.com/issues/3667 Author: Brice Figureau Status: Ready for Testing Priority: Normal Assigned to: Brice Figureau Category: compiler Target version: Rowlf Affected version: testing Keywords: Branch: http://github.com/masterzen/puppet/tree/tickets/testing/3667 Testing doesn't seem to use the correct namespaces when referring a definition: <pre> class snmp::agent { define trap($trapsink) { notify { "trap: $trapsink of $name": } } trap{ "this is a trap" : trapsink => "trapsink" } } include snmp::agent </pre> produces <pre> ./lib/puppet/resource.rb:169:in `initialize' ./lib/puppet/parser/resource.rb:111:in `initialize' ./lib/puppet/parser/expression/resource.rb:39:in `new' ./lib/puppet/parser/expression/resource.rb:39:in `compute_denotation' ./lib/puppet/util/errors.rb:35:in `exceptwrap' ./lib/puppet/parser/expression/resource.rb:37:in `compute_denotation' ./lib/puppet/parser/expression/resource.rb:36:in `collect' ./lib/puppet/parser/expression/resource.rb:36:in `compute_denotation' ./lib/puppet/parser/expression.rb:72:in `denotation' ./lib/puppet/parser/expression/array.rb:35:in `compute_denotation' ./lib/puppet/parser/expression/array.rb:34:in `collect' ./lib/puppet/parser/expression/array.rb:34:in `compute_denotation' ./lib/puppet/parser/expression.rb:72:in `denotation' ./lib/puppet/resource/type.rb:38:in `evaluate_code' ./lib/puppet/parser/resource.rb:73:in `evaluate' ./lib/puppet/parser/compiler.rb:131:in `evaluate_classes' ./lib/puppet/parser/compiler.rb:122:in `each' ./lib/puppet/parser/compiler.rb:122:in `evaluate_classes' ./lib/puppet/parser/functions/include.rb:6:in `function_include' ./lib/puppet/parser/expression/function.rb:36:in `send' ./lib/puppet/parser/expression/function.rb:36:in `compute_denotation' ./lib/puppet/parser/expression.rb:72:in `denotation' ./lib/puppet/parser/expression/array.rb:35:in `compute_denotation' ./lib/puppet/parser/expression/array.rb:34:in `collect' ./lib/puppet/parser/expression/array.rb:34:in `compute_denotation' ./lib/puppet/parser/expression.rb:72:in `denotation' ./lib/puppet/resource/type.rb:38:in `evaluate_code' ./lib/puppet/parser/resource.rb:73:in `evaluate' ./lib/puppet/parser/compiler.rb:280:in `evaluate_main' ./lib/puppet/parser/compiler.rb:82:in `compile' ./lib/puppet/parser/compiler.rb:18:in `compile' ./lib/puppet/indirector/catalog/compiler.rb:77:in `compile' ./lib/puppet/util.rb:179:in `benchmark' ./lib/puppet/indirector/catalog/compiler.rb:75:in `compile' ./lib/puppet/indirector/catalog/compiler.rb:34:in `find' ./lib/puppet/indirector/indirection.rb:186:in `find' ./lib/puppet/indirector.rb:50:in `find' ./lib/puppet/application/main.rb:117:in `main' ./lib/puppet/application.rb:304:in `send' ./lib/puppet/application.rb:304:in `run_command' ./lib/puppet/application.rb:295:in `run' ./lib/puppet/application.rb:391:in `exit_on_fail' ./lib/puppet/application.rb:295:in `run' sbin/puppet:15 ./lib/puppet/parser/compiler.rb:21:in `compile' ./lib/puppet/indirector/catalog/compiler.rb:77:in `compile' ./lib/puppet/util.rb:179:in `benchmark' ./lib/puppet/indirector/catalog/compiler.rb:75:in `compile' ./lib/puppet/indirector/catalog/compiler.rb:34:in `find' ./lib/puppet/indirector/indirection.rb:186:in `find' ./lib/puppet/indirector.rb:50:in `find' ./lib/puppet/application/main.rb:117:in `main' ./lib/puppet/application.rb:304:in `send' ./lib/puppet/application.rb:304:in `run_command' ./lib/puppet/application.rb:295:in `run' ./lib/puppet/application.rb:391:in `exit_on_fail' ./lib/puppet/application.rb:295:in `run' sbin/puppet:15 Puppet::Parser::Expression::Resource failed with error ArgumentError: Invalid resource type trap at /tmp/trap.pp:7 on node macbook.local </pre> It looks like the issue is that in lib/puppet/resource.rb we try to find the 'trap' definition (see find_defined_resource_type) with the 'snmp' namespaces, while when the definition was added to the known_resource_types it was under ['snmp','agent']. It seems the namespace we use to find the definition comes from the current scope (Class[snmp::agent]). The namespace of this scope returns 'snmp'. I don't really see how this can be fixed. Note that the following manifest works fine: <pre> class snmp::agent { define trap($trapsink) { notify { "trap: $trapsink of $name": } } snmp::agent::trap{ "this is a trap" : trapsink => "trapsink" } } include snmp::agent </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.
