Is there a condition test to see if a file exists on the puppetmaster? I have about 15 different license files that are loaded on thirteen servers. Not every license goes on every server. I''d like to serve the files only if they exist on the puppet master server. I''m thinking of doing it like this: define install_license($host) { if(exists("/var/puppet/modules/atg/files/${host}/${name}")){ file { $name: path => "${dynamo_home}/localconfig/${name}", mode => $mode, owner => $owner, group => $group, source => "puppet://puppet.armstrong.com/atg/${host}/$ {name}", ensure => present, backup => main, require => Package["ATG"] } } } install_license {[ "A.properties", "B.properties", "C.properties", "D.properties", "E.properties", "F.properties", "G.properties", "H.properties", "I.properties", "J.properties", "K.properties", "L.properties"]: host => $fqdn } I''m open to other ideas. The thought is I''d have one mechanism for loading license files and I''d manage them inside directories named after the $fqdn For this to work, I need that "exists" function. TIA, Jeff --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Am 08.12.2008 um 19:23 schrieb Jeff:> Is there a condition test to see if a file exists on the > puppetmaster? > > [...] > > I''m open to other ideas. The thought is I''d have one mechanism for > loading license files and I''d manage them inside directories named > after the $fqdn For this to work, I need that "exists" function.I think you''ll want to try a custom function http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions as they get executed server-side. Just cook up some ruby code to check for your file existence, and you''re almost done. Felix Schäfer --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi>> Is there a condition test to see if a file exists on the >> puppetmaster? >> >> [...] >> >> I''m open to other ideas. The thought is I''d have one mechanism for >> loading license files and I''d manage them inside directories named >> after the $fqdn For this to work, I need that "exists" function. > > > I think you''ll want to try a custom function > http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions > as they get executed server-side. Just cook up some ruby code to > check for your file existence, and you''re almost done.no, facts get always executed on the client. custom facts are sent down to the client (if using factsync) and are executed there. puppet then reports the facts it gets to the master and requests the compiled manifests. the master compiles the manifest according with the facts it got from the client. so actually you can''t query what is on the puppetmaster while requesting a compiled manifest. for the original problem I don''t see currently a solution. Besides that I would see that quite hacky and therefor would maybe think about remodelling your idea to do it some otherway. cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Does this behavior of the source parameter help you come with an alternative method? "If you specify multiple file sources for a file, then the first source that exists will be used. This allows you to specify what amount to search paths for files:" http://reductivelabs.com/trac/puppet/wiki/TypeReference#file On Mon, Dec 8, 2008 at 1:14 PM, Peter Meier <peter.meier@immerda.ch> wrote:> > Hi > >>> Is there a condition test to see if a file exists on the >>> puppetmaster? >>> >>> [...] >>> >>> I''m open to other ideas. The thought is I''d have one mechanism for >>> loading license files and I''d manage them inside directories named >>> after the $fqdn For this to work, I need that "exists" function. >> >> >> I think you''ll want to try a custom function >> http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions >> as they get executed server-side. Just cook up some ruby code to >> check for your file existence, and you''re almost done. > > no, facts get always executed on the client. custom facts are sent > down to the client (if using factsync) and are executed there. puppet > then reports the facts it gets to the master and requests the compiled > manifests. the master compiles the manifest according with the facts > it got from the client. > > so actually you can''t query what is on the puppetmaster while > requesting a compiled manifest. > > for the original problem I don''t see currently a solution. Besides > that I would see that quite hacky and therefor would maybe think about > remodelling your idea to do it some otherway. > > cheers pete > > > >-- Nigel Kersten Systems Administrator Tech Lead - MacOps --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Am 08.12.2008 um 22:14 schrieb Peter Meier:>> I think you''ll want to try a custom function >> http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions >> as they get executed server-side. Just cook up some ruby code to >> check for your file existence, and you''re almost done. > > no, facts get always executed on the client. custom facts are sent > down to the client (if using factsync) and are executed thereNot fact, function. The first 2 sentences of the link read: """ The Puppet language and interpreter is very extensible. One of the places you can extend Puppet is in creating new functions to be executed on the server (the host running puppetmasterd) at the time that the manifest is compiled. """ So yes, they get executed on the server and you can very well query the existence of files on the server. Felix Schäfer --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi>>> I think you''ll want to try a custom function >>> http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions >>> as they get executed server-side. Just cook up some ruby code to >>> check for your file existence, and you''re almost done. >> >> no, facts get always executed on the client. custom facts are sent >> down to the client (if using factsync) and are executed there > > Not fact, function. The first 2 sentences of the link read: > """ > The Puppet language and interpreter is very extensible. One of the > places you can extend Puppet is in creating new functions to be > executed on the server (the host running puppetmasterd) at the time > that the manifest is compiled. > """ > > So yes, they get executed on the server and you can very well query > the existence of files on the server.tststs reading is not for everyone. :-/ yeah this is the way to go. the fact that I misread your good proposal and that I didn''t think at custom functions makes we wonder if not only the server I examined today has memory problems. :-/ go for that solutions! cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---