mirror of
https://github.com/containers/podman.git
synced 2025-07-04 01:48:28 +08:00
fix podman system df format error
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"text/template"
|
"text/template"
|
||||||
@ -69,6 +70,14 @@ func printSummary(reports *entities.SystemDfReport, userFormat string) error {
|
|||||||
|
|
||||||
// Images
|
// Images
|
||||||
if len(userFormat) > 0 {
|
if len(userFormat) > 0 {
|
||||||
|
if !strings.HasSuffix(userFormat, `\n`) {
|
||||||
|
userFormat += `\n`
|
||||||
|
}
|
||||||
|
// should be Unquoto from cmd line
|
||||||
|
userFormat, err := strconv.Unquote(`"` + userFormat + `"`)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
format = userFormat
|
format = userFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,10 @@ function teardown() {
|
|||||||
run_podman run -d -v /myvol2 --name c2 $IMAGE \
|
run_podman run -d -v /myvol2 --name c2 $IMAGE \
|
||||||
sh -c 'while ! test -e /stop; do sleep 0.1;done'
|
sh -c 'while ! test -e /stop; do sleep 0.1;done'
|
||||||
|
|
||||||
run_podman system df --format '{{ .Type }}:{{ .Total }}:{{ .Active }}--'
|
run_podman system df --format '{{ .Type }}:{{ .Total }}:{{ .Active }}'
|
||||||
# FIXME: if/when #7149 gets fixed, split this into three tests (i.e. test "${lines[0]}", [1], [2] )
|
is "${lines[0]}" "Images:1:1" "system df : Images line"
|
||||||
is "$output" "Images:1:1--Containers:2:1--Local Volumes:2:1--"
|
is "${lines[1]}" "Containers:2:1" "system df : Containers line"
|
||||||
|
is "${lines[2]}" "Local Volumes:2:1" "system df : Volumes line"
|
||||||
|
|
||||||
# Try -v. (Grrr. No way to specify individual formats)
|
# Try -v. (Grrr. No way to specify individual formats)
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user