And here's the bug to track --> http://projects.puppetlabs.com/issues/10367

On Tue, Apr 17, 2012 at 12:31 PM, Eric Shamow <e...@puppetlabs.com> wrote:

> As a +1 on this (and as the guy who wrote safe_hiera) --
>
> It shouldn't be a function, the safety should be wrapped into hiera.  But
> yes, this will get you the right syntax so you can just search/replace
> safe_hiera for hiera once it's fixed.
>
> -Eric
>
> --
>
> Eric Shamow
> Professional Services
> http://puppetlabs.com/
> (c)631.871.6441
>
> On Tuesday, April 17, 2012 at 12:29 PM, Gary Larizza wrote:
>
> Hey Geoff,
>
> We actually had a talk about this.  There is this code that will help
> catch that scenario FOR NOW -->
> https://github.com/puppetlabs/hiera-puppet/pull/23
>
> I believe this is a bug and should DEFINITELY be fixed in source.  Until
> then, the 'safe_hiera()' function allows you to make this check.
>
>
>
> On Tue, Apr 17, 2012 at 12:21 PM, Geoff Davis <gada...@ucsd.edu> wrote:
>
> Alas that doesn't work as the manifest fails to compile properly without
> the /etc/puppet/hiera.yaml file being there.
>
> Nan's code does provide defaults for the hiera lookups similar to what you
> are doing below, but the compiler balks before they are even evaluated.
>
> Here's the version of staging/init.pp that generated the error below:
> https://github.com/nanliu/puppet-staging/blob/5e1a8763ae36c2ea21c0a5b6a1f0e586e077f0fd/manifests/init.pp
>
> Note that all of the hiera calls have defaults.
>
> Geoff Davis
> Scripps Institution of Oceanography
> gada...@ucsd.edu, (858) 822-5756
>
>
>
> On Apr 17, 2012, at 12:14 PM, Gary Larizza wrote:
>
> Hey Geoff,
>
> I see that as two separate steps (Is Hiera enabled and is Hiera
> configured).  I think the function satisfies the former, but you might want
> to write your own check for the latter (as each person probably interprets
> 'configured' differently).  You could do a check like:
>
> if function_available('hiera') and hiera('hiera_enabled', false) {
>   <do something with hiera>
> } else {
>   <do something without hiera>
> }
>
> This would do a hiera lookup for a parameter 'hiera_enabled' that could be
> set in your common/global.yaml file (while defaulting to false if it's not
> found).
>
>
>
> On Tue, Apr 17, 2012 at 12:09 PM, Geoff Davis <gada...@ucsd.edu> wrote:
>
> I've found a potential issue, but I'm not sure if this is within the scope
> of function_available or not.
>
> The vagrant basebox I'm using actually does ship with puppet-hiera, but
> there's no /etc/puppet/hiera.yaml
>
> Thus, even though function_available('hiera') returns true, the function
> isn't actually usable:
>
> Hiera config file /etc/puppet/hiera.yaml not readable at
> /tmp/vagrant-puppet/modules-0/staging/manifests/init.pp:31 on node
> centos-6-vagrant.vagrantup.com
>
> Is there a way to check whether the function is actually usable as well?
>
> Geoff Davis
> Scripps Institution of Oceanography
> gada...@ucsd.edu, (858) 822-5756
>
>
>
> On Apr 17, 2012, at 11:56 AM, Ken Barber wrote:
>
> I'm going to review this now. Its destined for master, so someone from
> the release team can probably comment on the next major release
> schedule for stdlib.
>
> On Tue, Apr 17, 2012 at 7:35 PM, Geoff Davis <gada...@ucsd.edu> wrote:
>
> That's what I'm looking for. I'll fold in that branch into my testing until
> it goes mainline.
>
> Any ETA on it going mainline?
>
>
> On Apr 17, 2012, at 11:14 AM, Nigel Kersten wrote:
>
>
>
> On Tue, Apr 17, 2012 at 11:08 AM, Geoff Davis <gada...@ucsd.edu> wrote:
>
>
> I'm doing some work on module development inside of a Vagrant VM of CentOS
> 6.2. This VM has the community version of Puppet installed (2.7.13 I
> think),
> but that doesn't include Hiera by default.
>
> My module is dependent on Nan Liu's puppet-staging module, which requires
> hiera. This puts me into the proverbial chicken and egg problem of not
> having a puppet function but also not being able to install it with puppet,
> since my manifests don't compile due to the hiera function not being
> available.
>
> Right now, I'm doing a manual bootstrap of a new vagrant box with a
> dedicated Puppet manifest that calls another one of Nan's modules,
> puppet-hiera, to install hiera on the Vagrant VM, but I'd rather use the
> same manifest for both bootstrap and module testing. I don't care if it
> takes two passes to converge, I just don't want a freshly booted Vagrant
> box
> to complain because it can't compile it's manifest.
>
> Is there a relatively foolproof way to determine if Puppet has a function
> available to it or not? Is there a "has_function" function available in the
> Puppet DSL, or is there a check that I could roll into a fact that works
> cross-platform and between Puppet Enterprise and Community?
>
>
> There's a pending pull request in the stdlib module for adding a
> function_available function
>
> https://github.com/puppetlabs/puppetlabs-stdlib/pull/59
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
>
> --
>
> Gary Larizza
> Professional Services Engineer
> Puppet Labs
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
>
>
> --
>
> Gary Larizza
> Professional Services Engineer
> Puppet Labs
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 

Gary Larizza
Professional Services Engineer
Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to