Hello Andrew, I''m getting a syntax error when trying to use the ssh::auth module ("Syntax error at ''{''; expected ''}'' at .../auth.pp:111"). It looks like it''s something to do with parameters after a collection, i.e. line 111 is: if $ensure { Ssh_auth_key_client <| title == $title |> { ensure => $ensure } } I''ve had a quick look in puppet documentation and can''t find reference (e.g. in language tutorial, etc.) to that syntax. I also searched the mailing lists and found something in unrelated discussion on dev list from which I gathered that it is a valid syntax. Is it something new (i.e. newer than 0.24.8)? Should ssh::auth work on 0.24.8? BTW, I gather the above should be equivalent to: if $ensure { Ssh_auth_key_client[$title] { ensure => $ensure } } yes? Thanks, Michael -- Michael Gliwinski Henderson Group Information Services 9-11 Hightown Avenue, Newtownabby, BT36 4RT Phone: 028 9034 3319 ********************************************************************************************** The information in this email is confidential and may be legally privileged. It is intended solely for the addressee and access to the email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing client engagement leter or contract. If you have received this email in error please notify support@henderson-group.com John Henderson (Holdings) Ltd Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT. Registered in Northern Ireland Registration Number NI010588 Vat No.: 814 6399 12 ********************************************************************************* -- 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.
Andrew Schulman
2010-Feb-18 16:51 UTC
Re: [Puppet Users] Syntax error in ssh::auth module?
> Hello Andrew, > > I''m getting a syntax error when trying to use the ssh::auth module ("Syntax > error at ''{''; expected ''}'' at .../auth.pp:111"). It looks like it''s something > to do with parameters after a collection, i.e. line 111 is: > > if $ensure { Ssh_auth_key_client <| title == $title |> { ensure => $ensure } } > > I''ve had a quick look in puppet documentation and can''t find reference (e.g. in > language tutorial, etc.) to that syntax. I also searched the mailing lists > and found something in unrelated discussion on dev list from which I gathered > that it is a valid syntax. Is it something new (i.e. newer than 0.24.8)? > > Should ssh::auth work on 0.24.8?Hi Michael. The reference for this syntax is at http://reductivelabs.com/trac/puppet/wiki/VirtualResources (linked from http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#virtual-resources). The docs say that virtual resources are supported since 0.20.0, but they don''t say whether the "collection" syntax ( <|...|> ) is supported since then-- maybe it''s more recent. I''m running 0.25.4, so it''s possible that you need a more recent version of Puppet than 0.24.8 to use ssh::auth. If someone can clarify what Puppet version is required for the collection syntax, I''ll add it to the list of requirements of ssh::auth.> BTW, I gather the above should be equivalent to: > > if $ensure { Ssh_auth_key_client[$title] { ensure => $ensure } } > > yes?No, that''s not correct. To realize a virtual resource, you have to use either the collection syntax, as in ssh::auth; or the realize function: realize Ssh_auth_key_client[$title] which, according to the docs, doesn''t seem to support adding parameters, e.g. realize Ssh_auth_key_client[$title]{ ensure => $ensure } However, in my testing I found that the above does in fact work, but only if the parameters inside the brackets haven''t been set yet. That makes it not useful for ssh::auth, where the purpose is to override defaults. It''s also undocumented. If the collection syntax makes ssh::auth unusable in Puppet 0.24, I''d gladly change it to something more compatible. But because of the limitation of the realize function, I can''t see a way to do that right now. Andrew. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to puppet-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Michael Gliwinski
2010-Feb-18 17:09 UTC
Re: [Puppet Users] Syntax error in ssh::auth module?
On Thursday 18 Feb 2010 16:51:38 Andrew Schulman wrote:> > Hello Andrew, > > > > I''m getting a syntax error when trying to use the ssh::auth module > > ("Syntax error at ''{''; expected ''}'' at .../auth.pp:111"). It looks like > > it''s something to do with parameters after a collection, i.e. line 111 > > is: > > > > if $ensure { Ssh_auth_key_client <| title == $title |> { ensure => > > $ensure } } > > > > I''ve had a quick look in puppet documentation and can''t find reference > > (e.g. in language tutorial, etc.) to that syntax. I also searched the > > mailing lists and found something in unrelated discussion on dev list > > from which I gathered that it is a valid syntax. Is it something new > > (i.e. newer than 0.24.8)? > > > > Should ssh::auth work on 0.24.8? > > Hi Michael. The reference for this syntax is at > http://reductivelabs.com/trac/puppet/wiki/VirtualResources (linked from > http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#virtual-resource > s). The docs say that virtual resources are supported since 0.20.0, but > they don''t say whether the "collection" syntax ( <|...|> ) is supported > since then-- maybe it''s more recent. I''m running 0.25.4, so it''s possible > that you need a more recent version of Puppet than 0.24.8 to use > ssh::auth.OK> > If someone can clarify what Puppet version is required for the collection > syntax, I''ll add it to the list of requirements of ssh::auth. > > > BTW, I gather the above should be equivalent to: > > > > if $ensure { Ssh_auth_key_client[$title] { ensure => $ensure } } > > > > yes? > > No, that''s not correct. To realize a virtual resource, you have to use > either the collection syntax, as in ssh::auth; or the realize function: > > realize Ssh_auth_key_client[$title] > > which, according to the docs, doesn''t seem to support adding parameters, > e.g. > > realize Ssh_auth_key_client[$title]{ ensure => $ensure } > > However, in my testing I found that the above does in fact work, but only > if the parameters inside the brackets haven''t been set yet. That makes it > not useful for ssh::auth, where the purpose is to override defaults. It''s > also undocumented.Even if collection syntax with parameter override also realizes the resource I don''t think it matters because in e.g. ssh::auth::client you have: if $ensure { Ssh_auth_key_client <| title = $title |> { ensure => $ensure } } ... realize Ssh_auth_key_client[$title] So even if parameters are overridden first and the resource is realized separately it still works.> > If the collection syntax makes ssh::auth unusable in Puppet 0.24, I''d > gladly change it to something more compatible. But because of the > limitation of the realize function, I can''t see a way to do that right now.I did manage to make necessary adjustments to make it work in 0.24.8 but the syntax above turned out to be a smaller issue :) replacing it with the one I suggested above worked. The bigger issue was the =~ operator introduced in 0.25. I did manage to replace it with regsubst but it''s ugly (usually one line in 0.25 translates to ~4 in 0.24.8 using regsubst). I can attach the file with my changes if you want to have a look at it, but it''s your call if you want to keep compatibility at a price of ... well a bit more convoluted code ;) Did 0.25 ever land in EPEL? I really need to have a look at upgrading sometime.> > Andrew. >-- Michael Gliwinski Henderson Group Information Services 9-11 Hightown Avenue, Newtownabby, BT36 4RT Phone: 028 9034 3319 ********************************************************************************************** The information in this email is confidential and may be legally privileged. It is intended solely for the addressee and access to the email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing client engagement leter or contract. If you have received this email in error please notify support@henderson-group.com John Henderson (Holdings) Ltd Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT. Registered in Northern Ireland Registration Number NI010588 Vat No.: 814 6399 12 ********************************************************************************* -- 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.