Skip to content

Commit cfae265

Browse files
author
Ashish Pandey
authored
Merge pull request #1482 from aspandey/error-message
Noobaa/Operator: Display error message
2 parents 2bca4d8 + 553c496 commit cfae265

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

pkg/bucketclass/bucketclass.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ func RunDelete(cmd *cobra.Command, args []string) {
425425
bucketClass.Name = args[0]
426426
bucketClass.Namespace = options.Namespace
427427

428+
if !util.KubeCheck(bucketClass) {
429+
log.Fatalf(`❌ Could not delete, BucketClass %q in namespace %q does not exist`,
430+
bucketClass.Name, bucketClass.Namespace)
431+
}
432+
428433
if !util.KubeDelete(bucketClass) {
429434
log.Fatalf(`❌ Could not delete BucketClass %q in namespace %q`,
430435
bucketClass.Name, bucketClass.Namespace)

pkg/obc/obc.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func RunCreate(cmd *cobra.Command, args []string) {
147147
log.Fatalf(`❌ NSFS account config must include both UID and GID as positive integers`)
148148
}
149149

150-
if bucketClassName == "" && ( gid > -1 || uid > -1 || distinguishedName != "" ) {
150+
if bucketClassName == "" && (gid > -1 || uid > -1 || distinguishedName != "") {
151151
log.Fatalf(`❌ NSFS account config cannot be set without an NSFS bucketclass`)
152152
}
153153

@@ -331,6 +331,10 @@ func RunDelete(cmd *cobra.Command, args []string) {
331331
obc.Name = args[0]
332332
obc.Namespace = appNamespace
333333

334+
if !util.KubeCheck(obc) {
335+
log.Fatalf(`❌ Could not delete. OBC %q in namespace %q does not exist`, obc.Name, obc.Namespace)
336+
}
337+
334338
if !util.KubeDelete(obc) {
335339
log.Fatalf(`❌ Could not delete OBC %q in namespace %q`,
336340
obc.Name, obc.Namespace)

test/cli/test_cli_functions.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,13 +965,11 @@ function delete_backingstore_path {
965965

966966
function delete_namespacestore_path {
967967
local object_bucket namespace_store
968-
test_noobaa obc delete ${obc[2]}
969-
test_noobaa bucketclass delete ${bucketclass[2]}
970968
local namespacestore=($(test_noobaa silence namespacestore list | grep -v "NAME" | awk '{print $1}'))
971969
local bucketclass=($(test_noobaa silence bucketclass list | grep -v "NAME" | awk '{print $1}'))
972970
local obc=()
973971
local all_obc=($(test_noobaa silence obc list | grep -v "BUCKET-NAME" | awk '{print $2":"$5}'))
974-
972+
975973
# get obcs that their bucketclass is in bucketclass array
976974
for object_bucket in ${all_obc[@]}
977975
do

0 commit comments

Comments
 (0)