From c7c5a73a1a78c2384de61dc72feb9eaa9c2ba258 Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Tue, 2 Apr 2024 20:23:46 -0400 Subject: [PATCH] copy-content: delete destination dirs before copying (#3197) Signed-off-by: Joe Lanford Upstream-repository: operator-lifecycle-manager Upstream-commit: 3ed3c63ea9f724da7d51062ab7f21da611dc6628 --- staging/operator-lifecycle-manager/cmd/copy-content/main.go | 4 ++++ .../operator-lifecycle-manager/cmd/copy-content/main.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/staging/operator-lifecycle-manager/cmd/copy-content/main.go b/staging/operator-lifecycle-manager/cmd/copy-content/main.go index 94c4046ef0..eb57e979fe 100644 --- a/staging/operator-lifecycle-manager/cmd/copy-content/main.go +++ b/staging/operator-lifecycle-manager/cmd/copy-content/main.go @@ -31,6 +31,10 @@ func main() { *catalogSource: *catalogDestination, *cacheSource: *cacheDestination, } { + if err := os.RemoveAll(to); err != nil { + fmt.Printf("failed to remove %s: %s", to, err) + os.Exit(1) + } if err := copy.Copy(from, to); err != nil { fmt.Printf("failed to copy %s to %s: %s\n", from, to, err) os.Exit(1) diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/copy-content/main.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/copy-content/main.go index 94c4046ef0..eb57e979fe 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/copy-content/main.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/cmd/copy-content/main.go @@ -31,6 +31,10 @@ func main() { *catalogSource: *catalogDestination, *cacheSource: *cacheDestination, } { + if err := os.RemoveAll(to); err != nil { + fmt.Printf("failed to remove %s: %s", to, err) + os.Exit(1) + } if err := copy.Copy(from, to); err != nil { fmt.Printf("failed to copy %s to %s: %s\n", from, to, err) os.Exit(1)