Skip to content

Commit c6ae749

Browse files
authored
Merge pull request #4808 from thaJeztah/remove_printServerWarningsLegacy
info: remove printServerWarningsLegacy
2 parents 69a4fcc + a71d39b commit c6ae749

3 files changed

Lines changed: 0 additions & 63 deletions

File tree

cli/command/system/info.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,7 @@ func printServerWarnings(stdErr io.Writer, info *dockerInfo) {
460460
}
461461
if len(info.Warnings) > 0 {
462462
fprintln(stdErr, strings.Join(info.Warnings, "\n"))
463-
return
464463
}
465-
// daemon didn't return warnings. Fallback to old behavior
466-
printServerWarningsLegacy(stdErr, *info.Info)
467464
}
468465

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

493-
// printServerWarningsLegacy generates warnings based on information returned by the daemon.
494-
//
495-
// Deprecated: warnings are now generated by the daemon, and returned in
496-
// info.Warnings. This function is used to provide backward compatibility with
497-
// daemons that do not provide these warnings. No new warnings should be added
498-
// here.
499-
func printServerWarningsLegacy(stdErr io.Writer, info system.Info) {
500-
if info.OSType == "windows" {
501-
return
502-
}
503-
if !info.MemoryLimit {
504-
fprintln(stdErr, "WARNING: No memory limit support")
505-
}
506-
if !info.SwapLimit {
507-
fprintln(stdErr, "WARNING: No swap limit support")
508-
}
509-
if !info.OomKillDisable && info.CgroupVersion != "2" {
510-
fprintln(stdErr, "WARNING: No oom kill disable support")
511-
}
512-
if !info.CPUCfsQuota {
513-
fprintln(stdErr, "WARNING: No cpu cfs quota support")
514-
}
515-
if !info.CPUCfsPeriod {
516-
fprintln(stdErr, "WARNING: No cpu cfs period support")
517-
}
518-
if !info.CPUShares {
519-
fprintln(stdErr, "WARNING: No cpu shares support")
520-
}
521-
if !info.CPUSet {
522-
fprintln(stdErr, "WARNING: No cpuset support")
523-
}
524-
if !info.IPv4Forwarding {
525-
fprintln(stdErr, "WARNING: IPv4 forwarding is disabled")
526-
}
527-
if !info.BridgeNfIptables {
528-
fprintln(stdErr, "WARNING: bridge-nf-call-iptables is disabled")
529-
}
530-
if !info.BridgeNfIP6tables {
531-
fprintln(stdErr, "WARNING: bridge-nf-call-ip6tables is disabled")
532-
}
533-
}
534-
535490
func formatInfo(output io.Writer, info dockerInfo, format string) error {
536491
if format == formatter.JSONFormatKey {
537492
format = formatter.JSONFormat

cli/command/system/info_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -333,23 +333,6 @@ func TestPrettyPrintInfo(t *testing.T) {
333333
prettyGolden: "docker-info-with-swarm",
334334
jsonGolden: "docker-info-with-swarm",
335335
},
336-
{
337-
doc: "info with legacy warnings",
338-
dockerInfo: dockerInfo{
339-
Info: &infoWithWarningsLinux,
340-
ClientInfo: &clientInfo{
341-
clientVersion: clientVersion{
342-
Platform: &platformInfo{Name: "Docker Engine - Community"},
343-
Version: "24.0.0",
344-
Context: "default",
345-
},
346-
Debug: true,
347-
},
348-
},
349-
prettyGolden: "docker-info-no-swarm",
350-
warningsGolden: "docker-info-warnings",
351-
jsonGolden: "docker-info-legacy-warnings",
352-
},
353336
{
354337
doc: "info with daemon warnings",
355338
dockerInfo: dockerInfo{

cli/command/system/testdata/docker-info-legacy-warnings.json.golden

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)