Skip to content

Commit d9294f0

Browse files
committed
info: remove printSecurityOptionsWarnings, printServerWarnings
Docker Engine 1.13 (API v1.25) added an option to set a custom default seccomp profile on the daemon (see [moby/moby@b237189]). A warning was added on the client-side if a non-default profile was set. Docker Engine 23.0 (API v1.42) added warnings about non-default seccomp profiles to the "info" response ([moby/moby@04f932a]), and the client was updated to skip generating client-side warnings for API v1.42 and up in [8964595]. These warnings are purely informational, and given that Docker Engine versions before 23.0 have reached EOL, and any current version of the Engine now returns the Warnings, it should be safe to remove the client-side fall back logic. This patch removes the client-side fall back code for warnings that was added in 8964595. [moby/moby@b237189]: moby/moby@b237189 [moby/moby@04f932a]: moby/moby@04f932a [8964595]: 8964595 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent c6ae749 commit d9294f0

1 file changed

Lines changed: 4 additions & 35 deletions

File tree

cli/command/system/info.go

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/docker/cli/templates"
2222
"github.com/docker/docker/api/types/swarm"
2323
"github.com/docker/docker/api/types/system"
24-
"github.com/docker/docker/api/types/versions"
2524
"github.com/docker/docker/registry"
2625
"github.com/docker/go-units"
2726
"github.com/spf13/cobra"
@@ -380,7 +379,10 @@ func prettyPrintServerInfo(streams command.Streams, info *dockerInfo) []error {
380379
}
381380

382381
fprintln(output)
383-
printServerWarnings(streams.Err(), info)
382+
for _, w := range info.Warnings {
383+
fprintln(streams.Err(), w)
384+
}
385+
384386
return errs
385387
}
386388

@@ -454,39 +456,6 @@ func printSwarmInfo(output io.Writer, info system.Info) {
454456
}
455457
}
456458

457-
func printServerWarnings(stdErr io.Writer, info *dockerInfo) {
458-
if versions.LessThan(info.ClientInfo.APIVersion, "1.42") {
459-
printSecurityOptionsWarnings(stdErr, *info.Info)
460-
}
461-
if len(info.Warnings) > 0 {
462-
fprintln(stdErr, strings.Join(info.Warnings, "\n"))
463-
}
464-
}
465-
466-
// printSecurityOptionsWarnings prints warnings based on the security options
467-
// returned by the daemon.
468-
//
469-
// Deprecated: warnings are now generated by the daemon, and returned in
470-
// info.Warnings. This function is used to provide backward compatibility with
471-
// daemons that do not provide these warnings. No new warnings should be added
472-
// here.
473-
func printSecurityOptionsWarnings(stdErr io.Writer, info system.Info) {
474-
if info.OSType == "windows" {
475-
return
476-
}
477-
kvs, _ := system.DecodeSecurityOptions(info.SecurityOptions)
478-
for _, so := range kvs {
479-
if so.Name != "seccomp" {
480-
continue
481-
}
482-
for _, o := range so.Options {
483-
if o.Key == "profile" && o.Value != "default" && o.Value != "builtin" {
484-
_, _ = fmt.Fprintln(stdErr, "WARNING: You're not using the default seccomp profile")
485-
}
486-
}
487-
}
488-
}
489-
490459
func formatInfo(output io.Writer, info dockerInfo, format string) error {
491460
if format == formatter.JSONFormatKey {
492461
format = formatter.JSONFormat

0 commit comments

Comments
 (0)