Steve Traylen
2011-Sep-23 23:43 UTC
[Puppet Users] Could not render to pson: you must specify title patterns
Hi, I''m trying to add my first custom type to puppet largely copying examples whilst working with puppet-2.6.6. My error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not render to pson: you must specify title patterns when there are two or more key attributes What is a title pattern? My extremely trivial files: The type "metric" http://pastebin.com/9F7sVYjp The provider "lemon". http://pastebin.com/eJEvsV6v My addition of a class is then: metric{ ''20002'': ensure => present, provider => lemon, name => ''system.loadAvg'' } -- Steve Traylen -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Stefan Schulte
2011-Sep-25 21:23 UTC
Re: [Puppet Users] Could not render to pson: you must specify title patterns
On Sat, Sep 24, 2011 at 01:43:05AM +0200, Steve Traylen wrote:> Hi, > I''m trying to add my first custom type to puppet largely copying > examples whilst working with puppet-2.6.6. > > My error: > > err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Could not render to pson: you must specify title patterns when > there are two or more key attributes > > What is a title pattern? > > My extremely trivial files: > > The type "metric" > http://pastebin.com/9F7sVYjp > > The provider "lemon". > http://pastebin.com/eJEvsV6v >Puppet 2.6 has basic support for types with composite namevars. That means that not only one parameter identifies a resource but the combination of parameters. One example is a port in /etc/services. What really identifies an entry in /etc/services is not only the port''s name it is the name AND the protocol. But when you write your manifest and describe a resource it is common to not set any namevar explicitly but implicitly via the title. Example: file { ''/tmp/foo'': ensure => file, } The namevar of the fileresource is called `path` and because I haven''t specified the path parameter explicitly it is implicitly set to /tmp/foo (the resource''s title). If we have more then one namevar (I prefer the term keyattribute by the way) the type developer has to specify a title pattern. The title pattern is basically as special array that determines how to convert the title of a resource into values for the different key attributes. So to pick up the previous example of a port entry in /etc/services a resource title could look like this: inet_port { ''telnet/tcp'': ensure => present number => ''22'', } With the correct title pattern puppet can now set the name parameter to ''telnet'' and the protocol parameter to ''tcp''. Long story short: You see this message because your type does not implement the title pattern method but you have a type with more than one keyattribute: 1. »id« which you explicitly marked with the isnamevar method 2. »name« which is implicitly always treated as a keyattribute If the second one is not what you want you have to rename your parameter. -Stefan
Steve Traylen
2011-Oct-02 13:51 UTC
Re: [Puppet Users] Could not render to pson: you must specify title patterns
On Sun, Sep 25, 2011 at 11:23 PM, Stefan Schulte <stefan.schulte@taunusstein.net> wrote:> Long story short: > You see this message because your type does not implement the title > pattern method but you have a type with more than one keyattribute: > 1. »id« which you explicitly marked with the isnamevar method > 2. »name« which is implicitly always treated as a keyattribute > > If the second one is not what you want you have to rename your > parameter.Thanks Stefan, that all makes sense, after renaming my name parameter all is good. -- Steve Traylen -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2011-Oct-02 15:13 UTC
Re: [Puppet Users] Could not render to pson: you must specify title patterns
On Sun, Oct 2, 2011 at 6:51 AM, Steve Traylen <steve.traylen@cern.ch> wrote:> On Sun, Sep 25, 2011 at 11:23 PM, Stefan Schulte > <stefan.schulte@taunusstein.net> wrote: > > Long story short: > > You see this message because your type does not implement the title > > pattern method but you have a type with more than one keyattribute: > > 1. »id« which you explicitly marked with the isnamevar method > > 2. »name« which is implicitly always treated as a keyattribute > > > > If the second one is not what you want you have to rename your > > parameter. > > Thanks Stefan, that all makes sense, after renaming my name parameter > all is good. > >I''ve actually filed this as an issue, as the error message isn''t helpful enough. http://projects.puppetlabs.com/issues/9851 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.