Puppet Function: collectd_dsl
- Defined in:
- lib/puppet/parser/functions/collectd_dsl.rb
- Function type:
- Ruby 3.x API
Overview
Returns a collectd configuration snippet, provided ruby code matching the structure of collectd configuration files. See github.com/pyr/collectd-dsl for the details.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/puppet/parser/functions/collectd_dsl.rb', line 28 newfunction(:collectd_dsl, :type => :rvalue, :doc => <<-EOS Returns a collectd configuration snippet, provided ruby code matching the structure of collectd configuration files. See https://github.com/pyr/collectd-dsl for the details. EOS ) do |args| begin require 'collectd-dsl' rescue LoadError raise Puppet::ParseError, "collectd_dsl(): 'collectd-dsl' gem not installed on the puppetmaster" end if (args.size != 1) then raise Puppet::ParseError, "collectd_dsl(): Wrong number of arguments, given #{args.size} for 1" end case args[0] when String config = args[0] else config = recparse(args[0]) end Collectd::DSL.parse do eval(config) end end |