]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Use yaml over json - yaml is in the default ruby
authorPeter Palfrader <peter@palfrader.org>
Tue, 19 Jun 2012 17:56:21 +0000 (19:56 +0200)
committerPeter Palfrader <peter@palfrader.org>
Tue, 19 Jun 2012 17:56:21 +0000 (19:56 +0200)
modules/debian-org/lib/facter/cluster.rb

index dfff4368087d43fb711f70196a07ec93a167ba35..fea14355f152900c1a1b3dcda28424fa1f5de912 100644 (file)
@@ -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