Feature #2752

Updated by Dominic Cleal almost 9 years ago

*Clone of #1963, which implemented this for facts, now needs doing for reports.*


In our environment we're pondering patching Foreman to make the automatic host creation when facts/reports are uploaded *optional* based on a configuration parameter.

(models/hosts.rb; line 353)


347 def self.importHostAndFacts yaml

348 facts = YAML::load yaml

349 return false unless facts.is_a?(Puppet::Node::Facts)


351 h = Host.find_by_certname

352 h ||= Host.find_by_name

353 h ||= :name =>



(models/report.rb; line 80)


73 def self.import(yaml)

74 report = YAML.load(yaml)

75 raise "Invalid report" unless report.is_a?(Puppet::Transaction::Report)

76 "processing report for #{}"

77 begin

78 host = Host.find_by_certname

79 host ||= Host.find_by_name

80 host ||= :name =>



Foreman is not just a visualization/reporting tool for us, it's sort of a source of truth. Thus, we don't want hosts to be created automatically on Foreman when they chat to the puppet masters. Basically, if the host is not in Foreman it does not exist for us.

The patch is quite simple, but we'd like to discuss what you think about the new feature before submitting a pull request.