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
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