Project

General

Profile

Actions

Bug #2045

closed

error when searching a host by class

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
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

Actions #1

Updated by Ohad Levy over 11 years ago

  • Category set to Search
  • Assignee set to Joseph Magen
  • Target version set to 1.1
Actions #2

Updated by Joseph Magen over 11 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(/'/,"")

Actions #3

Updated by Anonymous over 11 years ago

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

Also available in: Atom PDF