Actions
Bug #2497
closedAdding a USer fact filter causes an SQL error when provisioning a host
Status:
Closed
Priority:
High
Assignee:
Category:
Users, Roles and Permissions
Target version:
Description
Seen on Sat.Lab.TLV
Tried to provision a discovered host as non-admin user with a fact filter ( virtual == 'rhev' ). Got this stacktrace:
ActiveRecord::StatementInvalid Mysql2::Error: Unknown column 'fact_values.host_id' in 'where clause': SELECT `hosts`.* FROM `hosts` WHERE (((hosts.owner_id in (NULL) AND hosts.owner_type = 'Usergroup') OR (hosts.owner_id = 64 AND hosts.owner_type = 'User')) or (hosts.domain_id in (6)) or (hosts.compute_resource_id in (16)) or ((hosts.id = fact_values.host_id and fact_values.fact_name_id = 438 and fact_values.value = 'rhev')) or (hosts.organization_id in (1,8)) or (hosts.location_id in (3,10)) ) app/models/host/managed.rb:520:in `enforce_permissions' app/models/authorization.rb:12:in `enforce_edit_permissions' lib/foreman/sti.rb:26:in `save' app/models/taxonomy.rb:48:in `no_taxonomy_scope' app/models/taxonomy.rb:55:in `as_taxonomy' lib/foreman/thread_session.rb:140:in `as_location' app/models/taxonomy.rb:54:in `as_taxonomy' lib/foreman/thread_session.rb:105:in `as_org' app/models/taxonomy.rb:53:in `as_taxonomy' app/models/taxonomy.rb:47:in `no_taxonomy_scope' lib/foreman/thread_session.rb:31:in `clear_thread'
Found in 346742902d8548e46877a214b2143dd79c3c4c69
Updated by Greg Sutcliffe over 11 years ago
- Assignee set to Greg Sutcliffe
Replicated locally with a Managed Host - simply set Fact Filter "hostname" = "sapphire" and got:
SQLite3::SQLException: no such column: fact_values.host_id: SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND ((hosts.compute_resource_id in (1)) or ((hosts.id = fact_values.host_id and fact_values.fact_name_id = 47 and fact_values.value = 'sapphire')) or (hosts.organization_id in (1,4)) or (hosts.location_id in (2,3)) )
Investigating.
Updated by Greg Sutcliffe over 11 years ago
- Status changed from New to Ready For Testing
- Priority changed from Normal to High
PR sent. Marking this as High as it causes Foreman to crash if you attempt to use the user fact filters at the moment.
Updated by Greg Sutcliffe over 11 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 9ae88fc3e7e4621df841eb6fb43fe938db4e52a5.
Actions