diff options
-rw-r--r-- | modules/mga-common/lib/puppet/parser/functions/hash_keys.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/mga-common/lib/puppet/parser/functions/hash_keys.rb b/modules/mga-common/lib/puppet/parser/functions/hash_keys.rb new file mode 100644 index 00000000..3a926bee --- /dev/null +++ b/modules/mga-common/lib/puppet/parser/functions/hash_keys.rb @@ -0,0 +1,10 @@ +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 |