Mercurial > repos > other > Puppet
view modules/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb @ 189:3c03d3d03656 puppet-3.6
Switch to new Postfix SASL filter (no longer a separate file)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 10 Feb 2019 16:13:24 +0000 |
parents | 956e484adc12 |
children |
line wrap: on
line source
module Puppet::Parser::Functions newfunction(:mysql_strip_hash, :type => :rvalue, :arity => 1, :doc => <<-EOS TEMPORARY FUNCTION: EXPIRES 2014-03-10 When given a hash this function strips out all blank entries. EOS ) do |args| hash = args[0] unless hash.is_a?(Hash) raise(Puppet::ParseError, 'mysql_strip_hash(): Requires hash to work with') end # Filter out all the top level blanks. hash.reject{|k,v| v == ''}.each do |k,v| if v.is_a?(Hash) v.reject!{|ki,vi| vi == '' } end end end end