diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-23 15:04:45 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-23 15:04:45 +0000 |
commit | 90453d177f99b6fee811bf36e77b03c66bf80d5e (patch) | |
tree | 2cb8410ed041b8c99c996c0cc346406f69ad7aac | |
parent | fca8c7264840b5d6b65d3c7b44d72b52f08b1543 (diff) | |
download | puppet-90453d177f99b6fee811bf36e77b03c66bf80d5e.tar puppet-90453d177f99b6fee811bf36e77b03c66bf80d5e.tar.gz puppet-90453d177f99b6fee811bf36e77b03c66bf80d5e.tar.bz2 puppet-90453d177f99b6fee811bf36e77b03c66bf80d5e.tar.xz puppet-90453d177f99b6fee811bf36e77b03c66bf80d5e.zip |
mga-common: add hash_keys function
This function takes a hash as argument and return the hash keys as a
list.
-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 |