Skip to content

Commit 9e2615b

Browse files
authored
Merge pull request #4809 from thaJeztah/remove_printSecurityOptionsWarnings
info: remove printSecurityOptionsWarnings, printServerWarnings
2 parents c6ae749 + d9294f0 commit 9e2615b

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)