Project

General

Profile

Actions

Bug #24935

closed

belongs_to_proxy doesn't validate :required option

Added by Stephen Benjamin over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Smart Proxy
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

belongs_to_proxy ignores the `required` option, so you can set invalid proxy ID's, which ends up hitting database constraints. For example:

$ hammer -u admin -p changeme realm create --name Potato --realm-proxy-id '941' --realm-type FreeIPA
Could not create the realm:
  PG::ForeignKeyViolation: ERROR:  insert or update on table "realms" violates foreign key constraint "realms_realm_proxy_id_fk" 
  DETAIL:  Key (realm_proxy_id)=(941) is not present in table "smart_proxies".
  : INSERT INTO "realms" ("name", "realm_type", "realm_proxy_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" 

Whereas it should say something like this:

$ hammer -u admin -p changeme realm create --name Potato --realm-proxy-id '941' --realm-type FreeIPA
Could not create the realm:
  Realm proxy was not found
Actions #1

Updated by Stephen Benjamin over 5 years ago

  • Bugzilla link set to 1599322
Actions #2

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Stephen Benjamin
  • Pull request https://github.com/theforeman/foreman/pull/6064 added
Actions #3

Updated by Timo Goebel over 5 years ago

  • Fixed in Releases 1.20.0 added
Actions #4

Updated by Stephen Benjamin over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF