mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 05:33:49 +03:00
cmd: ignore missing keys during storage export (#6697)
This commit is contained in:
parent
6028ff27fa
commit
b3ce260389
1 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/caddyserver/certmagic"
|
"github.com/caddyserver/certmagic"
|
||||||
|
@ -190,12 +191,20 @@ func cmdExportStorage(fl Flags) (int, error) {
|
||||||
for _, k := range keys {
|
for _, k := range keys {
|
||||||
info, err := stor.Stat(ctx, k)
|
info, err := stor.Stat(ctx, k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, fs.ErrNotExist) {
|
||||||
|
caddy.Log().Warn(fmt.Sprintf("key: %s removed while export is in-progress", k))
|
||||||
|
continue
|
||||||
|
}
|
||||||
return caddy.ExitCodeFailedQuit, err
|
return caddy.ExitCodeFailedQuit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.IsTerminal {
|
if info.IsTerminal {
|
||||||
v, err := stor.Load(ctx, k)
|
v, err := stor.Load(ctx, k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, fs.ErrNotExist) {
|
||||||
|
caddy.Log().Warn(fmt.Sprintf("key: %s removed while export is in-progress", k))
|
||||||
|
continue
|
||||||
|
}
|
||||||
return caddy.ExitCodeFailedQuit, err
|
return caddy.ExitCodeFailedQuit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue