From 83940f5dadd68d50afe4191c70ac882f8e676115 Mon Sep 17 00:00:00 2001 From: Luca Filipozzi Date: Wed, 16 May 2012 18:22:12 +0000 Subject: [PATCH] frustrating development cycle --- modules/debian-org/lib/facter/cluster.rb | 18 +++++++++++------- modules/motd/templates/motd.erb | 19 ++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/modules/debian-org/lib/facter/cluster.rb b/modules/debian-org/lib/facter/cluster.rb index 3588868c9..84066de80 100644 --- a/modules/debian-org/lib/facter/cluster.rb +++ b/modules/debian-org/lib/facter/cluster.rb @@ -1,13 +1,17 @@ Facter.add('cluster') do setcode do - 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 - '' + 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 end + else + '' end end end diff --git a/modules/motd/templates/motd.erb b/modules/motd/templates/motd.erb index 1a3bf1988..92dd5c1e5 100644 --- a/modules/motd/templates/motd.erb +++ b/modules/motd/templates/motd.erb @@ -101,15 +101,16 @@ end if scope.hiera('cluster') - purp += "\nganeti cluster: " + hiera('cluster') + " contains these nodes:\n" - scope.hiera_array('nodes').each do |node| - purp += "\t" + node - if node.eql?(fqdn) - purp += " (this system)" - end - purp += "\n" - end - purp += "\n" + purp += "\nMember of ganeti cluster: " + scope.hiera('cluster') + ".\n" + #purp += "\nganeti cluster: " + scope.hiera('cluster') + " contains these nodes:\n" + #scope.hiera_array('nodes').each do |node| + # purp += "\t" + node + # if node.eql?(fqdn) + # purp += " (this system)" + # end + # purp += "\n" + #end + #purp += "\n" end -- 2.20.1