DockerCLI/cli/context/store
Nick Santos c2487c2997
context: avoid corrupt file writes
Write to a tempfile then move, so that if the
process dies mid-write it doesn't corrupt the store.

Also improve error messaging so that if a file does
get corrupted, the user has some hope of figuring
out which file is broken.

For background, see:
https://github.com/docker/for-win/issues/13180
https://github.com/docker/for-win/issues/12561

For a repro case, see:
https://github.com/nicks/contextstore-sandbox

Signed-off-by: Nick Santos <nick.santos@docker.com>
2023-02-21 10:37:56 -05:00
..
doc.go format (GoDoc) comments with Go 1.19 to prepare for go updates 2022-07-19 19:10:16 +02:00
io_utils.go Introduce .zip import for docker context 2019-05-29 12:58:45 -07:00
io_utils_test.go cli/context: remove deprecated io/ioutil and use t.TempDir() 2022-02-25 15:42:16 +01:00
metadata_test.go cli/context/store: simplify error handling, and make it more idiomatic 2022-09-30 11:19:25 +02:00
metadatastore.go context: avoid corrupt file writes 2023-02-21 10:37:56 -05:00
store.go format go with gofumpt (with -lang=1.19) 2022-09-30 19:14:36 +02:00
store_test.go context: avoid corrupt file writes 2023-02-21 10:37:56 -05:00
storeconfig.go cli/context/store: New(): return concrete type 2022-09-30 11:19:25 +02:00
storeconfig_test.go cli/context/store: New(): return concrete type 2022-09-30 11:19:25 +02:00
tlsstore.go context: avoid corrupt file writes 2023-02-21 10:37:56 -05:00
tlsstore_test.go cli/context/store: rename removeAllContextData(), removeAllEndpointData() 2022-09-30 11:19:26 +02:00