Project

General

Profile

Bug #32116

Remove Trends and Statistics data from all instances

Added by Ondřej Ezr over 1 year ago. Updated 8 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

We still have Trends and Statistics permissions and tables around in all instances.
We should run the cleanup for all instances that didn't install the plugin.

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1920810

Description of problem: After upgrade to Foreman 2.3, I can see an error message in the production logs

2021-01-26T23:37:13 [I|app|22106c00] Backtrace for 'unknown class Trend, ignoring' error (NameError): uninitialized constant Trend
22106c00 | Did you mean? Thread
22106c00 | /usr/share/foreman/app/models/filter.rb:81:in `get_resource_class'
22106c00 | /usr/share/foreman/app/models/permission.rb:22:in `block in with_translations'
22106c00 | /usr/share/foreman/app/models/permission.rb:22:in `map'
22106c00 | /usr/share/foreman/app/models/permission.rb:22:in `with_translations'
22106c00 | /usr/share/foreman/app/models/permission.rb:18:in `resources_with_translations'

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

How reproducible: Always

Steps to Reproduce:
1. After upgrade, Try to edit any report template and check logs

Additional info:
I can see permission related to trends is present in the DB. It should be deleted in the upgrade

irb(main):010:0> Permission.where('name LIKE ?', "%_trends")
=> #<ActiveRecord::Relation [#<Permission id: 171, name: "view_trends", resource_type: "Trend", created_at: "2019-08-05 21:14:09", updated_at: "2019-08-05 21:14:09">, #<Permission id: 172, name: "create_trends", resource_type: "Trend", created_at: "2019-08-05 21:14:09", updated_at: "2019-08-05 21:14:09">, #<Permission id: 173, name: "edit_trends", resource_type: "Trend", created_at: "2019-08-05 21:14:09", updated_at: "2019-08-05 21:14:09">, #<Permission id: 174, name: "destroy_trends", resource_type: "Trend", created_at: "2019-08-05 21:14:09", updated_at: "2019-08-05 21:14:09">, #<Permission id: 175, name: "update_trends", resource_type: "Trend", created_at: "2019-08-05 21:14:09", updated_at: "2019-08-05 21:14:09">]>


Related issues

Related to Foreman - Bug #35347: After removing the foreman_docker plugin, foreman log is flooded with huge tracebacks related to "unknown class DockerRegistry, ignoring" and "unknown class Container, ignoring"Closed
Has duplicate Foreman - Bug #35186: Clean up all permissions related to Trend modelDuplicate

History

#1 Updated by Ondřej Ezr 5 months ago

  • Has duplicate Bug #35186: Clean up all permissions related to Trend model added

#2 Updated by Ondřej Ezr 5 months ago

  • Subject changed from Remove Trends and Statistics data from all instances to Remove Trends and Statistics data from all instances

Running `foreman-rake purge:trends` in a migration should be enough here IMHO.

#3 Updated by Ondřej Ezr 2 months ago

  • Status changed from New to Closed
  • Fixed in Releases 3.5.0 added
  • Pull request https://github.com/theforeman/foreman/pull/9343 added

#4 Updated by Ondřej Ezr 2 months ago

  • Related to Bug #35347: After removing the foreman_docker plugin, foreman log is flooded with huge tracebacks related to "unknown class DockerRegistry, ignoring" and "unknown class Container, ignoring" added

#5 Updated by Ewoud Kohl van Wijngaarden 8 days ago

  • Triaged changed from No to Yes
  • Category changed from Trends to DB migrations

Also available in: Atom PDF