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 1785902

Summary: Ansible RunHostJob tasks failed with "Failed to initialize: NoMethodError - undefined method `[]' for nil:NilClass"
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: Tasks PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6.0CC: aruzicka, christian.almkvist, dsynk, egolov, mshira, pierre-yves.goubet
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman-tasks-1.1.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 12:59:52 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 Hao Chang Yu 2019-12-22 06:08:40 UTC
Description of problem:
Ansible tasks failed with "Failed to initialize: NoMethodError - undefined method `[]' for nil:NilClass" while updating the status of the stopped delegated tasks.

Steps to Reproduce:
1) Run an ansible script job with a command "sleep 60" on 1 or more clients.
2) Wait until the client's RunHostJob task is created by the main task (RunHostsJob) and it is in running state.
3) Then stop foreman-tasks for about 2 minutes until the remote task is finished.
4) Start foreman-tasks.
5) About 10 minutes later, the RunHostJob should failed with the above error.

How reproducible:
- Stopping the foreman-tasks in STEP 3 is to make the RunHostJob miss the API callback from the smart_proxy_dynflow_core when the remote task is stopped. Anyway that could cause the foreman tasks to miss the API callback should be able to reproduce the issue.
- If the Callback is missed, there is a Watcher in the main task (RunHostsJob) that will wakeup every 10 minutes to check the status of its sub tasks and notify them.
- While the sub stask (RunHostJob) updating its status, the task failed with the error above.


Actual results:
Task fail

Expected results:
foreman-tasks should update the status of the task and stop the task successfully without raising the above error

Comment 6 Bryan Kearney 2020-04-22 20:21:42 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/29028 has been resolved.

Comment 7 Peter Ondrejka 2020-05-26 13:22:47 UTC
Verified on Satellite 6.8 snap 1, using steps from the problem description (restarting dynflow-sidekiq@worker service)

Comment 10 errata-xmlrpc 2020-10-27 12:59:52 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 (Important: Satellite 6.8 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-2020:4366