Bug 1717020

Summary: data.yml is referring to old sync plain id which does not exist in katello_sync_plans
Product: Red Hat Satellite Reporter: Michal Dekan <mdekan>
Component: Satellite MaintainAssignee: Kavita <kgaikwad>
Status: CLOSED CURRENTRELEASE QA Contact: Nikhil Kathole <nkathole>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.4.2CC: apatel, inecas, kgaikwad, mbacovsk
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-14 05:28:22 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
data.yml.nbackup referencing sync plan id 14 which does not exist in the db none

Description Michal Dekan 2019-06-04 14:32:34 UTC
Description of problem:

/var/lib/foreman-maintain/data.yml is referencing sync plain id which does not exists in the katello_sync_plans table.

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

rubygem-foreman_maintain-0.3.3-1.el7sat.noarch

How reproducible:

Seems like we need to have satellite started on sat 6.3 upgraded all the way to 6.5 over foreman-maintain.

---
upgrade_6.3: {}
:default:
  :upgrade_target_version: 6.4.z
  :sync_plans:
    :enabled: []
    :disabled:
    - 14
    - 7
    - 8
    - 11
    - 5
    - 6
    - 12
    - 13
    - 15
    - 14
    - 1
    - 6
    - 5
    - 12
    - 2
    - 15
    - 3
...
...
...


Actual results:

I, [2019-06-04 10:10:25+0200 #32556]  INFO -- : --- Execution step 're-enable sync plans' [sync-plans-enable] started ---
D, [2019-06-04 10:10:26+0200 #32556] DEBUG -- : Running command RUBYOPT='-W0' LANG=en_US.utf-8 hammer -c "/etc/foreman-maintain/foreman-maintain-hammer.yml" --interactive=no
 sync-plan update --id 14 --enabled true with stdin nil
D, [2019-06-04 10:10:28+0200 #32556] DEBUG -- : output of the command:
 Could not update the sync plan:
  Couldn't find sync plan '14' in organization ''
E, [2019-06-04 10:10:28+0200 #32556] ERROR -- : Could not update the sync plan:
  Couldn't find sync plan '14' in organization '' (RuntimeError)
/usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/sync_plans.rb:48:in `block in update_records'
/usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/sync_plans.rb:43:in `each'
/usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/sync_plans.rb:43:in `update_records'
/usr/share/gems/gems/foreman_maintain-0.3.3/definitions/features/sync_plans.rb:28:in `make_enable'
/usr/share/gems/gems/foreman_maintain-0.3.3/definitions/procedures/sync_plans/enable.rb:25:in `block in enabled_sync_plans'


Expected results:

foreman-maintan should not try to enable sync plan which does not exist in the db anymore.

Additional info:

# foreman-maintain upgrade list-versions
- failed to list 6.5 version, only 6.4.z was listed

# foreman-maintain upgrade list-versions
6.4.z

We regenerated data.yml:

# mv /var/lib/foreman-maintain/data.yml{,.backup}

- it listed 6.5 version afterwards
- attaching data.yml.backup for the reference

Comment 3 Michal Dekan 2019-06-04 14:34:21 UTC
Created attachment 1577154 [details]
data.yml.nbackup referencing sync plan id 14 which does not exist in the db

Comment 5 Michal Dekan 2019-06-04 14:43:11 UTC
regenerated  /var/lib/foreman-maintain/data.yml re-enabled sync plan successfully during upgrade to 6.5:

# cat /var/lib/foreman-maintain/data.yml
---
upgrade_6.5: {}
:default:
  :upgrade_target_version:
  :sync_plans:
    :enabled:
    - 1
    - 6
    - 5
    - 12
    - 2
    - 15
    - 3
    :disabled: []