Bug 1729048

Summary: Removing recurring logic fails with `katello_sync_plans.recurring_logic_id does not exist`
Product: Red Hat Satellite Reporter: Anand Agrawal <aagrawal>
Component: Sync PlansAssignee: Ivan Necas <inecas>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: arahaman, egolov, mmccune, rajgupta
Target Milestone: 6.6.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.12.0-1 Doc Type: If docs needed, set a value
Doc Text:
Deleting Sync Plans may result in an error. This will not effect existing Sync Plans but may be unable to be deleted with 6.6 Beta.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 19:51:20 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 Anand Agrawal 2019-07-11 09:42:43 UTC
Description of problem:

# in foreman-rake console
> rl = ForemanTasks::RecurringLogic.last
> rl.destroy

ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column katello_sync_plans.recurring_logic_id does not exist)
LINE 1: ...llo_sync_plans".* FROM "katello_sync_plans" WHERE "katello_s...
                                                             ^
: SELECT  "katello_sync_plans".* FROM "katello_sync_plans" WHERE "katello_sync_plans"."recurring_logic_id" = $1 LIMIT $2

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

How reproducible:
Always

Steps to Reproduce:
1. Create a sync plan
2. From the Monitor -> recurring logic, you will be able to see the created sync plan
3. Cancel this recurring logic.
3. Now try to delete this "cancelled" recurring logic

# foreman-rake console
ForemanTasks::RecurringLogic.where(state: "cancelled").destroy_all



Actual results:
irb(main):001:0> ForemanTasks::RecurringLogic.where(state: "cancelled").destroy_all
Traceback (most recent call last):
        2: from lib/tasks/console.rake:5:in `block in <top (required)>'
        1: from (irb):1
ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column katello_sync_plans.recurring_logic_id does not exist)
LINE 1: ...llo_sync_plans".* FROM "katello_sync_plans" WHERE "katello_s...
                                                             ^
: SELECT  "katello_sync_plans".* FROM "katello_sync_plans" WHERE "katello_sync_plans"."recurring_logic_id" = $1 LIMIT $2
irb(main):002:0>

Expected results:

Delete the "cancelled" recurring logic

Additional info:

There is an upstream bug already fixed for the same issue. I have tried the patch and it works with no issue

https://projects.theforeman.org/issues/26028

Comment 3 Bryan Kearney 2019-07-12 16:04:27 UTC
Upstream bug assigned to inecas

Comment 4 Bryan Kearney 2019-07-12 16:04:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26028 has been resolved.

Comment 6 Bryan Kearney 2019-10-22 19:51:20 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-2019:3172