From: Peter Palfrader Date: Tue, 19 Jun 2012 17:56:21 +0000 (+0200) Subject: Use yaml over json - yaml is in the default ruby X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=7c3b43e4623cbfcf5656f2e0b23bf4d7ea85021a;p=mirror%2Fdsa-puppet.git Use yaml over json - yaml is in the default ruby --- diff --git a/modules/debian-org/lib/facter/cluster.rb b/modules/debian-org/lib/facter/cluster.rb index dfff43680..fea14355f 100644 --- a/modules/debian-org/lib/facter/cluster.rb +++ b/modules/debian-org/lib/facter/cluster.rb @@ -1,16 +1,16 @@ if FileTest.exist?('/usr/sbin/gnt-cluster') and FileTest.exist?('/var/lib/ganeti/config.data') begin if system('/usr/sbin/gnt-cluster getmaster >/dev/null') - require 'json' - json = JSON.parse(File.read('/var/lib/ganeti/config.data')) + require 'yaml' + yaml = YAML.load_file('/var/lib/ganeti/config.data') Facter.add('cluster') do setcode do - json['cluster']['cluster_name'] + yaml['cluster']['cluster_name'] end end Facter.add('cluster_nodes') do setcode do - json['nodes'].keys.join(' ') + yaml['nodes'].keys.join(' ') end end end