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.
Created redmine issue http://projects.theforeman.org/issues/17398 from this bug
Actually, this can only go with 6.2.z, fix_cached_counter was removed in Foreman 1.12.
1405401
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 ?
AFAIK, no, this would've only been a problem in 6.2.
thank you Stephen. Moving this to verified based on comment9 and comment10.
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