Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1896628 - Hammer Command Fails to List Job Invocation Details if Organization is Used
Summary: Hammer Command Fails to List Job Invocation Details if Organization is Used
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Remote Execution
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.11.0
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-11 05:22 UTC by myoder
Modified: 2023-06-01 09:45 UTC (History)
11 users (show)

Fixed In Version: tfm-rubygem-foreman_remote_execution-5.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:28:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 33007 0 Normal Closed Hammer Command Fails to List Job Invocation Details if Organization is Used 2021-10-28 14:23:37 UTC
Red Hat Issue Tracker SAT-18023 0 None None None 2023-06-01 09:45:27 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:28:37 UTC

Description myoder 2020-11-11 05:22:48 UTC
Description of problem:

When using hammer command to get details about a job-invocation task, when using the organization flag, there is a 500 error thrown:

# hammer job-invocation output --id 1 --host ch1.ooo.mu --organization-id=1
Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.


Without the flag, the job invocation returns normally:

 # hammer job-invocation output --id 1 --host ch1.ooo.mu 


PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************

fatal: [ch1.ooo.mu]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname ch1.ooo.mu: Name or service not known", "unreachable": true}
PLAY RECAP *********************************************************************
ch1.ooo.mu                 : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
Exit status: 1



In the /var/log/foreman/production.log:

FAILED HAMMER COMMAND:

2020-11-11T00:16:49 [I|app|cdbf086d] Completed 200 OK in 188ms (Views: 34.1ms | ActiveRecord: 39.9ms)
2020-11-11T00:16:49 [I|app|971abc27] Started GET "/api/job_invocations/1/hosts/8?organization_id=1&since" for 192.168.0.24 at 2020-11-11 00:16:49 -0500
2020-11-11T00:16:49 [I|app|971abc27] Processing by Api::V2::JobInvocationsController#output as JSON
2020-11-11T00:16:49 [I|app|971abc27]   Parameters: {"organization_id"=>"1", "since"=>nil, "apiv"=>"v2", "job_invocation_id"=>"1", "host_id"=>"8", "job_invocation"=>{}}
2020-11-11T00:16:49 [D|app|971abc27] Authenticated user admin against INTERNAL authentication source
2020-11-11T00:16:49 [I|app|971abc27] Authorized user admin(Admin User)
2020-11-11T00:16:49 [D|tax|971abc27] Current location set to none
2020-11-11T00:16:49 [D|tax|971abc27] Current organization set to Studio-14
2020-11-11T00:16:49 [D|tax|971abc27] Current location set to none
2020-11-11T00:16:49 [D|tax|971abc27] Current organization set to Studio-14
2020-11-11T00:16:49 [W|app|971abc27] Action failed
2020-11-11T00:16:49 [D|app|971abc27] Backtrace for 'Action failed' error (NoMethodError): undefined method `task' for #<Organization:0x00007f6e43f82f10>
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_methods.rb:430:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:99:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-2.0.10.2/app/controllers/api/v2/job_invocations_controller.rb:81:in `output'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
< - - skipped - ->
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2020-11-11T00:16:49 [I|app|971abc27]   Rendering api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout
2020-11-11T00:16:49 [I|app|971abc27]   Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (0.7ms)
2020-11-11T00:16:49 [I|app|971abc27] Completed 500 Internal Server Error in 181ms (Views: 1.8ms | ActiveRecord: 31.2ms)


SUCCESSFUL HAMMER COMMAND:

2020-11-11T00:16:54 [I|app|5a6b1e37] Started GET "/api/hosts?search=name+%3D+%22ch1.ooo.mu%22&per_page=1000&page=1" for 192.168.0.24 at 2020-11-11 00:16:54 -0500
2020-11-11T00:16:54 [I|app|5a6b1e37] Processing by Api::V2::HostsController#index as JSON
2020-11-11T00:16:54 [I|app|5a6b1e37]   Parameters: {"search"=>"name = \"ch1.ooo.mu\"", "per_page"=>"1000", "page"=>"1", "apiv"=>"v2", "host"=>{}}
2020-11-11T00:16:54 [I|app|5a6b1e37] Authorized user admin(Admin User)
2020-11-11T00:16:55 [I|app|5a6b1e37]   Rendering api/v2/hosts/index.json.rabl within api/v2/layouts/index_layout
2020-11-11T00:16:55 [I|app|5a6b1e37]   Rendered api/v2/hosts/index.json.rabl within api/v2/layouts/index_layout (38.8ms)
2020-11-11T00:16:55 [I|app|5a6b1e37] Completed 200 OK in 196ms (Views: 37.1ms | ActiveRecord: 44.0ms)
2020-11-11T00:16:55 [I|app|e086311a] Started GET "/api/job_invocations/1/hosts/8?since" for 192.168.0.24 at 2020-11-11 00:16:55 -0500
2020-11-11T00:16:55 [I|app|e086311a] Processing by Api::V2::JobInvocationsController#output as JSON
2020-11-11T00:16:55 [I|app|e086311a]   Parameters: {"since"=>nil, "apiv"=>"v2", "job_invocation_id"=>"1", "host_id"=>"8", "job_invocation"=>{}}
2020-11-11T00:16:55 [I|app|e086311a] Authorized user admin(Admin User)
2020-11-11T00:16:55 [I|app|e086311a] Completed 200 OK in 195ms (Views: 0.6ms | ActiveRecord: 46.3ms)

Version-Release number of selected component (if applicable):
Satellite 6.8

How reproducible:
always

Steps to Reproduce:
1. Run a job invocation task on a host
2. Try to inspect the job invocation with hammer, while specifying an organization
3.

Actual results:
Hammer command fails with 500 internal error

Expected results:
Hammer command should succeed

Additional info:

Comment 3 Adam Ruzicka 2021-07-13 13:54:22 UTC
Created redmine issue https://projects.theforeman.org/issues/33007 from this bug

Comment 6 Peter Ondrejka 2022-01-07 14:34:58 UTC
Verified on Satellite 7 snap 4, passing an organization flag no longer results in error

Comment 9 errata-xmlrpc 2022-07-05 14:28:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498


Note You need to log in before you can comment on or make changes to this bug.