mirror of https://github.com/docker/cli.git
Merge pull request #4809 from thaJeztah/remove_printSecurityOptionsWarnings
info: remove printSecurityOptionsWarnings, printServerWarnings
This commit is contained in:
commit
9e2615bc46
|
@ -21,7 +21,6 @@ import (
|
||||||
"github.com/docker/cli/templates"
|
"github.com/docker/cli/templates"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/api/types/system"
|
"github.com/docker/docker/api/types/system"
|
||||||
"github.com/docker/docker/api/types/versions"
|
|
||||||
"github.com/docker/docker/registry"
|
"github.com/docker/docker/registry"
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -380,7 +379,10 @@ func prettyPrintServerInfo(streams command.Streams, info *dockerInfo) []error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintln(output)
|
fprintln(output)
|
||||||
printServerWarnings(streams.Err(), info)
|
for _, w := range info.Warnings {
|
||||||
|
fprintln(streams.Err(), w)
|
||||||
|
}
|
||||||
|
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,39 +456,6 @@ func printSwarmInfo(output io.Writer, info system.Info) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func printServerWarnings(stdErr io.Writer, info *dockerInfo) {
|
|
||||||
if versions.LessThan(info.ClientInfo.APIVersion, "1.42") {
|
|
||||||
printSecurityOptionsWarnings(stdErr, *info.Info)
|
|
||||||
}
|
|
||||||
if len(info.Warnings) > 0 {
|
|
||||||
fprintln(stdErr, strings.Join(info.Warnings, "\n"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// printSecurityOptionsWarnings prints warnings based on the security options
|
|
||||||
// returned by the daemon.
|
|
||||||
//
|
|
||||||
// Deprecated: warnings are now generated by the daemon, and returned in
|
|
||||||
// info.Warnings. This function is used to provide backward compatibility with
|
|
||||||
// daemons that do not provide these warnings. No new warnings should be added
|
|
||||||
// here.
|
|
||||||
func printSecurityOptionsWarnings(stdErr io.Writer, info system.Info) {
|
|
||||||
if info.OSType == "windows" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
kvs, _ := system.DecodeSecurityOptions(info.SecurityOptions)
|
|
||||||
for _, so := range kvs {
|
|
||||||
if so.Name != "seccomp" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, o := range so.Options {
|
|
||||||
if o.Key == "profile" && o.Value != "default" && o.Value != "builtin" {
|
|
||||||
_, _ = fmt.Fprintln(stdErr, "WARNING: You're not using the default seccomp profile")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatInfo(output io.Writer, info dockerInfo, format string) error {
|
func formatInfo(output io.Writer, info dockerInfo, format string) error {
|
||||||
if format == formatter.JSONFormatKey {
|
if format == formatter.JSONFormatKey {
|
||||||
format = formatter.JSONFormat
|
format = formatter.JSONFormat
|
||||||
|
|
Loading…
Reference in New Issue