Bug 1632899

Summary: Listing report fails after adding default organization/location
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: Organizations and LocationsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: gpadholi, lcrown, mhulan, pdragun, vdeshpan
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-01 13:31:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ranjan Kumar 2018-09-25 19:12:40 UTC
Description of problem: After adding default organization/location, Listing reports fails with error  "Association not found for organization/location"

Version-Release number of selected component (if applicable): Satellite 6.4
satellite-6.4.0-14.el7sat.noarch

How reproducible: Always


Steps to Reproduce:
[root@satellite64 ~]# hammer organization list
---|----------------------|----------------------|-------------|----------------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL                
---|----------------------|----------------------|-------------|----------------------
1  | Default Organization | Default Organization |             | Default_Organization             
---|----------------------|----------------------|-------------|----------------------

[root@satellite64 ~]# hammer defaults list
----------------|------
PARAMETER       | VALUE
----------------|------
organization_id | 1    
----------------|------

[root@satellite64 ~]# hammer report list
Association not found for organization

Actual results: Failed to list report


Expected results: Should list reports


Additional info:
This is working in satellite 6.3

Applied the patch https://github.com/theforeman/foreman/pull/6075 but still failing

Production log:
2018-09-25T22:47:20 [W|app|823fe] Action failed
RuntimeError: Association not found for location
/usr/share/foreman/app/controllers/api/base_controller.rb:79:in `parent_scope'
/usr/share/foreman/app/controllers/api/base_controller.rb:64:in `resource_scope'
/usr/share/foreman/app/controllers/api/v2/reports_controller.rb:74:in `resource_scope'
/usr/share/foreman/app/controllers/api/base_controller.rb:104:in `resource_scope_for_index'
/usr/share/foreman/app/controllers/api/v2/reports_controller.rb:16:in `index'

Comment 3 Marek Hulan 2018-10-23 07:04:20 UTC
Created redmine issue https://projects.theforeman.org/issues/25277 from this bug

Comment 4 Satellite Program 2018-12-11 09:10:50 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25277 has been resolved.

Comment 5 Lucas Crownover 2019-04-09 21:07:52 UTC
Bug is not restricted to having a default organization.

Bug occurs when trying to filter job-invocations by organization.


[root@is-rhnsrv-p1 ~]# hammer defaults list
----------|------
PARAMETER | VALUE
----------|------

[root@is-rhnsrv-p1 ~]# hammer job-invocation list --organization IS
Association not found for organization



Log (truncated to single error):

[root@is-rhnsrv-p1 ~]# cat .hammer/log/hammer.log
[ERROR 2019-04-09T14:04:56 API] 500 Internal Server Error
[ERROR 2019-04-09T14:04:56 Exception] Association not found for organization
[ERROR 2019-04-09T14:04:56 Exception]

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:223:in `exception_with_response'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:103:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:807:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:725:in `block in transmit'
    /opt/rh/rh-ruby24/root/usr/share/ruby/net/http.rb:877:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:715:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:145:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:52:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/resource.rb:51:in `get'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:327:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:240:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/apipie/command.rb:51:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.2.3/lib/hammer_cli_foreman/commands.rb:168:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.2.3/lib/hammer_cli_foreman/commands.rb:224:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.2.3/lib/hammer_cli_foreman/commands.rb:259:in `retrieve_all'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.2.3/lib/hammer_cli_foreman/commands.rb:243:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/bin/hammer:143:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 7 Bryan Kearney 2020-05-01 13:31:20 UTC
Satellite 6.4 is now End of Life. These bus will not be fixed on the 6.4 stream. Users of Satellite should upgrade to the latest version of Satellite to get access to the most current set of bugfixes and feature improvements.