From: Luca Filipozzi Date: Wed, 16 May 2012 17:55:55 +0000 (+0000) Subject: add fact for ganeti cluster X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=5f7c97946997b63e32b009b11578159e826229ad;p=mirror%2Fdsa-puppet.git add fact for ganeti cluster --- diff --git a/modules/debian-org/lib/facter/cluster.rb b/modules/debian-org/lib/facter/cluster.rb new file mode 100644 index 000000000..6dee99f87 --- /dev/null +++ b/modules/debian-org/lib/facter/cluster.rb @@ -0,0 +1,12 @@ +Facter.add('cluster') do + setcode do + if system('/usr/sbin/gnt-cluster getmaster') + require 'json' + config = '/var/lib/ganeti/config.data' + if FileTest.exist?(config) + JSON.parse(File.read(config))['cluster']['cluster_name'] + else + '' + end + end +end