FAQ
A quote from http://docs.puppetlabs.com/references/latest/type.html#exec

refreshHow to refresh this command. By default, the exec is just called
again when it receives an event from another resource, but this parameter
allows you to define a different command for refreshing.

A different command... like what? What does it add to 'refreshonly'
attribute?

Actually, what I'm looking for, is a conditional triggering of one exec by
another. That is exec1 notifies exec2 only if exec1 command has been
actually executed.
'onlyif' can prevent the execution of exec1 itself, but doesn't prevent,
say, notify=>Exec['2'] from happening.

Thanks.

--
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/-/zlP8oOScoFIJ.
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.

Search Discussions

  • Jcbollinger at Nov 26, 2012 at 3:18 pm

    On Friday, November 23, 2012 9:05:07 AM UTC-6, badbishop wrote:
    A quote from http://docs.puppetlabs.com/references/latest/type.html#exec

    refreshHow to refresh this command. By default, the exec is just called
    again when it receives an event from another resource, but this parameter
    allows you to define a different command for refreshing.

    A different command... like what?

    Anything you like, though some things make more sense than others. Here is
    a contrived example that I hope will communicate at least the spirit:

    exec { 'Puppet Timestamps':
    command => 'echo "first run:" > /var/log/puppet_timestamp; date >>
    /var/log/puppet_timestamp',
    refresh => 'touch /var/log/puppet_timestamp',
    creates => '/var/log/puppet_timestamp',
    provider => 'sh'
    }

    That will manage a file /var/log/puppet_timestamp whose text records a
    timestamp of the Puppet run in which it was created, and whose file
    timestamp is updated to the current time every time Puppet refreshes it.


    What does it add to 'refreshonly' attribute?

    The 'refreshonly' attribute allows the Exec's refresh action to be executed
    without first executing its synchronization action. Normally both the
    refresh and the synchronization action are given by the 'command' parameter
    (though I don't think that's quite how it should be, and there is a chance
    it will change in the future; see
    http://projects.puppetlabs.com/issues/5876). If you assign a 'refresh'
    parameter then that -- instead of the 'command' parameter -- gives the
    refresh action.


    Actually, what I'm looking for, is a conditional triggering of one exec by
    another. That is exec1 notifies exec2 only if exec1 command has been
    actually executed.
    'onlyif' can prevent the execution of exec1 itself, but doesn't prevent,
    say, notify=>Exec['2'] from happening.

    Then you are looking for the 'creates', 'unless', and/or 'onlyif'
    parameters of exec1. Use those to determine whether exec1 needs to run.
    If it is synchronized without actually running -- as controlled by those
    parameters -- then it will not broadcast events to other resources.

    If exec2 should do nothing when it does not receive an event from exec1,
    then you want "refreshonly => true" on exec2. The 'refresh' parameter is
    inappropriate for that use case.


    John

    --
    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/-/yl5lLT5M7GUJ.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedNov 23, '12 at 5:55p
activeNov 26, '12 at 3:18p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Badbishop: 1 post Jcbollinger: 1 post

People

Translate

site design / logo © 2021 Grokbase