From 5f7c97946997b63e32b009b11578159e826229ad Mon Sep 17 00:00:00 2001 From: Luca Filipozzi Date: Wed, 16 May 2012 17:55:55 +0000 Subject: [PATCH] add fact for ganeti cluster --- modules/debian-org/lib/facter/cluster.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 modules/debian-org/lib/facter/cluster.rb 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 -- 2.20.1