Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use warnings provided by daemon #1225

Merged
merged 2 commits into from
Aug 21, 2018

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jul 19, 2018

CLI changes for moby/moby#37502

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.

Engine bump: moby/moby@1800883...2629fe9

Relevant changes:

vendor.conf Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Jul 19, 2018

Codecov Report

Merging #1225 into master will increase coverage by <.01%.
The diff coverage is 88.23%.

@@            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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
...
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, need to get moby/moby#37502 merged first as well 😅

@thaJeztah thaJeztah force-pushed the told_you_so_I_wont_warn_you_again branch from 02f48b8 to 50f65a6 Compare August 21, 2018 10:24
@thaJeztah thaJeztah changed the title [WIP] Use warnings provided by daemon Use warnings provided by daemon Aug 21, 2018
@thaJeztah
Copy link
Member Author

ping @silvin-lubecki @vdemeester this should be ready to go now 👍

@thaJeztah
Copy link
Member Author

thaJeztah commented Aug 21, 2018

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

10:32:22 		Stderr:   time="2018-08-21T10:32:21Z" level=info msg="apply failure, attempting cleanup" error="failed to extract layer sha256:06eb73143a9451a98b4d98403f0db4690af3308066712304841553124a66e0fd: failed to mount /var/lib/containerd/tmpmounts/containerd-mount204004538: invalid argument: unknown" key="extract-779297538-t6iX sha256:c5f7b91673785e2b65341e3f98cc102946ff8901b7aa2b2617b17a2f7f1ad354"
10:32:22 		unable to pull image docker.io/docker/engine-community:18.09.0-dev: failed to unpack image on snapshotter overlayfs: failed to extract layer sha256:06eb73143a9451a98b4d98403f0db4690af3308066712304841553124a66e0fd: failed to mount /var/lib/containerd/tmpmounts/containerd-mount204004538: invalid argument: unknown
10:32:22 

Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

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]>
@thaJeztah thaJeztah force-pushed the told_you_so_I_wont_warn_you_again branch from 50f65a6 to 3c27ce2 Compare August 21, 2018 20:30
@thaJeztah
Copy link
Member Author

Rebased; vendor bump now only updates docker/docker

Copy link
Collaborator

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tiborvass tiborvass merged commit ca78259 into docker:master Aug 21, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.09.0 milestone Aug 21, 2018
@thaJeztah thaJeztah deleted the told_you_so_I_wont_warn_you_again branch August 21, 2018 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants