Project

General

Profile

Actions

Bug #16415

closed

api/v2/ptables accepts only wrapped hash of attributes with "layout"

Added by roman plevka over 7 years ago. Updated over 5 years ago.

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

Description

# rpm -qa foreman
foreman-1.13.0-0.develop.201608221148git5908bf4.el7.noarch
# rpm -qa katello
katello-3.1.0-4.nightly.el7.noarch

Partition table API endpoint has changed behavior in JSON it accepts.

The payload now needs to follow jsonapi standard in order to be accepted, bringing inconsistency to api/v2:

Old (consistent) way:

# curl -ku admin:changeme -H 'Content-Type: application/json' -d '{"name":"foo1", "layout":"my_layout"}' https://katello.server.com/api/v2/ptables
{
  "error": {"id":null,"errors":{"template":["can't be blank"],"layout":["can't be blank"]},"full_messages":["Template can't be blank","Layout can't be blank"]}
}

New format:

]# curl -ku admin:changeme -H 'Content-Type: application/json' -d '{"ptable":{"name":"foo1", "layout":"my_layout"}}' https://hp-dl380pgen8-02-vm-3.lab.bos.redhat.com/api/v2/ptables
{"layout":"my_layout","os_family":null,"created_at":"2016-09-01 13:25:18 UTC","updated_at":"2016-09-01 13:25:18 UTC","name":"foo1","id":79,"operatingsystems":[],"locations":[],"organizations":[]}

Actions #1

Updated by Dominic Cleal over 7 years ago

  • Subject changed from api/v2/ptables accepts only jsonapi-formatted payload to api/v2/ptables accepts only wrapped hash of attributes
  • Difficulty deleted (trivial)

When did this change? Versus the 1.12.x release series, or a very recent nightly?

Actions #2

Updated by Dominic Cleal over 7 years ago

  • Subject changed from api/v2/ptables accepts only wrapped hash of attributes to api/v2/ptables accepts only wrapped hash of attributes with "layout"

Possibly from #7096, looks ancient to me. The "layout" attribute isn't a known wrapped attribute as it's only a model alias of "template" for pre-STI compatibility - it should be explicitly listed in the controller.

Actions #3

Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Shlomi Zadok
  • Pull request https://github.com/theforeman/foreman/pull/3817 added
Actions #4

Updated by Shlomi Zadok over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 181
Actions #6

Updated by Marek Hulán over 7 years ago

  • Target version set to 1.5.3
Actions #7

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release changed from 181 to 160

Issue not present in 1.12-stable, probably due to wrap_parameters changing behaviour with strong params.

Actions

Also available in: Atom PDF