Project

General

Profile

Actions

Bug #8358

closed

No validation of domain in host

Added by Shlomi Zadok about 10 years ago. Updated over 6 years ago.

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

Description

When updating a host, there is no validation whether the domain exists [if it does not exist, it is ignored - instead of throwing domain does not exist]
Steps to reproduce:

Via Hammer:

hammer -d host update --name <<server.fqdn>> --domain-id 1935

hammer -d host update --name <<server.fqdn>> --domain-id shlomizadok

both return Host updated.

Via Api:

Started PUT "/api/v2/hosts/smartproxy.local.lan" for 127.0.0.1 at 2014-11-12 09:25:35 +0200
Processing by Api::V2::HostsController#update as JSON
  Parameters: {"host"=>{"domain_id"=>"shlomi"}, "apiv"=>"v2", "id"=>"smartproxy.local.lan"}
...
Completed 200 OK in 368.9ms

Expected result:
Return an error "Could not update host"
Example:

hammer -d host update --name smartproxy.local.lan --medium-id 232134

Returns:

DETAIL:  Key (medium_id)=(232134) is not present in table "media".

Could not update the host:
  ERROR:  insert or update on table "hosts" violates foreign key constraint "hosts_medium_id_fk" 
  DETAIL:  Key (medium_id)=(232134) is not present in table "media".

Actions #1

Updated by Dominic Cleal about 10 years ago

  • Category set to API
Actions #2

Updated by The Foreman Bot almost 10 years ago

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

Updated by Marek Hulán over 9 years ago

  • Translation missing: en.field_release set to 28

I guess as a bug this goes 1.8

Actions #4

Updated by Shlomi Zadok over 9 years ago

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

Also available in: Atom PDF