Project

General

Profile

Feature #1963

Make automatic host creation switchable

Added by Nacho Barrientos over 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Facts
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Hi,

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)
350 
351     h = Host.find_by_certname facts.name
352     h ||= Host.find_by_name facts.name
353     h ||= Host.new :name => facts.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     logger.info "processing report for #{report.host}" 
 77     begin
 78       host = Host.find_by_certname report.host
 79       host ||= Host.find_by_name report.host
 80       host ||= Host.new :name => report.host
[...]

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.

Thanks
N


Related issues

Related to Foreman - Feature #2752: Make automatic host creation switchable for reportsDuplicate2012-11-21
Related to Foreman - Feature #3364: Add option to disable automatc host creation when a report is receivedClosed2013-10-18

Associated revisions

Revision 554be427 (diff)
Added by Nacho Barrientos about 9 years ago

fixes #1963 - prevent host creation when facts are uploaded via new setting

History

#1 Updated by Dominic Cleal about 9 years ago

  • Category set to Facts
  • Status changed from New to Ready For Testing
  • Target version set to 1.3.0

https://github.com/theforeman/foreman/pull/647

PR only covers the facts portion of this

#2 Updated by Nacho Barrientos about 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal almost 9 years ago

  • Related to Feature #3364: Add option to disable automatc host creation when a report is received added

Also available in: Atom PDF