Project

General

Profile

Bug #14264

Getting 500 when creating host through API and not specifying any interface attributes

Added by Marek Hulán about 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Getting following trace

2016-03-18T12:43:29 [app] [W] Action failed
 | NoMethodError: undefined method `[]=' for nil:NilClass
 | /home/ares/Projekty/Zdrojaky/foreman/app/controllers/api/v2/hosts_controller.rb:289:in `host_attributes'
 | /home/ares/Projekty/Zdrojaky/foreman/app/controllers/api/v2/hosts_controller.rb:98:in `create'

https://github.com/theforeman/foreman/commit/38d9333f8e82e45fc6771ea7740e6ea625b97d3f is not careful enough, also I think it should be rather fixed in host model than in API controller.


Related issues

Related to Foreman - Bug #14239: Creating a host via API fails with cryptic error when no primary interface is set explicitlyClosed2016-03-16
Related to Foreman - Bug #14516: Host::Base#domain_id= delegated to primary_interface.domain_id=, but primary_interface is nilClosed2016-04-07

Associated revisions

Revision 308f611d (diff)
Added by Marek Hulán about 4 years ago

Fixes #14264 - improve primary interface selection

Revision 45831c5a (diff)
Added by Marek Hulán almost 4 years ago

Fixes #14264 - improve primary interface selection

(cherry picked from commit 308f611d9bb17173588a6f59c7a914b551923a7b)

History

#1 Updated by Marek Hulán about 4 years ago

  • Status changed from New to Assigned

#2 Updated by Dominic Cleal about 4 years ago

  • Related to Bug #14239: Creating a host via API fails with cryptic error when no primary interface is set explicitly added

#3 Updated by The Foreman Bot about 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3346 added

#4 Updated by Marek Hulán about 4 years ago

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

#5 Updated by Ohad Levy almost 4 years ago

  • Related to Bug #14516: Host::Base#domain_id= delegated to primary_interface.domain_id=, but primary_interface is nil added

Also available in: Atom PDF