mirror of https://github.com/docker/cli.git
Merge pull request #1551 from thaJeztah/fix_filter_panic
Fix panic when pruning images with label-filter
This commit is contained in:
commit
1408a3189f
|
@ -67,8 +67,7 @@ func cloneFilter(args filters.Args) (newArgs filters.Args, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newArgs, err
|
return newArgs, err
|
||||||
}
|
}
|
||||||
err = newArgs.UnmarshalJSON(b)
|
return filters.FromJSON(string(b))
|
||||||
return newArgs, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPrune(dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, err error) {
|
func runPrune(dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, err error) {
|
||||||
|
|
|
@ -70,6 +70,14 @@ func TestNewPruneCommandSuccess(t *testing.T) {
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "label-filter",
|
||||||
|
args: []string{"--force", "--filter", "label=foobar"},
|
||||||
|
imagesPruneFunc: func(pruneFilter filters.Args) (types.ImagesPruneReport, error) {
|
||||||
|
assert.Check(t, is.Equal("foobar", pruneFilter.Get("label")[0]))
|
||||||
|
return types.ImagesPruneReport{}, nil
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "force-untagged",
|
name: "force-untagged",
|
||||||
args: []string{"--force"},
|
args: []string{"--force"},
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Total reclaimed space: 0B
|
Loading…
Reference in New Issue