Bug 1954613

Summary: When running an insights ansible playbook, an error is given: Failed to create job. Ensure your systems are registered in Foreman
Product: Red Hat Satellite Reporter: Peter Gervase <pgervase>
Component: RH Cloud - InsightsAssignee: Shimon Shtein <sshtein>
Status: CLOSED CURRENTRELEASE QA Contact: Jameer Pathan <jpathan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: ahumbe, alsouza, aruzicka, bbuckingham, dmule, dsilvaju, egolov, lhellebr, mmccune, rexwhite, shivagup
Target Milestone: 6.10.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-redhat_access-2.2.20 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1974958 (view as bug list) Environment:
Last Closed: 2021-08-17 13:39:35 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
Output from foreman-rake errors:fetch_log request_id=....
none
tfm-rubygem-redhat_access-2.2.20-1.el7sat.noarch.rpm none

Description Peter Gervase 2021-04-28 13:07:25 UTC
Description of problem:
When you go to run an insights playbook, you get an error "Failed to create job. Ensure your systems are registered in Foreman"

Also, when you then go to look at the job_invocation, you get an error:
undefined method `input' for nil:NilClass

Output from
`foreman-rake errors:fetch_log request_id=2c9f9828`
is attached.

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

How reproducible:
100%

Steps to Reproduce:
1. Register a system in insights
2. Have the system have something for insights to remediate with ansible. I like to demonstrate insights functionality with smbloris, but presumably any ansible playbook for insights would work.
3. Click "Run Playbook"

Actual results:
1. Popup error: "Failed to create job. Ensure your systems are registered in Foreman"
2. Go to view the job invocation, you get " Oops, we're sorry but something went wrong undefined method `input' for nil:NilClass"

Expected results:
Playbook to correctly run and not have queued jobs.

Additional info:
Logs like
2021-04-28T09:00:23 [I|app|e8b916c2] Started POST "/api/v2/job_invocations/" for 10.10.116.137 at 2021-04-28 09:00:23 -0400
2021-04-28T09:00:23 [I|app|e8b916c2] Processing by Api::V2::JobInvocationsController#create as JSON
2021-04-28T09:00:23 [I|app|e8b916c2]   Parameters: {"job_invocation"=>{"feature"=>"ansible_run_insights_plan", "host_ids"=>"plan_id=53587", "inputs"=>{"organization_id"=>1, "plan_id"=>53587}}, "apiv"=>"v2"}
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on job_category Ansible Playbook
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on description Insights maintenance plan for host
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on concurrency_level 
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on time_span 
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on execution_timeout_interval 
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on password [redacted]
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on key_passphrase 
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on remote_execution_feature_id 12
2021-04-28T09:00:23 [I|aud|e8b916c2] JobInvocation (275) create event on effective_user_password 
2021-04-28T09:00:23 [I|bac|e8b916c2] Task {label: Actions::RemoteExecution::RunHostsJob, id: d2061caf-d6a7-45bf-b5a2-d540877980a9, execution_plan_id: 0d6a79cc-6e31-47b9-90c3-8a9e1bc54ce1} state changed: planning 
2021-04-28T09:00:24 [E|bac|] PG::FeatureNotSupported: ERROR:  cross-database references are not implemented: ansibleclient.example.com
 | LINE 1: ...D "hosts"."location_id" = $3 AND (( hosts.name IN(ansiblecli...
 |                                                              ^
 |  (ActiveRecord::StatementInvalid)

Comment 1 Peter Gervase 2021-04-28 13:08:25 UTC
Created attachment 1776600 [details]
Output from foreman-rake errors:fetch_log request_id=....

Comment 2 Adam Ruzicka 2021-04-28 13:26:25 UTC
> 3. Click "Run Playbook"

Where? Is this through RH access in satellite?

Comment 3 Peter Gervase 2021-04-28 13:59:19 UTC
Yes, this is all from within satellite. The reproducer is
https://sat69a.usersys.redhat.com/redhat_access/insights/planner/53675

Comment 4 Lukáš Hellebrandt 2021-04-29 13:01:23 UTC
I've just tried applying a remediation (a playbook) through FiFi process (create a remediation in CRC and run it from there) and I was able to run it without any issues.

Comment 5 Brad Buckingham 2021-04-29 14:40:56 UTC
Is this a regression in behavior from Satellite 6.8?

Comment 12 Mike McCune 2021-06-22 20:18:57 UTC
*** Satellite 6.9.2 Hotfix Available ***

1) Download tfm-rubygem-redhat_access-2.2.20-1.el7sat.noarch.rpm from this bugzilla to your Satellite


2) stop services:

satellite-maintain service stop

3) Install:

rpm -Uvh tfm-rubygem-redhat_access-2.2.20-1.el7sat.noarch.rpm

4) restart:

satellite-maintain service start

5) resume operations

Comment 13 Mike McCune 2021-06-22 20:21:16 UTC
Created attachment 1793237 [details]
tfm-rubygem-redhat_access-2.2.20-1.el7sat.noarch.rpm

Comment 22 Red Hat Bugzilla 2023-09-18 00:26:10 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days