Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1431190

Summary: hammer job-invocation output returns "undefined method `pending?' for nil:NilClass" when called on queued invocation
Product: Red Hat Satellite Reporter: Peter Ondrejka <pondrejk>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.8CC: aruzicka, bkearney, egolov, inecas, pcreech, rplevka
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:11:39 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:
Attachments:
Description Flags
job invocation info traceback none

Description Peter Ondrejka 2017-03-10 14:46:02 UTC
Description of problem:

~]# hammer -v -u admin -p changeme  job-invocation output --host="hostname" --id="58"

returns (debug output in attachment):

[ERROR 2017-03-10 09:37:11 Exception] undefined method `pending?' for nil:NilClass
undefined method `pending?' for nil:NilClass
[ERROR 2017-03-10 09:37:11 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:308:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    /opt/rh/rh-ruby22/root/usr/share/ruby/net/http.rb:853:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:51:in `get'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:295:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:224:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:174:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:169:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/resource.rb:14:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.10/lib/hammer_cli_foreman/commands.rb:190:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

This happens only on invocations that are shcheduled for future run, command works all right on succeeded or failed invocations

~]# hammer job-invocation list
---|-------------|-----------|---------|--------|---------|-------|------------------------
ID | DESCRIPTION | STATUS    | SUCCESS | FAILED | PENDING | TOTAL | START                  
---|-------------|-----------|---------|--------|---------|-------|------------------------
58 | Run ls      | queued    | N/A     | N/A    | N/A     | N/A   | 2017-03-10 16:20:00 UTC

Version-Release number of selected component (if applicable):
satellite-6.2.8-4.0.el6sat.noarch


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
Exception

Expected results:
Some message saying that the job has not run yet

Additional info:

Comment 3 Adam Ruzicka 2017-03-21 14:39:29 UTC
Created redmine issue http://projects.theforeman.org/issues/18967 from this bug

Comment 4 Bryan Kearney 2017-09-14 17:02:05 UTC
Per discussion with FE, lets get this into 6.3.

Comment 5 Satellite Program 2017-10-18 14:24:58 UTC
Upstream bug assigned to aruzicka

Comment 6 Satellite Program 2017-10-18 14:25:01 UTC
Upstream bug assigned to aruzicka

Comment 7 Satellite Program 2017-10-31 12:28:44 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18967 has been resolved.

Comment 8 Evgeni Golov 2017-11-22 10:42:48 UTC
Moving back to ASSIGNED because the hammer PR is still open

Comment 9 Satellite Program 2018-04-23 12:24:18 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18967 has been resolved.

Comment 12 Roman Plevka 2018-07-16 12:39:57 UTC
FailedQA:
snap#12

the version is now updated (0.1.0), however the `job invocation info` command now errors out with slightly different traceback:

2018-07-14T02:04:00 [W|app|364a9] Action failed
NoMethodError: undefined method `pending?' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.5.3/app/controllers/api/v2/job_invocations_controller.rb:85:in `output'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionpack-5.1.6/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
...
(see attachments for more)

Comment 13 Roman Plevka 2018-07-16 12:40:47 UTC
Created attachment 1459154 [details]
job invocation info traceback

Comment 14 Adam Ruzicka 2018-07-23 11:58:50 UTC
The issue described in #12 is in fact another bug (BZ1607373). I'm setting this to ON_QA again.

Steps to reproduce (without hitting the other bug):
1) Schedule a job to execute far in the future (next year or so)
2) Run hammer job-invocation output

Comment 15 Roman Plevka 2018-07-26 13:33:29 UTC
VERIFIED
on sat6.4.0-13

# hammer job-invocation output --id 1 --host e9atdjil6qunlu15.lab.eng.rdu2.redhat.com --async
The job is scheduled to start at 2019-07-26T13:29:00.000Z

Comment 16 Bryan Kearney 2018-10-16 19:11:39 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, 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-2018:2927