File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ package cmd
1616
1717import (
1818 "context"
19- "strings"
2019 "time"
2120
2221 "github.com/spf13/cobra"
22+ apierrors "k8s.io/apimachinery/pkg/api/errors"
2323 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2525 "k8s.io/apimachinery/pkg/types"
@@ -129,7 +129,7 @@ postgresclusters/hippo backup initiated`)
129129 )
130130
131131 if err != nil {
132- if strings . Contains (err . Error (), "conflict" ) {
132+ if apierrors . IsConflict (err ) {
133133 cmd .Printf ("SUGGESTION: The --force-conflicts flag may help in performing this operation." )
134134 }
135135 cmd .Printf ("\n Error requesting update: %s\n " , err )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
2121 "time"
2222
2323 "github.com/spf13/cobra"
24+ apierrors "k8s.io/apimachinery/pkg/api/errors"
2425 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2627 "k8s.io/apimachinery/pkg/types"
@@ -193,7 +194,7 @@ func (config pgBackRestRestore) Run(ctx context.Context) error {
193194 config .PostgresCluster , types .ApplyPatchType , patch ,
194195 config .Patch .PatchOptions (patchOptions ))
195196 if err != nil {
196- if strings . Contains (err . Error (), "conflict" ) {
197+ if apierrors . IsConflict (err ) {
197198 fmt .Fprintf (config .Out , "SUGGESTION: The --force-conflicts flag may help in performing this operation.\n " )
198199 }
199200 return err
You can’t perform that action at this time.
0 commit comments