Actions
Bug #1292
closedSearching hosts with parameters produces and SQL error
Description
Hi,
Using:
foreman-0.4-0.1rc4 on RHEL6, MySQL backend
Searching for hosts by params.value = key gives a SQL error.
e.g.
https://punch.example.org/dashboard?search=+params.ocsserver+%3D++ocsserv.cern.ch
The following error message was observed:
Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1: SELECT count(*) AS count_all FROM `hosts` WHERE (())
Full trace:
ActiveRecord::StatementInvalid Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1: SELECT count(*) AS count_all FROM `hosts` WHERE (()) /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:639:in `select' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:237:in `execute_simple_calculation' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:134:in `calculate' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:130:in `catch' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:130:in `calculate' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `count' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope' /usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing' /usr/share/foreman/app/controllers/dashboard_controller.rb:18:in `prefetch_data'
Actions