On Friday, December 11, 2015 at 3:09:49 PM UTC-6, Corey Osman wrote:
>
>
>
> On Friday, December 11, 2015 at 10:49:40 AM UTC-8, John Bollinger wrote:
>>
>>
>>
>> On Friday, December 11, 2015 at 11:08:08 AM UTC-6, Corey Osman wrote:
>>>
>>> Hi,
>>>
>>> I am curious on a few things
>>>
>>> 1. Is the custom type code run on the node or master, makes sense the 
>>> provider is but not sure about the type code.
>>>
>>
>>
>> As I understand it, a custom type's own code -- or at least parts of it 
>> -- runs both in the agent and in the master.  To the best of my knowledge, 
>> providers run only in the agent.
>>
>>  
>>
> 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.

 

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


John

-- 
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/06d6f7b8-c5e1-4942-a126-90994daf43f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to