Project

General

Profile

Actions

Bug #22765

open

hammer organization add-location constructs invalid payload for PUT endpoint

Added by roman plevka about 6 years ago. Updated about 5 years ago.

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

Description

# hammer -d -u admin -p changeme organization add-location --location-id 2 --id 1
...
[ INFO 2018-03-05T07:14:14 API] PUT /katello/api/organizations/1
[DEBUG 2018-03-05T07:14:14 API] Params: {
     "location_id" => 2,
    "organization" => {
        "location_ids" => [
            [0] "2" 
        ]
    }
}
[DEBUG 2018-03-05T07:14:14 API] Headers: {}
[DEBUG 2018-03-05T07:14:14 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2018-03-05T07:14:14 API] 404 Not Found
[DEBUG 2018-03-05T07:14:14 API] {
    "error" => {
        "message" => "Resource organization not found by id '1'" 
    }
}

there shouldn't be any "location_id" parameter put outside of the "organization" hash. Excluding this parameter from the payload makes the PUT request successful

Actions #1

Updated by roman plevka about 6 years ago

version: katello-nightly (provisioned on 2018-03-04)

Actions #2

Updated by Oleh Fedorenko about 5 years ago

Is it still reproducible (in Nightly)? I tried it now and it still builds the same payload, but works.

# hammer organization add-location --location-id 5 --id 4
...
[ INFO 2019-04-02T17:01:52 API] PUT /katello/api/organizations/4
[DEBUG 2019-04-02T17:01:52 API] Params: {
     "location_id" => 5,
    "organization" => {
        "location_ids" => [
            [0] "5" 
        ]
    }
}
...
The location has been associated.
Actions

Also available in: Atom PDF