Project

General

Profile

Actions

Bug #2690

closed

undefined method `gsub!' for nil:NilClass on fact import

Added by Dominic Cleal over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Facts
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Fact imports fail on Fedora 18:

Started POST "/fact_values/create?format=yml" for 192.168.101.107 at 2013-06-21 12:14:32 +0000
Processing by FactValuesController#create as YML
  Parameters: {"facts"=>"[FILTERED]"}
Failed to import facts: undefined method `gsub!' for nil:NilClass
/usr/share/foreman/app/models/facts_importer.rb:34:in `operatingsystem'
/usr/share/foreman/app/models/host/base.rb:153:in `block in set_non_empty_values'
/usr/share/foreman/app/models/host/base.rb:152:in `each'
/usr/share/foreman/app/models/host/base.rb:152:in `set_non_empty_values'
/usr/share/foreman/app/models/host/base.rb:147:in `populateFieldsFromFacts'
/usr/share/foreman/app/models/host/managed.rb:380:in `populateFieldsFromFacts'
/usr/share/foreman/app/models/host/base.rb:79:in `importFacts'
/usr/share/foreman/app/models/host/managed.rb:370:in `importHostAndFacts'
/usr/share/foreman/app/controllers/fact_values_controller.rb:28:in `block in create'

It appears this code isn't capable of dealing with OS version numbers with a nil minor component:

app/models/facts_importer.rb:
 32         major, minor = orel.split(".")
 33         major.gsub!(/\D/,'') unless is_numeric? major
 34         minor.gsub!(/\D/,'') unless is_numeric? minor
 35         minor        ||= "" 

Related issues 1 (0 open1 closed)

Has duplicate Foreman - Bug #2729: Fedora 18 hosts do not update Properties: "undefined method `gsub!' for nil:NilClass" related?Duplicate07/01/2013Actions
Actions

Also available in: Atom PDF