Bug 1269208

Summary: hammer docker container logs not returning any logs
Product: Red Hat Satellite Reporter: Andrii Balakhtar <abalakht>
Component: Container ManagementAssignee: Sebastian Gräßl <sgraessl>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, dlobatog, omaciel, rplevka, tomckay
Target Milestone: UnspecifiedKeywords: PrioBumpQA, Triaged, UserExperience
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 20:13:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrii Balakhtar 2015-10-06 15:55:38 UTC
Description of problem:
'hammer docker container logs' always shows empty logs, even for containers which definitely have logs as logs are returned by API.

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

How reproducible:
Always

Steps to Reproduce:
1. Create docker container with 'date' command (for example).
2. Check container logs:
API logs:
nailgun.client - DEBUG - Making HTTP GET request to https://***.com/docker/api/v2/containers/33/logs with options {'verify': False, 'auth': ('admin', '***'), 'headers': {'content-type': 'application/json'}} and no data.
nailgun.client - DEBUG - Received HTTP 200 response: {"logs":"\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u001DTue Oct  6 15:33:25 UTC 2015\n"}

CLI logs:
# hammer -u admin -p changeme docker container logs --id 33
Logs:


Actual results:
Hammer didn't return any container logs.

Expected results:
Hammer should return the same logs, as for API - "\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u001DTue Oct  6 15:33:25 UTC 2015\n".

Additional info:

Comment 2 Bryan Kearney 2016-08-04 20:10:04 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 5 Og Maciel 2017-02-14 20:04:00 UTC
Still valid on 6.2.8

GET /docker/api/v2/containers/1/

{"command":"top","compute_resource_id":3,"compute_resource_name":"local_docker","entrypoint":"","cpu_set":"","cpu_shares":null,"memory":"","tty":true,"attach_stdin":true,"attach_stdout":true,"attach_stderr":true,"repository_name":"centos","tag":"latest","registry_id":null,"registry_name":null,"created_at":"2017-02-14 19:56:49 UTC","updated_at":"2017-02-14 19:56:49 UTC","id":1,"name":"01-centos-docker","uuid":"adb13b28aa61dc7ef60d46e15347e457cb7083e1541d722d5908f75920674628","locations":[],"organizations":[{"id":1,"name":"Default Organization","title":"Default Organization","description":""}]}


GET /docker/api/v2/containers/1/logs

{
  "error": {"message":"400 Bad Request: malformed Host header"}
}



[root@cloud-qe-10 ~]# hammer -v -u admin -p changeme docker container logs --id 1
[ERROR 2017-02-14 15:01:35 Exception] 400 Bad Request: malformed Host header
400 Bad Request: malformed Host header
[ERROR 2017-02-14 15:01:35 Exception]

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:308:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    /opt/rh/rh-ruby22/root/usr/share/ruby/net/http.rb:853:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:51:in `get'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:295:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:224:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:174:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/api.rb:169:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.16/lib/apipie_bindings/resource.rb:14:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.10/lib/hammer_cli_foreman/commands.rb:190:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.10/lib/hammer_cli_foreman/commands.rb:383:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/lib/hammer_cli/abstract.rb:24:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.13/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 8 Roman Plevka 2017-05-05 12:57:23 UTC
`hammer docker container logs` tries to connect to the local docker.sock even if the docker compute resource points to external docker:

# hammer -u admin -p changeme compute-resource info --id 25
Id:            25
Name:          Z8ca5qJ7
Provider:      Docker
Url:           http://10.8.29.17:2375
...

# hammer docker container info --id 17
ID:               17
Name:             pSrsSU1T2o
Image repository: busybox
Tag:              latest
Command:          date
Compute resource: Z8ca5qJ7
...

# hammer docker container logs --id 17
Permission denied - connect(2) for /var/run/docker.sock (Errno::EACCES)

Comment 10 Bryan Kearney 2017-08-01 20:13:34 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in product in the forseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.