Em 19/09/15 09:38, Julian Meier escreveu:
On 18 Sep 2015, at 23:36, Joao Morais <[email protected]> wrote:

Hello list. I am using the hiera() lookup function in order to
query some few attributes from a http backend. Something like this:

   common.yaml
   ---
   ...
   class::attr: "%{hiera('other::attr')}"

This works very well if other::attr is defined, but an empty
string is returned in the lookup above if the other::attr isn't
found. The hiera() function on the manifest fails the compilation
if I do the same query, which is what I'd expect from the lookup
above.

Is there a way to enforce the declaration of the other::attr when
using hiera() lookup function inside the hieradata?

Hi

Can't you just set a fallback or default value in the manifest?

Example: `$attr = hiera('other::attr','fallback')`

http://docs.puppetlabs.com/hiera/1/puppet.html#hiera-lookup-functions

Hi, unfortunately this doesn't solve the problem I am facing: the user _need_ to fill the "other::attr" data in the http backend or the catalog compilation should fail. A default or blank value in my scenario means wrong configuration which should't be applied. The compilation failing does happen with hiera() inside manifests and I was expecting a way to mimic this same behavior with hiera() inside hieradata.


--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/55FDB010.4000105%40joaomorais.com.br.
For more options, visit https://groups.google.com/d/optout.

Reply via email to