Project

General

Profile

Actions

Bug #2497

closed

Adding a USer fact filter causes an SQL error when provisioning a host

Added by Greg Sutcliffe over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
High
Category:
Users, Roles and Permissions
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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

Actions

Also available in: Atom PDF