Project

General

Profile

Actions

Bug #22043

closed

Unable to create location with organization_ids: [1] - Organizations is invalid

Added by Tomer Brisker over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

During creation of a location, if it is assigned organizations which are invalid the creation fails as the location attempts to validate the associated organization. (This also happens the other way around). This is due to has_and_belongs_to_many defaulting to validating the associated records as well.

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1514915

Description of problem:

  1. curl -sku admin:changeme -d '{"location": {"name": "foo6", "organization_ids": [1]}}' -H 'Content-Type: application/json' https://$(hostname)/api/v2/locations {
    "error": {"id":null,"errors":{"organizations":["is invalid"]},"full_messages":["Organizations is invalid"]}
    }

- specifying other (existing) organization id(s) works as expected

Actual results:
Organizations is invalid

Expected results:
Location created and assigned to Default Organization

Actions #1

Updated by The Foreman Bot over 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/5104 added
Actions #2

Updated by Marek Hulán about 6 years ago

  • Subject changed from Unable to create location with organization_ids: [1] - Organizations is invalid to Unable to create location with organization_ids: [1] - Organizations is invalid
  • translation missing: en.field_release set to 296
Actions #3

Updated by Anonymous about 6 years ago

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

Also available in: Atom PDF