Project

General

Profile

Actions

Bug #21893

closed

GET /docker/api/v2/containers returns SQL error when sending optional compute_resource_id

Added by Sebastian Gräßl over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1466240

Description of problem:

  1. With compute_resource_id
    > $ curl -s -H "Content-Type: application/json" -H "Accept:application/json" -k -u "admin:changeme" -X GET -d '{"compute_resource_id": 1}' https://sat6.com/docker/api/v2/containers                                                                                                                 
    > {
    >   "error": {"message":"PG::Error: ERROR:  argument of WHERE must be type boolean, not type integer\nLINE 1: SELECT  \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 ...\n                                                        ^\n: SELECT  \"containers\".* FROM \"containers\" WHERE (1) LIMIT 20 OFFSET 0"}
    > }
    
  1. Without compute_resource_id
> $ curl -s -H "Content-Type: application/json" -H "Accept:application/json" -k -u "admin:changeme" -X GET https://sat6.com/docker/api/v2/containers                                                                                                                  
> {
>  "total": 0,
> ...
> }

production log:

> 2017-06-29 04:42:18 a4fb040e [app] [I] Started GET "/docker/api/v2/containers" for 10.36.116.61 at 2017-06-29 04:42:18 -0400
> 2017-06-29 04:42:18 a4fb040e [app] [I] Processing by Api::V2::ContainersController#index as JSON
> 2017-06-29 04:42:18 a4fb040e [app] [I]   Parameters: {"compute_resource_id"=>1, "apiv"=>"v2", "container"=>{"compute_resource_id"=>1}}
> 2017-06-29 04:42:18 a4fb040e [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-3.1.0/app/views/api/v2/containers/index.json.rabl within api/v2/layouts/index_layout (4.1ms)
> 2017-06-29 04:42:18 a4fb040e [app] [W] Action failed
> | ActiveRecord::StatementInvalid: PG::Error: ERROR:  argument of WHERE must be type boolean, not type integer
> | LINE 1: SELECT  "containers".* FROM "containers" WHERE (1) LIMIT 20 ...
> |                                                         ^
> | : SELECT  "containers".* FROM "containers" WHERE (1) LIMIT 20 OFFSET 0

Version-Release number of selected component (if applicable):

  • katello-3.4.1-1.el7sat.noarch
  • foreman-1.15.1-1.el7sat.noarch
  • satellite-6.3.0-16.0.beta.el7sat.noarch
  • tfm-rubygem-foreman_docker-3.1.0-1.fm1_15.el7sat.noarch
  • tfm-rubygem-docker-api-1.28.0-2.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. curl -s -H "Content-Type: application/json" -H "Accept:application/json" -k -u "admin:changeme" -X GET -d '{"compute_resource_id": 1}' http://localhost:3000/docker/api/v2/containers
2.
3.

Actual results:
SQL error

Expected results:
Containers should be listed


Related issues 1 (0 open1 closed)

Related to Docker - Refactor #19694: Align Rubocop with foreman core settingsClosedSebastian Gräßl05/29/2017Actions
Actions #1

Updated by Marek Hulán over 6 years ago

  • Related to Refactor #19694: Align Rubocop with foreman core settings added
Actions #2

Updated by The Foreman Bot over 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Marek Hulán
  • Pull request https://github.com/theforeman/foreman-docker/pull/204 added
Actions #3

Updated by Anonymous over 6 years ago

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

Also available in: Atom PDF