Bug 1395797 - [RFE] Fix counts while upgrading Satellite
Summary: [RFE] Fix counts while upgrading Satellite
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: Unspecified
Assignee: Stephen Benjamin
QA Contact: Sachin Ghai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-16 17:09 UTC by Christian Marineau
Modified: 2020-09-10 09:58 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Christian Marineau 2016-11-16 17:09:56 UTC
Description of problem:
It seems that in older version of Satellite, a situation could create a negative count , and this negative counts still persist after upgrading. It can be fix manually by running this:
# foreman-rake fix_cached_counters

As a RFE, this actions could be done when upgrading, or in a cron managed by Satellite.


Steps to Reproduce:
1.Modify the count from the database via foreman db, example:
    update operatingsystems SET hosts_count = hosts_count -1 WHERE id = '2';

2. Validation the wrong count though the WebUI 
     Hosts > Operating Systems
     Under "Hosts" column, the negative "-1" should be seen 
3. Run this command
# foreman-rake fix_cached_counters

4. Count in the database and webui will now display to good number.


Expected results:
Have an automated process that fix the counters via cron or uprade process.

Comment 3 Stephen Benjamin 2016-11-18 17:34:21 UTC
Created redmine issue http://projects.theforeman.org/issues/17398 from this bug

Comment 4 Stephen Benjamin 2016-11-18 17:41:18 UTC
Actually, this can only go with 6.2.z, fix_cached_counter was removed in Foreman 1.12.

Comment 8 Satellite Program 2017-06-01 20:32:57 UTC
1405401

Comment 9 Sachin Ghai 2017-12-21 11:21:16 UTC
As per comment5 as cached_counters are entirely gone in 6.3, does that mean "foreman-rake fix_cached_counters" no longer valid for 6.3 ?

I'm getting below on running above cmd on 6.3

~]# foreman-rake fix_cached_counters --trace
rake aborted!
Don't know how to build task 'fix_cached_counters'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task_manager.rb:62:in `[]'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:149:in `invoke_task'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/opt/rh/rh-ruby23/root/usr/bin/rake:23:in `load'
/opt/rh/rh-ruby23/root/usr/bin/rake:23:in `<main>'



Moreover, I don't see "-1"  under Hosts > Operating Systems
Under "Hosts" column. 

Is there anything that QE should test ?

Comment 10 Stephen Benjamin 2018-01-02 01:29:36 UTC
AFAIK, no, this would've only been a problem in 6.2.

Comment 11 Sachin Ghai 2018-01-02 09:34:19 UTC
thank you Stephen.

Moving this to verified based on comment9 and comment10.

Comment 12 Satellite Program 2018-02-21 16:54:37 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-2018:0336


Note You need to log in before you can comment on or make changes to this bug.