Actions
Bug #24935
closedbelongs_to_proxy doesn't validate :required option
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
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
Updated by The Foreman Bot over 6 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
Updated by Stephen Benjamin over 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 75d02d8ebf2f23999b1d8eda1e390ec52f00c01b.
Actions