comparison modules/stdlib/lib/puppet/functions/to_json.rb @ 272:c42fb28cff86

Update to a newer Python module This also pulls in an EPEL module (which we don't use) and a newer stdlib version.
author IBBoard <dev@ibboard.co.uk>
date Fri, 03 Jan 2020 19:56:04 +0000
parents
children d9352a684e62
comparison
equal deleted inserted replaced
271:c62728474654 272:c42fb28cff86
1 # Take a data structure and output it as JSON
2 #
3 # @example how to output JSON
4 # # output json to a file
5 # file { '/tmp/my.json':
6 # ensure => file,
7 # content => to_json($myhash),
8 # }
9 #
10 #
11 require 'json'
12
13 Puppet::Functions.create_function(:to_json) do
14 dispatch :to_json do
15 param 'Any', :data
16 end
17
18 def to_json(data)
19 data.to_json
20 end
21 end