I''d like to be able to use the file resource to CONDITIONALLY copy files. The example in a previous post was to copy a large binary install file to the puppet client. However once the installation has taken place I''d really prefer not to leave this file on the client. One thought I had was to have an unless method/attribute in the file type which would allow us to disable the configured file behaviour: For example: file { "/my/file": source => "/path/to/my/file", unless => "/usr/bin/test -d /final/install/directory", notify => Exec[install_script] } exec { "install_script": ... } This seems like it would provide a nice easy way to run custom install scripts and only copy over the files once. The install script would clean up afterwards. I don''t think this is something puppet can do now but would it be a useful addition? Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sat, Nov 8, 2008 at 3:42 AM, Simon J Mudd <sjmudd@pobox.com> wrote:> > One thought I had was to have an unless method/attribute in the file > type which would allow us to disable the configured file behaviour: > > This seems like it would provide a nice easy way to run custom install > scripts and only copy over the files once. The install script would > clean up afterwards.The file resource already has something like this in the replace parameter. replace Whether or not to replace a file that is sourced but exists. This is useful for using file sources purely for initialization. Valid values are true (also called yes), false (also called no). Alternately, just add the ''refreshonly'' parameter on the exec resource so it only gets run if the installation script is replaced. file { "/my/file": source => "/path/to/my/file", unless => "/usr/bin/test -d /final/install/directory", notify => Exec[install_script] } exec { "install_script": refreshonly => true } -- Joshua Timberman --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
joshua.timberman@gmail.com ("Joshua Timberman") writes:> On Sat, Nov 8, 2008 at 3:42 AM, Simon J Mudd <sjmudd@pobox.com> wrote: >> >> One thought I had was to have an unless method/attribute in the file >> type which would allow us to disable the configured file behaviour: >> >> This seems like it would provide a nice easy way to run custom install >> scripts and only copy over the files once. The install script would >> clean up afterwards. > > The file resource already has something like this in the replace parameter. > > replace > > Whether or not to replace a file that is sourced but exists. This is > useful for using file sources purely for initialization. Valid values > are true (also called yes), false (also called no). > > Alternately, just add the ''refreshonly'' parameter on the exec resource > so it only gets run if the installation script is replaced.thanks for the suggestion. I''ll see if I can use that instead. Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
sjmudd@pobox.com (Simon J Mudd) writes:> joshua.timberman@gmail.com ("Joshua Timberman") writes: > >> On Sat, Nov 8, 2008 at 3:42 AM, Simon J Mudd <sjmudd@pobox.com> wrote: >>> >>> One thought I had was to have an unless method/attribute in the file >>> type which would allow us to disable the configured file behaviour: >>> >>> This seems like it would provide a nice easy way to run custom install >>> scripts and only copy over the files once. The install script would >>> clean up afterwards. >> >> The file resource already has something like this in the replace parameter. >> >> replace >> >> Whether or not to replace a file that is sourced but exists. This is >> useful for using file sources purely for initialization. Valid values >> are true (also called yes), false (also called no). >> >> Alternately, just add the ''refreshonly'' parameter on the exec resource >> so it only gets run if the installation script is replaced. > > thanks for the suggestion. I''ll see if I can use that instead.well it strikes me that it''s more work (and I''m not entirely sure how this can be done) to get the boolean value into a variable to make the (file copy) behaviour optional. How do I do this as I don''t see it used in any recipes shown on the website which show this type of behaviour which is really what I want? Perhaps I''m just missing something. In any case extending the unless "functionality" to various basic puppet types would provide a lot more flexibility in what you can do compared to now. Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---