Hi guys! I need configure one command exec with onlyif parameter. I want test file size exist or no. Ho i do this? Tks in advanced. Douglas -- 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.
Run command if file exists: exec { ''foo'' command => ''<your command>'', onlyif => ''/usr/bin/test -f /file/that/must/exist/for/exec/to/run'', } Run command unless file exists exec { command => ''<your command>'', creates => ''/path/to/file'', } On Tuesday, 13 March 2012 at 6:23 AM, Douglas Brancaglion wrote:> Hi guys! > > I need configure one command exec with onlyif parameter. > > I want test file size exist or no. > > Ho i do this? > > Tks in advanced. > > Douglas > > -- > 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 (mailto:puppet-users@googlegroups.com). > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- 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.
Checkout the ''creates'' property, it seems like a cleaner way of doing this: http://docs.puppetlabs.com/references/2.6.8/type.html#exec On Mon, Mar 12, 2012 at 12:23 PM, Douglas Brancaglion < douglas.reader@gmail.com> wrote:> Hi guys! > > I need configure one command exec with onlyif parameter. > > I want test file size exist or no. > > Ho i do this? > > Tks in advanced. > > Douglas > > -- > 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 <puppet-users%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en> > . > >-- Doug Chapman -- 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.
Tks guys!! It''s ok! On 03/12/2012 07:52 PM, Doug Chapman wrote:> Checkout the ''creates'' property, it seems like a cleaner way of doing > this: > > http://docs.puppetlabs.com/references/2.6.8/type.html#exec > > On Mon, Mar 12, 2012 at 12:23 PM, Douglas Brancaglion > <douglas.reader@gmail.com <mailto:douglas.reader@gmail.com>> wrote: > > Hi guys! > > I need configure one command exec with onlyif parameter. > > I want test file size exist or no. > > Ho i do this? > > Tks in advanced. > > Douglas > > -- > 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 > <mailto:puppet-users@googlegroups.com>. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com > <mailto:puppet-users%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > > > > -- > Doug Chapman > > > -- > 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.-- 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 Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote:> > Checkout the ''creates'' property, it seems like a cleaner way of doing this: > > http://docs.puppetlabs.com/references/2.6.8/type.html#exec >Pardon the newbie question, but does work on or de-reference symlinks? Cheers. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uiuySO1RfNMJ. 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.
You might want to rephrase your question, as it is not obvious, at least not to me. Mohamed. On Tue, Mar 13, 2012 at 4:26 PM, Trammael <evilensky@gmail.com> wrote:> > > On Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote: >> >> Checkout the ''creates'' property, it seems like a cleaner way of doing >> this: >> >> http://docs.puppetlabs.com/references/2.6.8/type.html#exec > > > Pardon the newbie question, but does work on or de-reference symlinks? > > Cheers. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/uiuySO1RfNMJ. > > 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.-- 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 Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote: >>> >>> Checkout the ''creates'' property, it seems like a cleaner way of doing >>> this: >>> >>> http://docs.puppetlabs.com/references/2.6.8/type.html#exec >> >> >> Pardon the newbie question, but does work on or de-reference symlinks? >>On Tue, Mar 13, 2012 at 3:51 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote:> You might want to rephrase your question, as it is not obvious, at > least not to me. > > Mohamed.If the "creates" property of a Exec points to a symlink, what is the effect if the target of the symlink is missing? Cheers, -- 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 Mar 14, 2012, at 5:00 PM, Eugene Vilensky wrote:>>> On Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote: >>>> >>>> Checkout the ''creates'' property, it seems like a cleaner way of doing >>>> this: >>>> >>>> http://docs.puppetlabs.com/references/2.6.8/type.html#exec >>> >>> >>> Pardon the newbie question, but does work on or de-reference symlinks? >>> > > On Tue, Mar 13, 2012 at 3:51 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote: >> You might want to rephrase your question, as it is not obvious, at >> least not to me. >> >> Mohamed. > > If the "creates" property of a Exec points to a symlink, what is the > effect if the target of the symlink is missing?The exec will not run in this case. The ''creates'' attribute looks for something to exist at the specified path. A symlink, even if broken, is still a file. These hypotheticals are simple to test out on your own. To test this case on any puppet client, first create a class: #test.pp: class test { exec { ''touch /opt/test.did.run'': creates => ''/opt/test.link'' } } Then create a symlink to a non-existent file: ln -s /opt/nada /opt/test.link Finally: puppet apply test.pp /opt/test.did.run won''t be created. -- Peter M. Bukowinski Sr. Systems Engineer Janelia Farm Research Campus, HHMI -- 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 Mar 14, 2012, at 5:20 PM, Peter Bukowinski wrote:> On Mar 14, 2012, at 5:00 PM, Eugene Vilensky wrote: > >>>> On Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote: >>>>> >>>>> Checkout the ''creates'' property, it seems like a cleaner way of doing >>>>> this: >>>>> >>>>> http://docs.puppetlabs.com/references/2.6.8/type.html#exec >>>> >>>> >>>> Pardon the newbie question, but does work on or de-reference symlinks? >>>> >> >> On Tue, Mar 13, 2012 at 3:51 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote: >>> You might want to rephrase your question, as it is not obvious, at >>> least not to me. >>> >>> Mohamed. >> >> If the "creates" property of a Exec points to a symlink, what is the >> effect if the target of the symlink is missing? > > > The exec will not run in this case. The ''creates'' attribute looks for something to exist at the specified path. A symlink, even if broken, is still a file. > > These hypotheticals are simple to test out on your own. To test this case on any puppet client, first create a class: > > #test.pp: > class test { > exec { ''touch /opt/test.did.run'': creates => ''/opt/test.link'' } > } > > Then create a symlink to a non-existent file: > > ln -s /opt/nada /opt/test.link > > Finally: > > puppet apply test.pp > > /opt/test.did.run won''t be created.Apologies, I was completely wrong. Must be something amiss with the above manifest. Even when the target is missing it wasn''t running the exec. The following code will run the exec if the target is a broken symlink but will not run it if the target it a valid symlink: puppet apply -e ''exec { "/bin/touch /opt/exec.did.run": creates => "/opt/test.link" }'' So, again, my former conclusion was incorrect. ''creates'' appears to be smart enough to recognize a broken symlink as a missing file. -- Peter M. Bukowinski Sr. Systems Engineer Janelia Farm Research Campus, HHMI -- 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 Mar 14, 4:40 pm, Peter Bukowinski <pmb...@gmail.com> wrote:> On Mar 14, 2012, at 5:20 PM, Peter Bukowinski wrote: > > > > > > > On Mar 14, 2012, at 5:00 PM, Eugene Vilensky wrote: > > >>>> On Monday, March 12, 2012 5:52:53 PM UTC-5, ed209 wrote: > > >>>>> Checkout the ''creates'' property, it seems like a cleaner way of doing > >>>>> this: > > >>>>>http://docs.puppetlabs.com/references/2.6.8/type.html#exec > > >>>> Pardon the newbie question, but does work on or de-reference symlinks? > > >> On Tue, Mar 13, 2012 at 3:51 PM, Mohamed Lrhazi <lrh...@gmail.com> wrote: > >>> You might want to rephrase your question, as it is not obvious, at > >>> least not to me. > > >>> Mohamed. > > >> If the "creates" property of a Exec points to a symlink, what is the > >> effect if the target of the symlink is missing? > > > The exec will not run in this case. The ''creates'' attribute looks for something to exist at the specified path. A symlink, even if broken, is still a file. > > > These hypotheticals are simple to test out on your own. To test this case on any puppet client, first create a class: > > > #test.pp: > > class test { > > exec { ''touch /opt/test.did.run'': creates => ''/opt/test.link'' } > > } > > > Then create a symlink to a non-existent file: > > > ln -s /opt/nada /opt/test.link > > > Finally: > > > puppet apply test.pp > > > /opt/test.did.run won''t be created. > > Apologies, I was completely wrong. Must be something amiss with the above manifest. Even when the target is missing it wasn''t running the exec. The following code will run the exec if the target is a broken symlink but will not run it if the target it a valid symlink: > > puppet apply -e ''exec { "/bin/touch /opt/exec.did.run": creates => "/opt/test.link" }'' > > So, again, my former conclusion was incorrect. ''creates'' appears to be smart enough to recognize a broken symlink as a missing file.I don''t call that "smart", I call it "buggy". The target of a symlink is not the symlink itself. Even a broken symlink named in an Exec''s ''creates'' should be sufficient to prevent that Exec from running. At best, the documentation is inadequate. I encourage you to file an issue report. John -- 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 Mar 15, 2012, at 8:54 AM, jcbollinger wrote:> > > On Mar 14, 4:40 pm, Peter Bukowinski <pmb...@gmail.com> wrote: >> On Mar 14, 2012, at 5:20 PM, Peter Bukowinski wrote: >>> On Mar 14, 2012, at 5:00 PM, Eugene Vilensky wrote: >> >>>> If the "creates" property of a Exec points to a symlink, what is the >>>> effect if the target of the symlink is missing? >> >>> The exec will not run in this case. The ''creates'' attribute looks for something to exist at the specified path. A symlink, even if broken, is still a file. >> >>> These hypotheticals are simple to test out on your own. To test this case on any puppet client, first create a class: >> >>> #test.pp: >>> class test { >>> exec { ''touch /opt/test.did.run'': creates => ''/opt/test.link'' } >>> } >> >>> Then create a symlink to a non-existent file: >> >>> ln -s /opt/nada /opt/test.link >> >>> Finally: >> >>> puppet apply test.pp >> >>> /opt/test.did.run won''t be created. >> >> Apologies, I was completely wrong. Must be something amiss with the above manifest. Even when the target is missing it wasn''t running the exec. The following code will run the exec if the target is a broken symlink but will not run it if the target it a valid symlink: >> >> puppet apply -e ''exec { "/bin/touch /opt/exec.did.run": creates => "/opt/test.link" }'' >> >> So, again, my former conclusion was incorrect. ''creates'' appears to be smart enough to recognize a broken symlink as a missing file. > > > I don''t call that "smart", I call it "buggy". The target of a symlink > is not the symlink itself. Even a broken symlink named in an Exec''s > ''creates'' should be sufficient to prevent that Exec from running. At > best, the documentation is inadequate. I encourage you to file an > issue report. > > > JohnSubmitted. http://projects.puppetlabs.com/issues/13126 -- Peter M. Bukowinski Sr. Systems Engineer Janelia Farm Research Campus, HHMI -- 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.