Project

General

Profile

Bug #2045

error when searching a host by class

Added by David Schmitt over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

The filter was "class = nis::server" leading to this url: https://foreman/hosts?utf8=%E2%9C%93&search=class+%3D+nis%3A%3Aserver

and this error message:

ActiveRecord::StatementInvalid
PG::Error: ERROR: invalid input syntax for integer: "nil" LINE 1: SELECT "hosts".* FROM "hosts" WHERE ((hosts.id = 'nil')) OR... ^ : SELECT "hosts".* FROM "hosts" WHERE ((hosts.id = 'nil')) ORDER BY "hosts"."name" ASC NULLS FIRST LIMIT 20 OFFSET 0
app/controllers/hosts_controller.rb:41:in `index'
app/controllers/hosts_controller.rb:37:in `index'
lib/foreman/threadsession.rb:31:in `clear_thread'

when trying "class = 'nis::server'" (note the extra quotes) no error is thrown and the host list is not filtered.

I would have expected the query to return all hosts that have the nis::server class assigned (directly or transitively).

This is foreman 1.1RC1 running on Scientific Linux 6.2 with the packages from yum.theforeman.org

Associated revisions

Revision 2c01421b (diff)
Added by Joseph Magen over 9 years ago

fixes #2045 changed condition so there is no error in Postgresql

History

#1 Updated by Ohad Levy over 9 years ago

  • Category set to Search
  • Assignee set to Joseph Magen
  • Target version set to 1.1

#2 Updated by Joseph Magen over 9 years ago

  • Status changed from New to Ready For Testing

I send pull request at https://github.com/theforeman/foreman/pull/310

Should we removed all single quotes in the search value??

value = value.gsub(/'/,"")

#3 Updated by Anonymous over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF