Hi,

On 12/14/2015 04:12 PM, John Bollinger wrote:
>     So if I wanted to run some validation in the type code, where does
>     that get run?  node or master?
> 
> 
> 
> Validation and munging hooks for property and parameter values
> definitely run on the master.  If you try to specify an invalid value
> then catalog building will fail.  I don't recall whether they run again
> on the node.

Nope. All the compiler does is make sure that all attributes you specify
are available for the resource type in question.

All hooks are invoked by the agent. Yes, the whole catalog will fail
before any resource is checked or synced, but that's because validation
etc. is run at the very start of the agent transaction.

>      The reason why I am asking because not only do I want to validate
>     that the user specified a absolute path, but also verify the file
>     exists.  But this would only work if the File.exists? method in the
>     validate block for the type code is executed on the node.
> 
> 
> 
> This is not a job for a validation hook, but your provider can perform
> such a test at whatever point is appropriate, and fail the resource if
> need be.  Since it is conceivable that the file of interest might itself
> be managed by Puppet, this also seems like a textbook case for an
> autorequire
> <https://docs.puppetlabs.com/guides/custom_types.html#automatic-relationships>
> -- /that/ would appear in the type, not the provider.

Agreed! Validation should be a function that yields the same result for
the same input in any circumstance.

Cheers,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/566EEE5F.8040009%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to