More logging and workaround for missed facts

This commit is contained in:
Dmitry Pyzhov 2013-03-06 16:50:08 +04:00 committed by default
parent b0c51fc3b4
commit 82cf204a42
5 changed files with 19 additions and 20 deletions

View File

@ -20,6 +20,7 @@ module MCollective
else
f = File.open(fname,'w')
f.close
File.open("/var/log/facter.log", "a") {|f| f.write("#{Time.now} EMPTY facts saved\n")}
return {}
end
rescue
@ -39,8 +40,10 @@ module MCollective
f.puts("#{k} = #{v}")
end
f.close
File.open("/var/log/facter.log", "a") {|f| f.write("#{Time.now} facts saved\n")}
return true
rescue
File.open("/var/log/facter.log", "a") {|f| f.write("#{Time.now} facts NOT saved\n")}
return false
end
end

View File

@ -1,8 +1,3 @@
#if $str($getVar('puppet_auto_setup','')) == "1"
# generate puppet certificates and trigger a signing request, but
# don't wait for signing to complete
/usr/sbin/puppetd --test --waitforcert 0
#end if
#if $str($getVar('puppet_enable', '')) == "1"
# turn puppet service on for reboot
/sbin/chkconfig puppet on

View File

@ -1,14 +0,0 @@
require 'facter'
if File.exist?("/etc/naily.facts")
File.readlines("/etc/naily.facts").each do |line|
if line =~ /^(.+)=(.+)$/
var = $1.strip;
val = $2.strip
Facter.add(var) do
setcode { val }
end
end
end
end

View File

@ -7,7 +7,7 @@ $openstack_version = {
'cinder' => 'latest',
}
tag("x${deployment_id}::${::environment}")
tag("${deployment_id}::${::environment}")
node default {
include osnailyfacter

View File

@ -1,6 +1,18 @@
require 'facter'
#begin
# Timeout::timeout(60) do
# until File.exists?("/etc/naily.facts")
# File.open("/tmp/facter.log", "a") {|f| f.write("#{Time.now} Waiting for facts\n")}
# sleep(1)
# end
# end
#rescue Timeout::Error
# File.open("/tmp/facter.log", "a") {|f| f.write("#{Time.now} Tired of waiting\n")}
#end
if File.exist?("/etc/naily.facts")
File.open("/var/log/facter.log", "a") {|f| f.write("#{Time.now} facts exist\n")}
File.readlines("/etc/naily.facts").each do |line|
if line =~ /^(.+)=(.+)$/
var = $1.strip;
@ -9,6 +21,9 @@ if File.exist?("/etc/naily.facts")
Facter.add(var) do
setcode { val }
end
File.open("/var/log/facter.log", "a") {|f| f.write("#{Time.now} fact '#{var}' = '#{val}'\n")}
end
end
else
File.open("/var/log/facter.log", "a") {|f| f.write("#{Time.now} facts NOT exist\n")}
end