Project

General

Profile

Actions

Bug #5925

closed

node.rb fails on first run

Added by Adam Winberg almost 10 years ago. Updated about 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
External Nodes
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

node.rb fails on first run because of missing yaml file.

in node.rb, def generate_fact_request, this line:
last_fact = File.stat(filename).mtime.utc

causes node.rb to 'crash' if the file does not exist (i.e. on first puppetrun) with error message 'No such file or directory - /var/lib/puppet/yaml/facts/<fqdn>.yaml'.

Adding a simple check before above mentioned line fixes the problem:
if File.exists?(filename)
last_fact = File.stat(filename).mtime.utc
else
#print "No yaml file, probably first run. Will not push facts to foreman"
return
end

Feels like a bug, but maybe we're doing something wrong..?

Actions

Also available in: Atom PDF