kapi
2009-Dec-10 11:24 UTC
[Puppet Users] Errror on file reference with multiple file sources and missing file match
Hi, I''m using many classes with file references using multiple file sources. Example: file { "/path/to/my/file": source => [ "/nfs/files/file.$host", "/nfs/files/file.$operatingsystem", "/nfs/files/file.$myownhosttype, "/nfs/files/file" ] } In some cases I don''t have a default file (last line from ''source =>'') in the file server, which used to give me a short ''info'' when running ''puppetd -t'' Since I upgraded to 0.25.1, I''m getting a rather nasty long error line (Failed to retrieve current state of resource:....) on ''puppetd -t'' Is there any option to tell the file type to accept a ''non-match''? Thanks, René -- 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.
John Vestrum
2009-Dec-31 15:17 UTC
[Puppet Users] Re: Errror on file reference with multiple file sources and missing file match
On Dec 10, 5:24 am, kapi <rene.kapel...@psi.ch> wrote:> Hi, > I''m using many classes withfilereferences using multiplefile > sources. > Example:file{ "/path/to/my/file": > source=> [ > "/nfs/files/file.$host", > "/nfs/files/file.$operatingsystem", > "/nfs/files/file.$myownhosttype, > "/nfs/files/file" > ] > > } > > In some cases I don''t have a defaultfile(last line from ''source=>'') > in thefileserver, which used to give me a short ''info'' when running > ''puppetd -t'' > Since I upgraded to 0.25.1, I''m getting a rather nasty long error line > (Failed to retrieve current state of resource:....) on ''puppetd -t'' > Is there any option to tell thefiletype to accept a ''non-match''? > Thanks, RenéI too am trying to implement this kind of logic. It would be very useful if I could do: source => [ "puppet:///path/file.$hostname", undef ] But this fails with "Parameter source failed: Could not understand source undef: private method `gsub'' called for :undef:Symbol". I could use a selector: source => $hostname ? { thishost => "puppet:///path/file.$hostname", thathost => "puppet:///path/file.$hostname", default => undef, } But this requires the hostnames to be put in the manifest; if the first form worked I could just drop the files in place without having to add to the manifest each time. Has anyone figured out a way to make this work? -- 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.
Michael Gliwinski
2009-Dec-31 16:26 UTC
Re: [Puppet Users] Re: Errror on file reference with multiple file sources and missing file match
On Thursday 31 December 2009 15:17:56 John Vestrum wrote:> I too am trying to implement this kind of logic. It would be very > useful if I could do: > > source => [ "puppet:///path/file.$hostname", undef ] > > But this fails with "Parameter source failed: Could not understand > source undef: private method `gsub'' called for :undef:Symbol". I could > use a selector: > > source => $hostname ? { > thishost => "puppet:///path/file.$hostname", > thathost => "puppet:///path/file.$hostname", > default => undef, > } > > But this requires the hostnames to be put in the manifest; if the > first form worked I could just drop the files in place without having > to add to the manifest each time. Has anyone figured out a way to make > this work?I use a workaround with an always existing empty file, like: source => [ "puppet:///path/file.$hostname", "puppet:///shared/dummy_empty_file_for_workaround" ] where that dummy_empty_file_for_workaround always exists in the shared fs mount and is size 0 (i.e. empty). This is not always suitable I guess, but I haven''t found a better way. -- 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.
John Vestrum
2009-Dec-31 16:54 UTC
[Puppet Users] Re: Errror on file reference with multiple file sources and missing file match
> > I use a workaround with an always existing empty file, like: > > source => [ > "puppet:///path/file.$hostname", > "puppet:///shared/dummy_empty_file_for_workaround" > ] > > This is not always suitable I guess, but I haven''t found a better way.Yeah, it won''t quite work for me, because I want the default case to leave the existing file on the node as-is. Oh well, I will just need to make sure I have a /path/file.$hostname for every host. -- 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.
JL
2010-Jan-06 14:12 UTC
[Puppet Users] Re: Errror on file reference with multiple file sources and missing file match
> Yeah, it won''t quite work for me, because I want the default case to > leave the existing file on the node as-is. Oh well, I will just need > to make sure I have a /path/file.$hostname for every host.Not sure if this would work in your environment, but you could use a generate function to externally test to see if the file exists and set the source to undef if it doesn''t. -- 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.