Ask Your Question

Is there a "failing autorequire" for custom type developement?

asked 2016-01-05 21:15:39 -0600

Arney gravatar image

A resource of this minimal custom type

Puppet::Type.newtype(:database) do
  autorequire(:file) do

will ...

  • be synced after File['/etc/my.conf'] if the latter is defined
  • be synced without failure otherwise

Question: Can I cause the compilation to fail if File['/etc/my.conf'] is not defined?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-06 00:20:56 -0600

You can say:

unless defined(File['/etc/my.conf']) {
  fail("expected catalog to contain File['/etc/my.conf']")
edit flag offensive delete link more


D'Oh, I should [RTFM](, thanks!

Arney gravatar imageArney ( 2016-01-07 04:36:36 -0600 )edit

It helps knowing where to look. :)

Alex Harvey gravatar imageAlex Harvey ( 2016-01-07 05:33:35 -0600 )edit

... but then again this only works in manifests, not in custom types ...

Arney gravatar imageArney ( 2016-01-12 18:08:22 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2016-01-05 21:15:39 -0600

Seen: 59 times

Last updated: Jan 06 '16