Project

General

Profile

Bug #2690

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

Added by Dominic Cleal about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Facts
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
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

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

Associated revisions

Revision 9628014a (diff)
Added by Joseph Magen about 6 years ago

fixes #2690 - undefined method gsub! for nil:NilClass on fact import

Revision 204d7484 (diff)
Added by Joseph Magen about 6 years ago

fixes #2690 - undefined method gsub! for nil:NilClass on fact import
(cherry picked from commit 9628014a44c9bbea74c62c0c8c2916937e9c98c4)

History

#1 Updated by Joseph Magen about 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Joseph Magen

#2 Updated by Joseph Magen about 6 years ago

  • Status changed from Assigned to Ready For Testing

#3 Updated by Joseph Magen about 6 years ago

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

Also available in: Atom PDF