Type param validation & allowing for earlier catalogue resource creation...

17 views
Skip to first unread message

Gavin Williams

unread,
Jun 27, 2014, 10:54:41 AM6/27/14
to puppet...@googlegroups.com
Afternoon all,

I've just hit an issue with my Puppet-Glassfish module, where I'm using Type param validation to check for file existence on the client - typically on files that are also defined earlier in the catalogue, but have not yet been applied to the client.
An example is [1], with the file it's validating being created in [2].

However on the first run, the validation is rightly blowing out due to the file not existing - but it would by the time the resource was called if the puppet run proceeded...

Is there a way of handling this validation dependency scenario in a more Puppet friendly method?
As I'd like to retain the validation logic if possible, just to allow for more robust error handling...

Cheers
Gavin

[1] https://github.com/fatmcgav/fatmcgav-glassfish/blob/develop/lib/puppet/type/cluster.rb#L107-L111
[2] https://github.com/fatmcgav/fatmcgav-glassfish/blob/develop/manifests/init.pp#L155-L162

Felix Frank

unread,
Jun 27, 2014, 11:01:11 AM6/27/14
to puppet...@googlegroups.com
Hmm, I don't think a validate hook of any type parameter should take the
system state into account.

You should use it to make sure that whatever value was passed is
conceivably a fully qualified file name, but no more.

A missing file should lead to more of a "runtime" type of error, i.e.
properties that rely on a sound value will fail their sync or retrieve
actions. The Puppet transaction will deal with that while running. No
need to try and spoil it with overzealous initialization time checks.

Hope that makes sense, cheers,
Felix

Gavin Williams

unread,
Jun 27, 2014, 11:07:46 AM6/27/14
to puppet...@googlegroups.com
Felix

Cheers for the quick response...

Makes sense.. I'm using 'validate_absolute_path' in the manifests [1] so looks like I'm just being over-zelous on my validation... :)

Cheers
Gavin

[1] https://github.com/fatmcgav/fatmcgav-glassfish/blob/develop/manifests/create_cluster.pp#L57

Felix Frank

unread,
Jun 27, 2014, 11:15:50 AM6/27/14
to puppet...@googlegroups.com
On 06/27/2014 05:07 PM, Gavin Williams wrote:
>
> Makes sense.. I'm using 'validate_absolute_path' in the manifests [1] so
> looks like I'm just being over-zelous on my validation... :)

FWIW, I would limit that to defined types.

Seeing as you went to the length of creating an actual resource type for
this, doing all validation there is beneficial: It takes load from your
master (if you have one) and distributes it to the agents.

Best,
Felix
Reply all
Reply to author
Forward
0 new messages