diff options
Diffstat (limited to 'cmd/podman/system')
-rw-r--r-- | cmd/podman/system/connection/add.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/connection/default.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/connection/remove.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/df.go | 11 | ||||
-rw-r--r-- | cmd/podman/system/migrate.go | 1 | ||||
-rw-r--r-- | cmd/podman/system/renumber.go | 1 | ||||
-rw-r--r-- | cmd/podman/system/reset.go | 1 | ||||
-rw-r--r-- | cmd/podman/system/service.go | 3 | ||||
-rw-r--r-- | cmd/podman/system/service_abi.go | 1 | ||||
-rw-r--r-- | cmd/podman/system/version.go | 8 |
10 files changed, 19 insertions, 13 deletions
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go index 324e02db4..db575a689 100644 --- a/cmd/podman/system/connection/add.go +++ b/cmd/podman/system/connection/add.go @@ -244,7 +244,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL, iden string) (string, error) { // ValidateAndConfigure will take a ssh url and an identity key (rsa and the like) and ensure the information given is valid // iden iden can be blank to mean no identity key -// once the function validates the information it creates and returns an ssh.ClientConfig +// once the function validates the information it creates and returns an ssh.ClientConfig. func ValidateAndConfigure(uri *url.URL, iden string) (*ssh.ClientConfig, error) { var signers []ssh.Signer passwd, passwdSet := uri.User.Password() diff --git a/cmd/podman/system/connection/default.go b/cmd/podman/system/connection/default.go index c59ff36af..81866df55 100644 --- a/cmd/podman/system/connection/default.go +++ b/cmd/podman/system/connection/default.go @@ -11,7 +11,7 @@ import ( ) var ( - // Skip creating engines since this command will obtain connection information to said engines + // Skip creating engines since this command will obtain connection information to said engines. dfltCmd = &cobra.Command{ Use: "default NAME", Args: cobra.ExactArgs(1), diff --git a/cmd/podman/system/connection/remove.go b/cmd/podman/system/connection/remove.go index 84ec3e2ee..463eae9fa 100644 --- a/cmd/podman/system/connection/remove.go +++ b/cmd/podman/system/connection/remove.go @@ -10,7 +10,7 @@ import ( ) var ( - // Skip creating engines since this command will obtain connection information to said engines + // Skip creating engines since this command will obtain connection information to said engines. rmCmd = &cobra.Command{ Use: "remove [options] NAME", Aliases: []string{"rm"}, diff --git a/cmd/podman/system/df.go b/cmd/podman/system/df.go index b2325507a..dad14df6b 100644 --- a/cmd/podman/system/df.go +++ b/cmd/podman/system/df.go @@ -2,6 +2,7 @@ package system import ( "fmt" + "math" "os" "strings" "time" @@ -170,7 +171,7 @@ func printVerbose(cmd *cobra.Command, reports *entities.SystemDfReport) error { return err } if err := writeTemplate(rpt, hdrs, dfImages); err != nil { - return nil + return err } fmt.Fprint(rpt.Writer(), "\nContainers space usage:\n\n") @@ -190,7 +191,7 @@ func printVerbose(cmd *cobra.Command, reports *entities.SystemDfReport) error { return err } if err := writeTemplate(rpt, hdrs, dfContainers); err != nil { - return nil + return err } fmt.Fprint(rpt.Writer(), "\nLocal Volumes space usage:\n\n") @@ -288,6 +289,10 @@ func (d *dfSummary) Size() string { } func (d *dfSummary) Reclaimable() string { - percent := int(float64(d.reclaimable)/float64(d.size)) * 100 + percent := 0 + // make sure to check this to prevent div by zero problems + if d.size > 0 { + percent = int(math.Round(float64(d.reclaimable) / float64(d.size) * float64(100))) + } return fmt.Sprintf("%s (%d%%)", units.HumanSize(float64(d.reclaimable)), percent) } diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go index c6b6546e7..5d7b31314 100644 --- a/cmd/podman/system/migrate.go +++ b/cmd/podman/system/migrate.go @@ -1,3 +1,4 @@ +//go:build !remote // +build !remote package system diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go index b310dc607..f24488822 100644 --- a/cmd/podman/system/renumber.go +++ b/cmd/podman/system/renumber.go @@ -1,3 +1,4 @@ +//go:build !remote // +build !remote package system diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go index 07904faaa..e8cf127b7 100644 --- a/cmd/podman/system/reset.go +++ b/cmd/podman/system/reset.go @@ -1,3 +1,4 @@ +//go:build !remote // +build !remote package system diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go index daf252401..1a93b3137 100644 --- a/cmd/podman/system/service.go +++ b/cmd/podman/system/service.go @@ -1,3 +1,4 @@ +//go:build linux && !remote // +build linux,!remote package system @@ -66,7 +67,7 @@ func init() { flags.StringVarP(&srvArgs.PProfAddr, "pprof-address", "", "", "Binding network address for pprof profile endpoints, default: do not expose endpoints") - flags.MarkHidden("pprof-address") + _ = flags.MarkHidden("pprof-address") } func aliasTimeoutFlag(_ *pflag.FlagSet, name string) pflag.NormalizedName { diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go index 560cce847..d6b42ed29 100644 --- a/cmd/podman/system/service_abi.go +++ b/cmd/podman/system/service_abi.go @@ -1,3 +1,4 @@ +//go:build linux && !remote // +build linux,!remote package system diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go index 6239482b5..9fb4a966a 100644 --- a/cmd/podman/system/version.go +++ b/cmd/podman/system/version.go @@ -89,9 +89,7 @@ Client:\tPodman Engine Version:\t{{.Version}} API Version:\t{{.APIVersion}} Go Version:\t{{.GoVersion}} -{{if .GitCommit -}} - Git Commit:\t{{.GitCommit}} -{{- end}} +{{if .GitCommit -}}Git Commit:\t{{.GitCommit}}\n{{end -}} Built:\t{{.BuiltTime}} OS/Arch:\t{{.OsArch}} {{- end}} @@ -102,9 +100,7 @@ Server:\tPodman Engine Version:\t{{.Version}} API Version:\t{{.APIVersion}} Go Version:\t{{.GoVersion}} -{{if .GitCommit -}} - Git Commit:\t{{.GitCommit}} -{{- end}} +{{if .GitCommit -}}Git Commit:\t{{.GitCommit}}\n{{end -}} Built:\t{{.BuiltTime}} OS/Arch:\t{{.OsArch}} {{- end}}{{- end}} |