From ea29665a8ac4e68d754bd93fdebd1ed7a5bbd57a Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 13 Jan 2021 15:44:28 -0700 Subject: [PATCH] ceph: during object store deletion return success if not found If the object store is not found during deletion of the object store CR, proceed with the deletion instead of blocking and re-queueing the deletion reconcile in an endless loop. This was causing instability in the integration tests. Signed-off-by: Travis Nielsen --- pkg/operator/ceph/object/objectstore.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/object/objectstore.go b/pkg/operator/ceph/object/objectstore.go index f73c4e4e1..6e607b204 100644 --- a/pkg/operator/ceph/object/objectstore.go +++ b/pkg/operator/ceph/object/objectstore.go @@ -157,6 +157,10 @@ func deleteSingleSiteRealmAndPools(objContext *Context, spec cephv1.ObjectStoreS if err != nil { return errors.Wrap(err, "failed to detect object stores during deletion") } + if len(stores) == 0 { + logger.Infof("did not find object store %q, nothing to delete", objContext.Name) + return nil + } logger.Infof("Found stores %v when deleting store %s", stores, objContext.Name) err = deleteRealm(objContext) @@ -560,7 +564,8 @@ func DecodeZoneGroupConfig(data string) (zoneGroupType, error) { func getObjectStores(context *Context) ([]string, error) { output, err := RunAdminCommandNoMultisite(context, "realm", "list") if err != nil { - if strings.Index(err.Error(), "exit status 2") != 0 { + // exit status 2 indicates the object store does not exist, so return nothing + if strings.Index(err.Error(), "exit status 2") == 0 { return []string{}, nil } return nil, err