Bug #23918
closed
Unable to associate organization with location (regression 1.18)
Added by Lukas Zapletal over 6 years ago.
Updated over 6 years ago.
Description
Hey folks, 1.18 RC1 here, this was working previously in 1.16 and perhaps 1.17:
[root@foreman ~]# hammer location list
---|-------|-------|------------
ID | TITLE | NAME | DESCRIPTION
---|-------|-------|------------
2 | MyLoc | MyLoc |
---|-------|-------|------------
[root@foreman ~]# hammer organization list
---|-------|-------|------------
ID | TITLE | NAME | DESCRIPTION
---|-------|-------|------------
1 | MyOrg | MyOrg |
---|-------|-------|------------
[root@foreman ~]# hammer location add-organization --name MyLoc --organization MyOrg
Could not associate the organization:
Resource location not found by id '2'
What I want to do is to associate Org with Loc.
It needs further investigation but it seems to be an API problem.
Hammer correctly finds the location by name and sends the id in url:
[ INFO 2018-06-14T10:22:47 API] Server: https://centos7-devel.example.com/
[ INFO 2018-06-14T10:22:47 API] PUT /api/locations/6
[DEBUG 2018-06-14T10:22:47 API] Params: {
"organization_id" => 3,
"location" => {
"organization_ids" => [
[0] "3"
]
}
}
[DEBUG 2018-06-14T10:22:47 API] Headers: {}
[DEBUG 2018-06-14T10:22:47 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2018-06-14T10:22:47 API] 404 Not Found
[DEBUG 2018-06-14T10:22:47 API] {
"error" => {
"message" => "Resource location not found by id '6'"
}
}
[DEBUG 2018-06-14T10:22:47 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_not_found
[ERROR 2018-06-14T10:22:47 Exception] Resource location not found by id '6'
Could not associate the organization:
Resource location not found by id '6'
But on server side the resource is not found, because the resource_scope is []. It might be related to recent changes in taxonomy scoping.
hammer location info --id 6 works normally.
- Assignee set to Ondřej Pražák
- Triaged set to No
- Project changed from Hammer CLI to Foreman
- Category deleted (
Organizations and locations)
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/5768 added
- Bugzilla link set to 1597042
- Fixed in Releases 1.18.0 added
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Pull request https://github.com/theforeman/foreman/pull/5812 added
- Pull request https://github.com/theforeman/foreman/pull/5816 added
Also available in: Atom
PDF