Project

General

Profile

Bug #3603

ActiveRecord::StatementInvalid and postgres undefinedtable when searching puppetclasses in Foreman 1.3.0

Added by Jason Ashby over 9 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Hi guys, I searched through the issues, but did not see this one already...

In Foreman 1.3.0, when searching puppetclasses in the web gui, e.g. http://foreman/puppetclasses?utf8=%E2%9C%93&search=webcerts, I get the following error:

ActiveRecord::StatementInvalid
PG::UndefinedTable: ERROR: missing FROM-clause entry for table "environments" LINE 1: ...RE (("puppetclasses"."name" ILIKE '%webcerts%' OR "environme... ^ : SELECT "puppetclasses"."id" FROM "puppetclasses" WHERE (("puppetclasses"."name" ILIKE '%webcerts%' OR "environments"."name" ILIKE '%webcerts%' OR "hostgroups"."name" ILIKE '%webcerts%' OR "lookup_keys"."key" ILIKE '%webcerts%')) ORDER BY puppetclasses.name LIMIT 20 OFFSET 0
app/controllers/puppetclasses_controller.rb:17:in `index'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

I just upgraded to Foreman 1.3.0 from 1.2.2. Here is my puppetmaster/foreman host setup:

CentOS 6.4
Puppet 3.3.1
PuppetDB 1.5.2
Postgres 9.1 databases for Foreman and puppetDB
Puppet master and Foreman are served via Apache 2.4.6 and passenger 4.0.5
Ruby 1.8.7

I upgraded the node.rb and foreman.rb scripts per http://theforeman.org/manuals/1.3/index.html#Upgradenotes. There's definitely an "environments" table that exists in the foreman postgres DB.

Let me know if you need more info.

Associated revisions

Revision 9e08f306 (diff)
Added by Dmitri Dolguikh over 9 years ago

fixes #3603 - replaced a relation with a collection in 'where' conditions

Revision 3387b1cd (diff)
Added by Dmitri Dolguikh over 9 years ago

fixes #3603 - replaced a relation with a collection in 'where' conditions

(cherry picked from commit 9e08f306472c16c8c019fe7c038b5cb44bd5a28e)

Conflicts:
app/controllers/puppetclasses_controller.rb

History

#1 Updated by Dominic Cleal over 9 years ago

  • Legacy Backlogs Release (now unused) set to 3

I'm surprised this got through RCs! Thanks for the report.

#2 Updated by Anonymous over 9 years ago

Similarly, when ordering puppet classes by environment (/puppetclasses?order=environment+ASC&search=), I see:

SQLite3::SQLException: no such column: environments.name: SELECT "puppetclasses"."id" FROM "puppetclasses" ORDER BY "environments"."name" ASC LIMIT 20 OFFSET 0
Completed 500 Internal Server Error in 11.9ms

ActiveRecord::StatementInvalid (SQLite3::SQLException: no such column: environments.name: SELECT "puppetclasses"."id" FROM "puppetclasses" ORDER BY "environments"."name" ASC LIMIT 20 OFFSET 0):

#3 Updated by Anonymous over 9 years ago

  • Status changed from New to Assigned

#4 Updated by Anonymous over 9 years ago

  • Assignee set to Anonymous
  • Target version set to 1.10.0

#5 Updated by Anonymous over 9 years ago

  • Status changed from Assigned to Ready For Testing

#6 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