Project

General

Profile

Actions

Bug #9409

closed

Update from 1.6 to 1.7 user role problem in view Report and Dashboard

Added by Sergio Traldi almost 10 years ago. Updated almost 10 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,
I updated foreman form 1.6 to 1.7. I have mysql as DB to store foreman data.
In my foreman I created one Role (allow the users to create only host in one hostgroup and look anly thier hosts).
I associated that Role to some users.
All worked fine with 1.6.
Now after update if one of those users click on Monitor -> Dashboard or Monitor -> Reports this error occur:

ActiveRecord::StatementInvalid
Mysql2::Error: Unknown column 'hostgroups.title' in 'where clause': SELECT COUNT FROM (SELECT `reports`.`id` AS count_column FROM `reports` LEFT OUTER JOIN `hosts` ON `hosts`.`id` = `reports`.`host_id` AND `hosts`.`type` IN ('Host::Managed') WHERE `reports`.`host_id` IN (SELECT `hosts`.`id` FROM `hosts` WHERE `hosts`.`type` IN ('Host::Managed') AND (((`hostgroups`.`title` = BINARY 'hosts_all/hosts_unipd') OR (`hostgroups`.`title` LIKE 'hosts_all/hosts_unipd/%'))) ORDER BY `hosts`.`name` ASC) AND (status <> 0) AND ((`reports`.`reported_at` >= '2015-02-11')) LIMIT 6) subquery_for_count
app/views/dashboard/_reports_widget.html.erb:3:in `_app_views_dashboard__reports_widget_html_erb__1817694052916996980_68465200'
app/views/dashboard/index.html.erb:9:in `block in app_views_dashboard_index_html_erb_4253806925134727522_68119800'
app/views/dashboard/index.html.erb:8:in `map'
app/views/dashboard/index.html.erb:8:in `_app_views_dashboard_index_html_erb__4253806925134727522_68119800'
app/controllers/dashboard_controller.rb:6:in `index'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

I try to do:
foreman-rake db:migrate
foreman-rake db:seed
foreman-rake tmp:cache:clear
foreman-rake tmp:sessions:clear

service httpd restart

I also try to comment line:
remove_foreign_key 'user_roles', :name => 'user_roles_user_id_fk'
in file
20131114084718_extend_user_role.rb

And execute again:
foreman-rake db:migrate
foreman-rake db:seed

service httpd restart

But the problem is still there.

Cheers
Sergio


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Bug #8817: PGError: ERROR: missing FROM-clause entry for table "hostgroups"ClosedDominic Cleal12/31/2014Actions
Actions

Also available in: Atom PDF