alexellis/jaas

Cannot show logs with API version 1.29

TakafumiKoyama opened this issue · 2 comments

With docker with API version 1.29, showing logs is not possible.

Expected Behavior

jaas run shows logs.

Current Behavior

jaas run fails when command line arguments say it should show logs.

Possible Solution

The version number string is parsed as float and later compared with 1.29, which fails to pass "1.29". Fixing comparison will fix the issue.

> github.com/alexellis/jaas/cmd.runTask() /home./go/src/github.com/alexellis/jaas/cmd/run.go:110 (PC: 0x914524)                                                                                                                                                                                                                                                                                                                           
   105:                                                                                                                                                                                                                                                                                                                                                                                                                                   
   106:                 return versionErr                                                                                                                                                                                                                                                                                                                                                                                                 
   107:         }                                                                                                                                                                                                                                                                                                                                                                                                                         
   108:                                                                                                                                                                                                                                                                                                                                                                                                                                   
   109:         if taskRequest.ShowLogs {                                                                                                                                                                                                                                                                                                                                                                                                 
=> 110:                 apiVersion, parseErr := strconv.ParseFloat(versionInfo.APIVersion, 32)                                                                                                                                                                                                                                                                                                                                            
   111:                 if parseErr != nil {                                                                                                                                                                                                                                                                                                                                                                                              
   112:                         apiVersion = 0                                                                                                                                                                                                                                                                                                                                                                                            
   113:                 }                                                                                                                                                                                                                                                                                                                                                                                                                 
   114:                 if apiVersion < 1.29 && versionInfo.Experimental == false {                                                                                                                                                                                                                                                                                                                                                       
   115:                         return fmt.Errorf("experimental daemon or Docker API Version 1.29+ required to display service logs, falling back to no log display")                                                                                                                                                                                                                                                                     
(dlv) p versionInfo.APIVersion                                                                                                                                                                                                                                                                                                                                                                                                            
"1.29"                                                                                                                                                                                                                                                                                                                                                                                                                                    
(dlv) n                                                                                                                                                                                                                                                                                                                                                                                                                                   
> github.com/alexellis/jaas/cmd.runTask() /home./go/src/github.com/alexellis/jaas/cmd/run.go:111 (PC: 0x9145b1)                                                                                                                                                                                                                                                                                                                           
   106:                 return versionErr                                                                                                                                                                                                                                                                                                                                                                                                 
   107:         }                                                                                                                                                                                                                                                                                                                                                                                                                         
   108:                                                                                                                                                                                                                                                                                                                                                                                                                                   
   109:         if taskRequest.ShowLogs {                                                                                                                                                                                                                                                                                                                                                                                                 
   110:                 apiVersion, parseErr := strconv.ParseFloat(versionInfo.APIVersion, 32)                                                                                                                                                                                                                                                                                                                                            
=> 111:                 if parseErr != nil {                                                                                                                                                                                                                                                                                                                                                                                              
   112:                         apiVersion = 0                                                                                                                                                                                                                                                                                                                                                                                            
   113:                 }                                                                                                                                                                                                                                                                                                                                                                                                                 
   114:                 if apiVersion < 1.29 && versionInfo.Experimental == false {                                                                                                                                                                                                                                                                                                                                                       
   115:                         return fmt.Errorf("experimental daemon or Docker API Version 1.29+ required to display service logs, falling back to no log display")                                                                                                                                                                                                                                                                     
   116:                 }                                                                                                                                                                                                                                                                                                                                                                                                                 
(dlv) p apiVersion                                                                                                                                                                                                                                                                                                                                                                                                                        
1.2899999618530273  

Steps to Reproduce (for bugs)

  1. Install docker 17.05
  2. jaas run -i hello-world

Context

I'm using docker 17.05 and jaas fails to run without '--show-logs=false' option.

Your Environment

  • Version used: dev (6ad1e6a)
  • Environment name and version (e.g. Docker 1.13): Docker 17.05
  • Server type and version:
  • Operating System and version: Ubuntu 16.04
  • Link to your project:

Please go ahead and raise a PR. Thank you for reporting this

@alexellis I made a pull request. Thank you.