Skip to content

Commit

Permalink
Merge pull request docker#4808 from thaJeztah/remove_printServerWarni…
Browse files Browse the repository at this point in the history
…ngsLegacy

info: remove printServerWarningsLegacy
  • Loading branch information
thaJeztah authored Jan 23, 2024
2 parents 69a4fcc + a71d39b commit c6ae749
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 63 deletions.
45 changes: 0 additions & 45 deletions cli/command/system/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,7 @@ func printServerWarnings(stdErr io.Writer, info *dockerInfo) {
}
if len(info.Warnings) > 0 {
fprintln(stdErr, strings.Join(info.Warnings, "\n"))
return
}
// daemon didn't return warnings. Fallback to old behavior
printServerWarningsLegacy(stdErr, *info.Info)
}

// printSecurityOptionsWarnings prints warnings based on the security options
Expand All @@ -490,48 +487,6 @@ func printSecurityOptionsWarnings(stdErr io.Writer, info system.Info) {
}
}

// printServerWarningsLegacy generates warnings based on information 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 printServerWarningsLegacy(stdErr io.Writer, info system.Info) {
if info.OSType == "windows" {
return
}
if !info.MemoryLimit {
fprintln(stdErr, "WARNING: No memory limit support")
}
if !info.SwapLimit {
fprintln(stdErr, "WARNING: No swap limit support")
}
if !info.OomKillDisable && info.CgroupVersion != "2" {
fprintln(stdErr, "WARNING: No oom kill disable support")
}
if !info.CPUCfsQuota {
fprintln(stdErr, "WARNING: No cpu cfs quota support")
}
if !info.CPUCfsPeriod {
fprintln(stdErr, "WARNING: No cpu cfs period support")
}
if !info.CPUShares {
fprintln(stdErr, "WARNING: No cpu shares support")
}
if !info.CPUSet {
fprintln(stdErr, "WARNING: No cpuset support")
}
if !info.IPv4Forwarding {
fprintln(stdErr, "WARNING: IPv4 forwarding is disabled")
}
if !info.BridgeNfIptables {
fprintln(stdErr, "WARNING: bridge-nf-call-iptables is disabled")
}
if !info.BridgeNfIP6tables {
fprintln(stdErr, "WARNING: bridge-nf-call-ip6tables is disabled")
}
}

func formatInfo(output io.Writer, info dockerInfo, format string) error {
if format == formatter.JSONFormatKey {
format = formatter.JSONFormat
Expand Down
17 changes: 0 additions & 17 deletions cli/command/system/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,6 @@ func TestPrettyPrintInfo(t *testing.T) {
prettyGolden: "docker-info-with-swarm",
jsonGolden: "docker-info-with-swarm",
},
{
doc: "info with legacy warnings",
dockerInfo: dockerInfo{
Info: &infoWithWarningsLinux,
ClientInfo: &clientInfo{
clientVersion: clientVersion{
Platform: &platformInfo{Name: "Docker Engine - Community"},
Version: "24.0.0",
Context: "default",
},
Debug: true,
},
},
prettyGolden: "docker-info-no-swarm",
warningsGolden: "docker-info-warnings",
jsonGolden: "docker-info-legacy-warnings",
},
{
doc: "info with daemon warnings",
dockerInfo: dockerInfo{
Expand Down

This file was deleted.

0 comments on commit c6ae749

Please sign in to comment.