aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mga-common/lib
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-05-23 15:04:47 +0000
committerNicolas Vigier <boklm@mageia.org>2013-05-23 15:04:47 +0000
commitc60e06a14be27017c613495a2fc6d157411bf344 (patch)
treea29bede93b12fea9bd12b05e65cc73272f3d99bb /modules/mga-common/lib
parent90453d177f99b6fee811bf36e77b03c66bf80d5e (diff)
downloadpuppet-c60e06a14be27017c613495a2fc6d157411bf344.tar
puppet-c60e06a14be27017c613495a2fc6d157411bf344.tar.gz
puppet-c60e06a14be27017c613495a2fc6d157411bf344.tar.bz2
puppet-c60e06a14be27017c613495a2fc6d157411bf344.tar.xz
puppet-c60e06a14be27017c613495a2fc6d157411bf344.zip
mga-common: add hash_merge function
This function takes two hashes as argument and return a new hash containing the content of the two hashes.
Diffstat (limited to 'modules/mga-common/lib')
-rw-r--r--modules/mga-common/lib/puppet/parser/functions/hash_merge.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/mga-common/lib/puppet/parser/functions/hash_merge.rb b/modules/mga-common/lib/puppet/parser/functions/hash_merge.rb
new file mode 100644
index 00000000..375bffa4
--- /dev/null
+++ b/modules/mga-common/lib/puppet/parser/functions/hash_merge.rb
@@ -0,0 +1,11 @@
+module Puppet::Parser::Functions
+ newfunction(:hash_merge, :type => :rvalue) do |args|
+ unless args[0].is_a?(Hash) and args[1].is_a?(Hash)
+ Puppet.warning "hash_merge takes two arguments"
+ nil
+ else
+ print "hash_merge\n"
+ args[0].merge(args[1])
+ end
+ end
+end