Project

General

Profile

Actions

Bug #3515

closed

Associated resources not found by ID causes 500 Internal Server Error

Added by Dominic Cleal over 10 years ago. Updated almost 6 years ago.

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

Description

Description of problem:
making call of hammer cli:

`hammer --output base subnet create --name "allparams" --network "251.10.10.11" --mask "255.255.255.0" --gateway "251.10.10.255" --dns-primary "251.10.11.255" --dns-secondary "251.10.12.255" --from "251.10.10.10" --to "251.10.10.12" --vlanid "2" --domain-ids "1"` just fails with:
===
Could not create the subnet:
  Error: 500 Internal Server Error

Actual results:
500 - ISE

Expected results:
no exception. subnet needs to be created. Even if there is any error: proper message should be returned back.

Foreman production.log:

Started POST "/foreman/api/subnets" for 127.0.0.1 at 2013-10-25 06:23:19 -0400
Processing by Api::V1::SubnetsController#create as JSON
  Parameters: {"subnet"=>{"dns_secondary"=>"251.10.12.255", "network"=>"251.10.10.11", "from"=>"251.10.10.10", "mask"=>"255.255.255.0", "vlanid"=>"2", "to"=>"251.10.10.12", "domain_ids"=>["1"], "gateway"=>"251.10.10.255", "dns_primary"=>"251.10.11.255", "name"=>"allparams"}}
Authorized user admin(Admin User)
Couldn't find Domain with id=1 (ActiveRecord::RecordNotFound)

(https://bugzilla.redhat.com/show_bug.cgi?id=1023393)


Related issues 1 (0 open1 closed)

Blocks Hammer CLI - Bug #3915: Hammer does not handle 404s wellClosedTomáš Strachota12/18/2013Actions
Actions #1

Updated by Anonymous over 10 years ago

  • Target version set to 1.10.0
Actions #2

Updated by Tomáš Strachota over 10 years ago

  • Project changed from Hammer CLI to Foreman
  • Category changed from Foreman commands (obsolete) to API

This is actually problem on api side. I've switched the project/category of the bug.

Api should return 404 with better message when an associated resource is not found.
From the foreman log:

 Domain Load (0.1ms)  SELECT "domains".* FROM "domains" WHERE "domains"."id" = $1 ORDER BY domains.name LIMIT 1  [["id", 83]]
Couldn't find Domain with id=83 (ActiveRecord::RecordNotFound)

...

  Rendered api/v2/errors/standard_error.json.rabl (0.6ms)
Completed 500 Internal Server Error in 19.5ms (Views: 9.7ms | ActiveRecord: 1.7ms)

Actions #3

Updated by Anonymous over 10 years ago

  • Target version changed from 1.10.0 to 1.9.3
Actions #5

Updated by Dominic Cleal over 10 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Daniel Lobato Garcia
Actions #6

Updated by Daniel Lobato Garcia over 10 years ago

  • Related to Bug #3915: Hammer does not handle 404s well added
Actions #7

Updated by Daniel Lobato Garcia over 10 years ago

  • Related to deleted (Bug #3915: Hammer does not handle 404s well)
Actions #8

Updated by Daniel Lobato Garcia over 10 years ago

  • Blocks Bug #3915: Hammer does not handle 404s well added
Actions #9

Updated by Anonymous over 10 years ago

  • Target version changed from 1.9.3 to 1.9.2
Actions #10

Updated by Dominic Cleal over 10 years ago

  • translation missing: en.field_release set to 2
Actions #11

Updated by Daniel Lobato Garcia over 10 years ago

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

Also available in: Atom PDF