mirror of https://github.com/docker/cli.git
9a493b1bf7
Before this change, running `docker context rm --force` would fail if the context did not exist. This behavior was different from other commands, which allowed ignoring non-existing objects. For example; when trying to remove a non-existing volume, the command would fail without "force": ```bash docker volume rm nosuchvolume Error: No such volume: nosuchvolume echo $? 1 ``` But using the `-f` / `--force` option would make the command complete successfully (the error itself is still printed for informational purposes); ```bash docker volume rm -f nosuchvolume nosuchvolume echo $? 0 ``` With this patch, `docker context rm` behaves the same: ```bash docker context rm nosuchcontext context "nosuchcontext" does not exist echo $? 1 ``` ```bash docker context rm -f nosuchcontext nosuchcontext echo $? 0 ``` This patch also simplifies how we check if the context exists; previously we would try to read the context's metadata; this could fail if a context was corrupted, or if an empty directory was present. This patch now only checks if the directory exists, without first validating the context's data. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> |
||
---|---|---|
.. | ||
testdata | ||
cmd.go | ||
create.go | ||
create_test.go | ||
export-import_test.go | ||
export.go | ||
import.go | ||
inspect.go | ||
inspect_test.go | ||
list.go | ||
list_test.go | ||
options.go | ||
remove.go | ||
remove_test.go | ||
show.go | ||
show_test.go | ||
update.go | ||
update_test.go | ||
use.go | ||
use_test.go |