diff --git a/pkg/bucketclass/bucketclass.go b/pkg/bucketclass/bucketclass.go index 33b0e4cf23..89fe13b16a 100644 --- a/pkg/bucketclass/bucketclass.go +++ b/pkg/bucketclass/bucketclass.go @@ -425,6 +425,11 @@ func RunDelete(cmd *cobra.Command, args []string) { bucketClass.Name = args[0] bucketClass.Namespace = options.Namespace + if !util.KubeCheck(bucketClass) { + log.Fatalf(`❌ Could not delete, BucketClass %q in namespace %q does not exist`, + bucketClass.Name, bucketClass.Namespace) + } + if !util.KubeDelete(bucketClass) { log.Fatalf(`❌ Could not delete BucketClass %q in namespace %q`, bucketClass.Name, bucketClass.Namespace) diff --git a/pkg/obc/obc.go b/pkg/obc/obc.go index f528e26f0e..aa28190997 100644 --- a/pkg/obc/obc.go +++ b/pkg/obc/obc.go @@ -147,7 +147,7 @@ func RunCreate(cmd *cobra.Command, args []string) { log.Fatalf(`❌ NSFS account config must include both UID and GID as positive integers`) } - if bucketClassName == "" && ( gid > -1 || uid > -1 || distinguishedName != "" ) { + if bucketClassName == "" && (gid > -1 || uid > -1 || distinguishedName != "") { log.Fatalf(`❌ NSFS account config cannot be set without an NSFS bucketclass`) } @@ -331,6 +331,10 @@ func RunDelete(cmd *cobra.Command, args []string) { obc.Name = args[0] obc.Namespace = appNamespace + if !util.KubeCheck(obc) { + log.Fatalf(`❌ Could not delete. OBC %q in namespace %q does not exist`, obc.Name, obc.Namespace) + } + if !util.KubeDelete(obc) { log.Fatalf(`❌ Could not delete OBC %q in namespace %q`, obc.Name, obc.Namespace) diff --git a/test/cli/test_cli_functions.sh b/test/cli/test_cli_functions.sh index ea982a780e..953c89c738 100644 --- a/test/cli/test_cli_functions.sh +++ b/test/cli/test_cli_functions.sh @@ -965,13 +965,11 @@ function delete_backingstore_path { function delete_namespacestore_path { local object_bucket namespace_store - test_noobaa obc delete ${obc[2]} - test_noobaa bucketclass delete ${bucketclass[2]} local namespacestore=($(test_noobaa silence namespacestore list | grep -v "NAME" | awk '{print $1}')) local bucketclass=($(test_noobaa silence bucketclass list | grep -v "NAME" | awk '{print $1}')) local obc=() local all_obc=($(test_noobaa silence obc list | grep -v "BUCKET-NAME" | awk '{print $2":"$5}')) - + # get obcs that their bucketclass is in bucketclass array for object_bucket in ${all_obc[@]} do