Use warnings provided by daemon#1225
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1225 +/- ##
==========================================
+ Coverage 54.77% 54.77% +<.01%
==========================================
Files 292 292
Lines 19275 19285 +10
==========================================
+ Hits 10557 10563 +6
- Misses 8061 8063 +2
- Partials 657 659 +2 |
| if info.OSType == "windows" { | ||
| return | ||
| } | ||
| if !info.MemoryLimit { |
There was a problem hiding this comment.
nit: I know it is a deprecated function, but we could do some little factorization here 😇
func printWarningLegacy(stdErr io.Writer, property bool, message string){
if !property{
fmt.Println(stdErr, "WARNING: "+message)
}
}
func printWarningsLegacy(dockerCli command.Cli, info types.Info) {
if info.OSType == "windows" {
return
}
stdErr := dockerCli.Err()
printWarningLegacy(stdErr, info.MemoryLimit, "No memory limit support")
printWarningLegacy(stdErr, info. SwapLimit, "No swap limit support")
...
}There was a problem hiding this comment.
Was considering that at some point (also for the warnings returned by the daemon); at least for the daemon-returned warnings, I decided to print them as-is, that way we could use those warnings for other types of messages (INFO: your coffee is ready!, ERROR: we ran out of milk!).
We could "engineer" that further (info.level: info, info.message: "your coffee is ready!"), but that felt like taking it too far
Also noticed there's another warning that possibly could be moved; https://github.com/thaJeztah/cli/blob/02f48b838f1c61e251d7f9eb6128f589acc84949/cli/command/system/info.go#L127-L130, and wasn't sure if there would be others I'd find
There was a problem hiding this comment.
Right and notice the discreet "tabulation" in this warning message 😄
And by the way it was only a nit, I'm fine keeping it as is!
There was a problem hiding this comment.
Yeah, need to get moby/moby#37502 merged first as well 😅
02f48b8 to
50f65a6
Compare
|
ping @silvin-lubecki @vdemeester this should be ready to go now 👍 |
|
No idea what those failures are; https://jenkins.dockerproject.org/job/docker/job/cli/job/PR-1225/2/execution/node/27/log/. Should not be related to this PR |
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Warnings are now generated by the daemon, and returned as part of the /info API response. If warnings are returned by the daemon; use those instead of generating them locally. Signed-off-by: Sebastiaan van Stijn <[email protected]>
50f65a6 to
3c27ce2
Compare
|
Rebased; vendor bump now only updates docker/docker |
CLI changes for moby/moby#37502
Warnings are now generated by the daemon, and returned as part of the
/infoAPI response.If warnings are returned by the daemon; use those instead of generating them locally.
Engine bump: moby/moby@1800883...2629fe9
Relevant changes: