Faidon Liambotis has submitted this change and it was merged.

Change subject: librenms: make custom function compatible with puppet 3
......................................................................


librenms: make custom function compatible with puppet 3

Under puppet 3, all arguments of a function must be explicitly passed as
an anonymous array, even if they have just one element.

Change-Id: I21403f6e4546c0be294b4ee5a795d6f6ddbc059b
Signed-off-by: Giuseppe Lavagetto <glavage...@wikimedia.org>
---
M modules/librenms/lib/puppet/parser/functions/phpdump.rb
M modules/librenms/templates/config.php.erb
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, approved
  Faidon Liambotis: Verified; Looks good to me, approved



diff --git a/modules/librenms/lib/puppet/parser/functions/phpdump.rb 
b/modules/librenms/lib/puppet/parser/functions/phpdump.rb
index 0c094b5..03e3f2b 100644
--- a/modules/librenms/lib/puppet/parser/functions/phpdump.rb
+++ b/modules/librenms/lib/puppet/parser/functions/phpdump.rb
@@ -31,6 +31,7 @@
 module Puppet::Parser::Functions
   newfunction(:phpdump, :type => :rvalue) do |args|
     fail 'phpdump() requires an argument' if args.empty?
-    phpdump(args)
+    fail 'phpdump() cannot handle multiple values' if args.length > 1
+    phpdump(args.first)
   end
 end
diff --git a/modules/librenms/templates/config.php.erb 
b/modules/librenms/templates/config.php.erb
index ea9dbac..31ad31f 100644
--- a/modules/librenms/templates/config.php.erb
+++ b/modules/librenms/templates/config.php.erb
@@ -7,7 +7,7 @@
 $config['rrd_dir']     = "<%= @rrd_dir %>";
 $config['log_file']    = "/var/log/librenms.log";
 
-$puppet_config = <%= scope.function_phpdump(@config) %>;
+$puppet_config = <%= scope.function_phpdump([@config]) %>;
 
 $config = array_merge($config, $puppet_config);
 

-- 
To view, visit https://gerrit.wikimedia.org/r/133053
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I21403f6e4546c0be294b4ee5a795d6f6ddbc059b
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to