Ask Your Question

how is a refresh even triggered in a provider?

asked 2014-08-25 01:41:28 -0600

jasper gravatar image

How is it decided that "something" triggers a refresh event? I.e. a filechange triggers it, but I'd like to know where/how it's decided what actions exactly trigger it.

The mount type has:

newtype(:mount, :self_refresh => true) do

Which indicates that every change to a resource triggers a refresh, but how could I make this selective? I.e. annotate a property of a type as "when this changes, trigger a refresh"?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-25 10:41:31 -0600

domcleal gravatar image

Any property change results in a refresh event which will propagate automatically to any other resource with a subscribe/notify relationship.

:self_refresh has a specific purpose, which is to refresh the resource itself when one property changes. The mount type uses this because it actually models two resources (a (v)fstab entry and a live mountpoint, something that mountproviders fixes, but never took off), so the selfrefresh makes it possible for the resource to refresh the mountpoint when the fstab entry changes.

Generally I don't believe you can change which property changes generate a refresh, however if your type is receiving notifications then you can implement the refresh method on the type to ignore refreshes under whatever conditions you wish.

The other mechanism for ignoring received refreshes was added in Puppet 3.3 and is used to ignore refresh events when a property has changed to a particular value. It's used in services to ignore restart requests when the ensure property has changed to running (we don't want to restart a service after it's transitioned to running, it'd be pointless.)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2014-08-25 01:41:28 -0600

Seen: 743 times

Last updated: Aug 25 '14