Project

General

Profile

Actions

Bug #9634

closed

Creating a host via API without OS set gives undefined method `boot_filename' exception

Added by Lukas Zapletal almost 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DHCP
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

We already fixed this for Discovery UI, but the error remains for Foreman core when you try to create a host without OS set via API.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #5701: Creating a host without OS set gives undefined method `boot_filename' exceptionClosedLukas Zapletal05/13/2014Actions
Actions #1

Updated by Lukas Zapletal almost 10 years ago

  • Project changed from Foreman to Discovery
  • Category changed from API to Discovery plugin
  • Bugzilla link set to 1197975

Moving to discovery as I am not sure if we can reproduce this in core foreman.

Actions #2

Updated by Lukas Zapletal almost 10 years ago

Reproducer:

[root@dhcp207-190 fdi-image]# curl -i -k -u admin:changeme -H "Accept: application/json" -X GET 'https://dhcp207-190.lab.eng.pnq.redhat.com/api/v2/discovered_hosts/'
HTTP/1.1 200 OK

Status: 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{
"total": 1,
"subtotal": 1,
"page": 1,
"per_page": 20,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": [{"name":"mac52540054c6e2","id":4,"ip":"192.168.100.11","mac":"52:54:00:54:c6:e2","last_report":"2015-03-03T05:55:53Z","subnet_id":1,"subnet_name":"libvirt","memory":995,"disk_count":1,"disks_size":8192,"cpus":1,"organization_id":1,"organization_name":"Default Organization","location_id":2,"location_name":"Default Location"}]
}
---

Next, I tried to provision it:

[root@dhcp207-190 fdi-image]# curl -i -k -u admin:changeme -H "Content-Type: application/json" -X PUT 'https://dhcp207-190.lab.eng.pnq.redhat.com/api/v2/discovered_hosts/4'
HTTP/1.1 500 Internal Server Error

Status: 500 Internal Server Error
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{
"error": {"message":"undefined method `boot_filename' for nil:NilClass"}
}

We should give a nice error.

For the record: this patch (which was NOT merged) fixes this, but it is not clean. We should somehow detect earlier that OS was not set and raise a nicer error instead.

Actions #3

Updated by Lukas Zapletal almost 10 years ago

  • Target version set to Discovery Plugin 4.0.0
Actions #4

Updated by Lukas Zapletal almost 10 years ago

  • Related to Bug #5701: Creating a host without OS set gives undefined method `boot_filename' exception added
Actions #5

Updated by Lukas Zapletal almost 10 years ago

  • Target version changed from Discovery Plugin 4.0.0 to Discovery Plugin 2.0.1
Actions #6

Updated by Lukas Zapletal over 9 years ago

For the record there was a solution filed https://github.com/theforeman/foreman/pull/2026 but it was replaced by https://github.com/theforeman/foreman/pull/2120 (UI fix only). Not API/CLI.

Actions #7

Updated by Ori Rabin over 9 years ago

  • Project changed from Discovery to Foreman
  • Category deleted (Discovery plugin)
  • Status changed from New to Assigned
  • Assignee set to Ori Rabin
  • Target version deleted (Discovery Plugin 2.0.1)

This is also reproducible through the UI with a new host: create a host, fill in the interface but not the os and try to save

Actions #8

Updated by The Foreman Bot over 9 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2378 added
  • Pull request deleted ()
Actions #9

Updated by Dominic Cleal over 9 years ago

  • Category set to DHCP
  • Translation missing: en.field_release set to 50
Actions #10

Updated by Ori Rabin over 9 years ago

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

Also available in: Atom PDF