Puppet Function: wmflib::resource::dump_params
- Defined in:
- modules/wmflib/lib/puppet/functions/wmflib/resource/dump_params.rb
- Function type:
- Ruby 4.x API
Summary
this function is used to get a list of parameters passed to a resource, excluding the name parameter. This allows one to easily transform parameters into a json or yaml config file. or pass them directly from profile to a core class.Overview
SPDX-License-Identifier: Apache-2.0
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'modules/wmflib/lib/puppet/functions/wmflib/resource/dump_params.rb', line 10 Puppet::Functions.create_function(:'wmflib::resource::dump_params', Puppet::Functions::InternalFunction) do dispatch :dump_params do scope_param end def dump_params(scope) params = scope.resource.to_hash.collect{|k, v| [k.to_s, v]}.to_h params.delete('name') params # TODO: when ruby 2.5 everywhere # scope.resource.to_hash.transform_keys(&:to_s) end end |