On Tue, Apr 19, 2011 at 8:08 PM, Nigel Kersten <ni...@puppetlabs.com> wrote:
> On Tue, Apr 19, 2011 at 6:28 PM, Miki Shapiro <mikishap...@gmail.com> wrote:
>
>> $keys = split(",", inline_template("<%= netifcfg.keys.join(',') %>"))
>
> Honestly, I'd put this together as a Puppet function at this point, as
> that's just resulting in something rather unmaintainable.
>
> http://docs.puppetlabs.com/guides/custom_functions.html
>
> I'll have a quick stab at it in a second.
>



module Puppet::Parser::Functions
  newfunction(:hash_keys, :type => :rvalue) do |args|
    unless args[0].is_a?(Hash)
      Puppet.warning "hash_keys takes one argument, the input hash"
      nil
    else
      args[0].keys
    end
  end
end


save to lib/puppet/parser/functions/ in a module.


-- 
Nigel Kersten
Product, Puppet Labs
@nigelkersten

-- 
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