Project

General

Profile

Actions

Bug #23918

closed

Unable to associate organization with location (regression 1.18)

Added by Lukas Zapletal almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
-

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.

Actions #1

Updated by Tomáš Strachota almost 6 years ago

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.

Actions #2

Updated by Ondřej Pražák over 5 years ago

  • Assignee set to Ondřej Pražák
  • Triaged set to No
Actions #3

Updated by Ondřej Pražák over 5 years ago

  • Project changed from Hammer CLI to Foreman
  • Category deleted (Organizations and locations)
Actions #4

Updated by The Foreman Bot over 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5768 added
Actions #5

Updated by Daniel Lobato Garcia over 5 years ago

  • Bugzilla link set to 1597042
Actions #6

Updated by Daniel Lobato Garcia over 5 years ago

  • Fixed in Releases 1.18.0 added
Actions #7

Updated by Ondřej Pražák over 5 years ago

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

Updated by The Foreman Bot over 5 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5812 added
Actions #9

Updated by The Foreman Bot over 5 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5816 added
Actions

Also available in: Atom PDF