]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
ah, exception loading json
authorStephen Gran <steve@lobefin.net>
Sun, 27 May 2012 19:01:55 +0000 (20:01 +0100)
committerStephen Gran <steve@lobefin.net>
Sun, 27 May 2012 19:01:55 +0000 (20:01 +0100)
Signed-off-by: Stephen Gran <steve@lobefin.net>
modules/debian-org/lib/facter/cluster.rb

index d7ef867d01b2ac6a8e16f58fe677ed3c4ed4c891..dfff4368087d43fb711f70196a07ec93a167ba35 100644 (file)
@@ -1,16 +1,19 @@
 if FileTest.exist?('/usr/sbin/gnt-cluster') and FileTest.exist?('/var/lib/ganeti/config.data')
-  if system('/usr/sbin/gnt-cluster getmaster >/dev/null')
-    require 'json'
-    json = JSON.parse(File.read('/var/lib/ganeti/config.data'))
-    Facter.add('cluster') do
-      setcode do
-        json['cluster']['cluster_name']
-      end
-    end
-    Facter.add('cluster_nodes') do
-      setcode do
-        json['nodes'].keys.join(' ')
-      end
-    end
-  end
+       begin
+               if system('/usr/sbin/gnt-cluster getmaster >/dev/null')
+                       require 'json'
+                       json = JSON.parse(File.read('/var/lib/ganeti/config.data'))
+                       Facter.add('cluster') do
+                               setcode do
+                                       json['cluster']['cluster_name']
+                               end
+                               end
+                               Facter.add('cluster_nodes') do
+                               setcode do
+                                       json['nodes'].keys.join(' ')
+                               end
+                       end
+               end
+       rescue Exception => e
+       end
 end