Project

General

Profile

Actions

Bug #32116

closed

Remove Trends and Statistics data from all instances

Added by Ondřej Ezr almost 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

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 2 (0 open2 closed)

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"ClosedIan BallouActions
Has duplicate Foreman - Bug #35186: Clean up all permissions related to Trend modelDuplicateActions
Actions #1

Updated by Ondřej Ezr over 2 years ago

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

Updated by Ondřej Ezr over 2 years 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.

Actions #3

Updated by Ondřej Ezr about 2 years ago

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

Updated by Ondřej Ezr about 2 years 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
Actions #5

Updated by Ewoud Kohl van Wijngaarden about 2 years ago

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

Also available in: Atom PDF