Project

General

Profile

Actions

Bug #5155

closed

Error with MySQL Query in Taxonomy Handler when All Users is set in ignored_types

Added by Jared Ballou about 10 years ago. Updated about 10 years ago.

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

Description

I am getting an error when I create a taxonomy and select the "All Users" checkbox for assignment. I can create, edit, and destroy locations and organizations with any variety of settings set, as soon as the "All Users" box is checked this error is presented when I try to edit the taxonomy. Manually editing the MySQL foreman.taxonomies table and removing User from the ignored_types YAML list lets me go in and work without encountering this bug. The issue looks to be that a query is constructed that references usergroups.admin in the WHERE clause but is only selecting data from the users table.

I am running Foreman and Foreman Proxy on the same host as Puppetmaster. It is RHEL 6.5 x86_64 with the Puppetlabs repo, epel, and remaining packages are installed from RHN.
I am running the Git branch develop (1.5).
I just did a git pull and I believe everything is in working order and fully updated.
I am using MySQL (mysql-server-5.1.73-3.el6_5.x86_64) as a backing database, on another host, it was previously migrated from local PostgreSQL if that matters.

The full stack trace is included below with full stack trace. I can provide logs if needed.

Warning!

Mysql2::Error: Unknown column 'usergroups.admin' in 'where clause': SELECT `users`.`id` FROM `users` WHERE ((users.admin = 0 OR users.admin IS NULL) AND (usergroups.admin = 0 OR usergroups.admin IS NULL))
If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, You would probably need to attach the Full trace and relevant log entries.

ActiveRecord::StatementInvalid
Mysql2::Error: Unknown column 'usergroups.admin' in 'where clause': SELECT `users`.`id` FROM `users` WHERE ((users.admin = 0 OR users.admin IS NULL) AND (usergroups.admin = 0 OR usergroups.admin IS NULL))
app/models/taxonomy.rb:113:in `user_ids'
app/helpers/layout_helper.rb:92:in `multiple_selects'
app/helpers/layout_helper.rb:157:in `field'
app/helpers/layout_helper.rb:156:in `field'
app/helpers/layout_helper.rb:149:in `field'
app/helpers/layout_helper.rb:148:in `field'
app/helpers/layout_helper.rb:85:in `multiple_selects'
app/views/taxonomies/_form.html.erb:30:in `_app_views_taxonomies__form_html_erb__1159601028_70111468228240'
app/helpers/layout_helper.rb:246:in `form_for'
app/views/taxonomies/_form.html.erb:2:in `_app_views_taxonomies__form_html_erb__1159601028_70111468228240'
app/views/taxonomies/edit.html.erb:4:in `_app_views_taxonomies_edit_html_erb___1370968054_70111467727960'
app/controllers/concerns/foreman/controller/taxonomies_controller.rb:66:in `edit'
app/models/taxonomy.rb:40:in `no_taxonomy_scope'
app/models/taxonomy.rb:47:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:143:in `as_location'
app/models/taxonomy.rb:46:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:108:in `as_org'
app/models/taxonomy.rb:45:in `as_taxonomy'
app/models/taxonomy.rb:39:in `no_taxonomy_scope'
app/controllers/concerns/foreman/controller/taxonomies_controller.rb:64:in `edit'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Actions #1

Updated by Jared Ballou about 10 years ago

Apparently I don't know how to use Git... wasn't checking out the develop branch properly, tried applying the fix from #4995 and saw my files were actually out of wack. Did a new pull, bundle install and db:migrate and the issue is resolved. Sorry for the false alarm!

Actions #2

Updated by Lukas Zapletal about 10 years ago

  • Status changed from New to Rejected

Okay, happens all the time to me. Thanks!

Actions

Also available in: Atom PDF