Stdlib and Defined Types

37 views
Skip to first unread message

Trevor Vaughan

unread,
Dec 12, 2013, 3:30:26 PM12/12/13
to puppet...@googlegroups.com
All,

Does anyone know of a way to add a file-centric backtrace to the validate functions in the Stdlib?

If you use a validator in a defined type, you end up not having any idea what actually threw the error.

Though much has moved to parameterized classes, there are still times when defines are useful and it would be nice to know what calling class/define/stack was blowing up.

Thanks,

Trevor

--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvau...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

William Leese

unread,
Dec 13, 2013, 2:22:20 AM12/13/13
to puppet...@googlegroups.com
On Friday, December 13, 2013 5:30:26 AM UTC+9, Trevor Vaughan wrote:
Does anyone know of a way to add a file-centric backtrace to the validate functions in the Stdlib?

If you use a validator in a defined type, you end up not having any idea what actually threw the error.

 Annoying indeed - had this issue quite often as well. What you want is to change this in your checkout of stdlib (modules/stdlib):

For spec/unit/puppet/parser/functions/validate_*_spec.rb

Change all:
expect { scope.compiler.compile }.to raise_error(Puppet::ParseError

to:
expect { scope.compiler.compile }.to raise_error(Puppet::Error

Trevor Vaughan

unread,
Dec 13, 2013, 9:03:17 AM12/13/13
to puppet...@googlegroups.com
William,

Thanks for the response. Ironically, I was trying to figure out how to change it in production.

I had a case where all of my tests passed but production was failing. It turned out to be some strange hiera-fu but it would have been *much* easier to be able to just get the file path directly.

Thanks,

Trevor


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/6fec71ff-df7c-4f66-a2a5-21be0e68d587%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages