Actions
Bug #13064
closedExecuting "hammer role filters" command throws SQL errors
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Foreman commands (obsolete)
Target version:
-
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Description
hammer role filters throws below error
# hammer role filters PGError: ERROR: invalid input syntax for integer: "" LINE 1: ..."id" = "filters"."role_id" WHERE (("roles"."id" = '')) ORDER... ^ : SELECT "filters"."id" AS t0_r0, "filters"."search" AS t0_r1, "filters"."role_id" AS t0_r2, "filters"."created_at" AS t0_r3, "filters"."updated_at" AS t0_r4, "filters"."taxonomy_search" AS t0_r5, "roles"."id" AS t1_r0, "roles"."name" AS t1_r1, "roles"."builtin" AS t1_r2, "roles"."permissions" AS t1_r3 FROM "filters" LEFT OUTER JOIN "roles" ON "roles"."id" = "filters"."role_id" WHERE (("roles"."id" = '')) ORDER BY role_id, filters.id LIMIT 20 OFFSET 0
Updated by Dominic Cleal almost 9 years ago
- Project changed from Plugins to Hammer CLI
- Subject changed from hammer-cli-foreman: Executing "hammer role filters" command throws SQL errors to Executing "hammer role filters" command throws SQL errors
- Description updated (diff)
- Category set to Foreman commands (obsolete)
- Difficulty deleted (
easy)
debug output:
$ hammer -d role filters [ INFO 2016-01-08 10:04:17 Init] Initialization of Hammer CLI (0.5.1) has started... [DEBUG 2016-01-08 10:04:17 Init] Running at ruby 2.2.2-p95 [ INFO 2016-01-08 10:04:17 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded [ INFO 2016-01-08 10:04:17 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded [ INFO 2016-01-08 10:04:17 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded [DEBUG 2016-01-08 10:04:17 Connection] Registered: foreman [DEBUG 2016-01-08 10:04:17 API] Global headers: { :content_type => "application/json", :accept => "application/json;version=2", "Accept-Language" => "en_GB" } [ INFO 2016-01-08 10:04:17 Modules] Extension module hammer_cli_foreman (0.5.1) loaded [DEBUG 2016-01-08 10:04:17 Init] Using locale 'en_GB' [DEBUG 2016-01-08 10:04:17 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/locale' [DEBUG 2016-01-08 10:04:17 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1/locale' [ INFO 2016-01-08 10:04:17 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} [ INFO 2016-01-08 10:04:17 HammerCLIForeman::Role] Called with options: {} [ INFO 2016-01-08 10:04:17 HammerCLIForeman::Role::FiltersCommand] Called with options: {} [ INFO 2016-01-08 10:04:17 API] GET /api/filters [DEBUG 2016-01-08 10:04:17 API] Params: { :search => "role_id = \"\"" } [DEBUG 2016-01-08 10:04:17 API] Headers: { :params => { :search => "role_id = \"\"" } } [DEBUG 2016-01-08 10:04:17 API] 500 Internal Server Error { "error" => { "message" => "PG::Error: ERROR: invalid input syntax for integer: \"\"\nLINE 1: ...\"id\" = \"filters\".\"role_id\" WHERE ((\"roles\".\"id\" = '')) ORDE...\n ^\n: SELECT \"filters\".\"id\" AS t0_r0, \ "filters\".\"search\" AS t0_r1, \"filters\".\"role_id\" AS t0_r2, \"filters\".\"created_at\" AS t0_r3, \"filters\".\"updated_at\" AS t0_r4, \"filters\".\"taxonomy_search\" AS t0_r5, \"roles\".\"id\" AS t1_r0, \"roles\".\"name\" AS t1_r1, \"roles\".\"builtin\" AS t1_r2, \ "roles\".\"permissions\" AS t1_r3 FROM \"filters\" LEFT OUTER JOIN \"roles\" ON \"roles\".\"id\" = \"filters\".\"role_id\" WHERE ((\"roles\".\"id\" = '')) ORDER BY filters.role_id, filters.id LIMIT 20 OFFSET 0" } }
The role_id search shouldn't be specified if there's no role given by the user, and especially shouldn't be a string.
Bug could be copied to the search category in Foreman as the string/int SQL type error should be handled better.
Updated by The Foreman Bot almost 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/hammer-cli-foreman/pull/209 added
Updated by Tomáš Strachota almost 9 years ago
- Related to Bug #13645: Scoped search fails with 500 on postgresql if value can't be converted added
Updated by Tomáš Strachota almost 9 years ago
The patch on hammer workarounds the problem by requiring a role identifier, but the issue still persists in API. I created and attached a new bug in the search component.
Updated by Ranjan Kumar almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset hammer-cli-foreman|24921f2cbda04076aed52eb49904186af30ca3bb.
Updated by Ranjan Kumar over 8 years ago
- Has duplicate Bug #14235: Executing "hammer role filters" command throws SQL errors added
Actions