Issue #5220 has been updated by Daniel Pittman.
Matt Robinson wrote: > I just ran into this while testing too and would like to resolve it because > it's a pain to track down, but am not sure of the correct behavior. > > Should types be required to declare a namevar or at least the parameter name? > If so, then we should probably raise an error when the type is declared. > This seems likely to me. My understanding of namevar is that it's like a > primary key for resources, so we should almost certainly have one. They need some sort of name, yeah, so I think this is the right thing to do: enforce that. IIRC, the code will implicitly fill in the namevar from the title, but that you need to declare which one is namevar, so this should be easy enough: when finished loading the type, check that constraint, and if not satisfied, hard-fail. ...or maybe soft-fail and just pull the type back out. I like the hard fail, but maybe we prefer not to break an entire infrastructure because you sync out a broken type from some random module... > If not then, something probably needs to be fixed in the area of > lib/puppet/resource.rb in the parse_title method or in lib/puppet/type.rb > title_patterns method so that a hash is returned instead of an array. Feels like papering over the problem, and I would want to see some pretty convincing arguments why we should (continue to) allow that, if it turned out we didn't enforce having a namevar. ---------------------------------------- Bug #5220: when namevar is not specified for a type, error message is 'undefined method `merge' for []:Array' https://projects.puppetlabs.com/issues/5220 Author: Dan Bode Status: Investigating Priority: Normal Assignee: Matt Robinson Category: RAL Target version: Affected Puppet version: Keywords: Branch: a more useful message would be helpful. stack trace: <pre> root@puppet:/etc/puppet/modules# puppet apply --trace --debug tests/openfire.pp /usr/lib/ruby/1.8/puppet/resource.rb:206:in `to_hash' /usr/lib/ruby/1.8/puppet/type.rb:1730:in `initialize' /usr/lib/ruby/1.8/puppet/resource.rb:246:in `new' /usr/lib/ruby/1.8/puppet/resource.rb:246:in `to_ral' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:553:in `send' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:553:in `to_catalog' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:531:in `each' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:531:in `to_catalog' /usr/lib/ruby/1.8/puppet/resource/catalog.rb:468:in `to_ral' /usr/lib/ruby/1.8/puppet/application/apply.rb:118:in `main' /usr/lib/ruby/1.8/puppet/application/apply.rb:35:in `run_command' /usr/lib/ruby/1.8/puppet/application.rb:300:in `run' /usr/lib/ruby/1.8/puppet/application.rb:397:in `exit_on_fail' /usr/lib/ruby/1.8/puppet/application.rb:300:in `run' /usr/lib/ruby/1.8/puppet/util/command_line.rb:55:in `execute' /usr/bin/puppet:4 undefined method `merge' for []:Array </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.
