Bug 1341164

Summary: app/lib/actions/fusor/configure_host_groups.rb, the access_insights_client puppet class can't be found with the find() method
Product: Red Hat Quickstart Cloud Installer Reporter: Jean-Francois Saucier <jsaucier>
Component: Installation - SatelliteAssignee: John Matthews <jmatthew>
Status: CLOSED ERRATA QA Contact: Tasos Papaioannou <tpapaioa>
Severity: medium Docs Contact: Dan Macpherson <dmacpher>
Priority: unspecified    
Version: 1.0CC: bthurber, tpapaioa
Target Milestone: gaKeywords: Triaged
Target Release: 1.0   
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: 2016-09-13 16:29:33 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:
Bug Depends On:    
Bug Blocks: 1342594    
Attachments:
Description Flags
foreman production log none

Description Jean-Francois Saucier 2016-05-31 12:03:47 UTC
Created attachment 1163195 [details]
foreman production log

Description of problem:

When trying to do a RHEV deployment, content sync as usual but fail at the end with the error : Couldn't find Puppetclass with 'id'=access_insights_client (ActiveRecord::RecordNotFound)


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

QCI-1.2-RHEL-7-20160527.t.0-QCI-x86_64-dvd1 ISO file.


How reproducible:

Always. I tried with my own Satellite application which contains "Employee SKU" subscriptions and I also tried with the rhci-test login with "QCI test" Satellite application. Both result in the same error.


Steps to Reproduce:
1. Install QCI with the ISO.
2. Start a new deployment.
3. Wait for content to finish syncing and see the error.


Actual results:

Fail with the error and stop the deployment.


Expected results:

Work and continue the deployment.


Additional info:

Comment 1 Tasos Papaioannou 2016-06-02 19:38:52 UTC
In /opt/theforeman/tfm/root/usr/share/gems/gems/fusor_server-1.0.0/app/lib/actions/fusor/configure_host_groups.rb, the access_insights_client puppet class can't be found with the find() method:


            # this host group is the deployment group
            # add access insights class, will get inherited by all machine nodes
            if deployment.enable_access_insights
              # Puppetclass names are unique, there is only one access insights
              # puppet class regardless of how many environments or orgs there are
              insights_class = Puppetclass.find("access_insights_client")
              hostgroup_params[:puppetclass_ids] = [insights_class.id]
            end


If I change it to look up by name with where(), then the task completes successfully:


# diff -pruN /opt/theforeman/tfm/root/usr/share/gems/gems/fusor_server-1.0.0/app/lib/actions/fusor/configure_host_groups.rb.bak /opt/theforeman/tfm/root/usr/share/gems/gems/fusor_server-1.0.0/app/lib/actions/fusor/configure_host_groups.rb
--- /opt/theforeman/tfm/root/usr/share/gems/gems/fusor_server-1.0.0/app/lib/actions/fusor/configure_host_groups.rb.bak	2016-06-02 15:16:02.883152810 -0400
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/fusor_server-1.0.0/app/lib/actions/fusor/configure_host_groups.rb	2016-06-02 15:31:35.315715814 -0400
@@ -113,8 +113,9 @@ module Actions
             if deployment.enable_access_insights
               # Puppetclass names are unique, there is only one access insights
               # puppet class regardless of how many environments or orgs there are
-              insights_class = Puppetclass.find("access_insights_client")
-              hostgroup_params[:puppetclass_ids] = [insights_class.id]
+              # insights_class = Puppetclass.find("access_insights_client")
+              insights_class = Puppetclass.where(:name => 'access_insights_client').try(:first)
+              hostgroup_params[:puppetclass_ids] = [insights_class.try(:id)]
             end
 
             default_capsule_id = ::Katello::CapsuleContent.default_capsule.try(:capsule).try(:id)

Comment 2 Jean-Francois Saucier 2016-06-06 14:44:37 UTC
I can confirm that the patch proposed by Tasos fix the problem and the deployment complete successfully.

Comment 3 John Matthews 2016-06-09 20:08:51 UTC
https://github.com/fusor/fusor/pull/940

Comment 4 John Matthews 2016-06-23 20:02:11 UTC
Addressed in ISO Set:
QCI-1.2-RHEL-7-20160623.t.0-QCI-x86_64-dvd1.iso
QCIOOO-8.0-RHEL-7-20160623.t.0-QCIOOO-x86_64-dvd1.iso

Comment 5 Tasos Papaioannou 2016-06-28 17:32:05 UTC
Verified on QCI-1.2-RHEL-7-20160627.t.0.

Comment 11 errata-xmlrpc 2016-09-13 16:29:33 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/RHEA-2016:1862