From: Luca Filipozzi Date: Wed, 16 May 2012 20:14:41 +0000 (+0000) Subject: refacter facter code X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=3c0b065a5fef2f3b734336d1aa1a7d4d41cb4b97;p=mirror%2Fdsa-puppet.git refacter facter code --- diff --git a/modules/debian-org/lib/facter/cluster.rb b/modules/debian-org/lib/facter/cluster.rb index 84066de80..fda38f98b 100644 --- a/modules/debian-org/lib/facter/cluster.rb +++ b/modules/debian-org/lib/facter/cluster.rb @@ -1,17 +1,11 @@ -Facter.add('cluster') do - setcode do - if FileTest.exist?('/usr/sbin/gnt-cluster') - if system('/usr/sbin/gnt-cluster getmaster >/dev/null') - require 'json' - config = '/var/lib/ganeti/config.data' - if FileTest.exist?(config) - JSON.parse(File.read(config))['cluster']['cluster_name'] - else - '' - end +if FileTest.exist?('/usr/sbin/gnt-cluster') + if system('/usr/sbin/gnt-cluster getmaster >/dev/null') + require 'json' + config = '/var/lib/ganeti/config.data' + Facter.add('cluster') do + setcode do + JSON.parse(File.read(config))['cluster']['cluster_name'] end - else - '' end end end