Skip to content

Commit

Permalink
Merge pull request #1484 from liranmauda/liran-backport-into-5.18
Browse files Browse the repository at this point in the history
[Backport into 5.18] Noobaa/Operator: Display error message
  • Loading branch information
liranmauda authored Dec 8, 2024
2 parents 2bca4d8 + ea0c59e commit de18a48
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pkg/bucketclass/bucketclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion pkg/obc/obc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions test/cli/test_cli_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de18a48

Please sign in to comment.