Bug 1854711

Summary: Sync Plan fails with 'uninitialized constant Actions::Foreman::Exception'
Product: Red Hat Satellite Reporter: Ranjan Kumar <rankumar>
Component: Sync PlansAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: avnkumar, iballou, jjeffers, pcreech, swadeley
Target Milestone: 6.7.4Keywords: Patch, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.14.0.28-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1874168 (view as bug list) Environment:
Last Closed: 2020-09-30 13:12:09 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 Ranjan Kumar 2020-07-08 05:23:48 UTC
Description of problem: Running sync plan fails with error

curl -u admin:password -k -X PUT https://satellite.example.com.com/katello/api/v2/organizations/3/sync_plans/4/sync -H 'content-type: application/json'
{"displayMessage":"uninitialized constant Actions::Foreman::Exception\nDid you mean?  Exception","errors":["uninitialized constant Actions::Foreman::Exception\nDid you mean?  Exception"]}

production log
~~~
2020-07-08T10:43:46 [I|app|bd1ae89a] Started PUT "/katello/api/v2/organizations/3/sync_plans/4/sync" for 10.74.131.67 at 2020-07-08 10:43:46 +0530
2020-07-08T10:43:46 [I|app|bd1ae89a] Processing by Katello::Api::V2::SyncPlansController#sync as */*
2020-07-08T10:43:46 [I|app|bd1ae89a]   Parameters: {"api_version"=>"v2", "organization_id"=>"3", "id"=>"4", "sync_plan"=>{}}
2020-07-08T10:43:46 [D|app|bd1ae89a] Authenticated user admin against INTERNAL authentication source
2020-07-08T10:43:46 [D|app|bd1ae89a] Current user set to foreman_admin (admin)
2020-07-08T10:43:46 [I|app|bd1ae89a] Authorized user admin(Admin User)
2020-07-08T10:43:46 [I|app|bd1ae89a] Current user set to admin (admin)
2020-07-08T10:43:46 [D|app|bd1ae89a] Current location set to none
2020-07-08T10:43:46 [D|app|bd1ae89a] Current organization set to FR
2020-07-08T10:43:46 [D|app|bd1ae89a] Current location set to none
2020-07-08T10:43:46 [D|app|bd1ae89a] Current organization set to FR
2020-07-08T10:43:46 [D|dyn|bd1ae89a] ExecutionPlan 97212660-758b-45cf-a2af-cfce67010eb6      pending >>  planning
2020-07-08T10:43:46 [I|bac|bd1ae89a] Task {label: Actions::Katello::SyncPlan::Run, id: 47d926bd-3ecf-4738-8ce0-79b4dc00e7c5, execution_plan_id: 97212660-758b-45cf-a2af-cfce67010eb6} state changed: planning 
2020-07-08T10:43:46 [I|app|] Current user set to admin (admin)
2020-07-08T10:43:46 [D|app|] Current organization set to FR
2020-07-08T10:43:46 [D|app|] Current location set to none
2020-07-08T10:43:46 [D|dyn|]          Step 97212660-758b-45cf-a2af-cfce67010eb6: 1   pending >>   running in phase     Plan Actions::Katello::SyncPlan::Run
2020-07-08T10:43:46 [D|app|] Current user set to foreman_admin (admin)
2020-07-08T10:43:47 [D|dyn|]          Step 97212660-758b-45cf-a2af-cfce67010eb6: 2   pending >>   running in phase     Plan Actions::BulkAction
2020-07-08T10:43:47 [E|bac|] uninitialized constant Actions::Foreman::Exception
Did you mean?  Exception (NameError)
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.15.11.1/app/lib/actions/bulk_action.rb:61:in `check_targets!'
~~~


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


Actual results:  Running sync plan fails with error


Expected results: It should success


Additional info:  There are some root repository without the reference of the actual repository. Running below command list corrupted root repository
cat << FIX | foreman-rake console
sync_plan = Katello::SyncPlan.find(4)
syncable_roots = ::Katello::RootRepository.where(:product_id => sync_plan.products.syncable).has_url; nil
syncable_roots.each do |root_repo|
  puts "Corrupt Root Repository  => #{root_repo.name}" if root_repo.library_instance.nil?
end; nil
FIX

Comment 2 Bryan Kearney 2020-07-24 20:02:55 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30343 has been resolved.

Comment 12 errata-xmlrpc 2020-09-30 13:12:09 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.7.4 Async Bug Fix Update), 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:4127