Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix delete app parameters #30

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/usecase/app-serve-app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package usecase

import (
"fmt"

"strconv"
"strings"
"time"
Expand All @@ -12,6 +13,7 @@ import (
"github.com/openinfradev/tks-api/internal/repository"
argowf "github.com/openinfradev/tks-api/pkg/argo-client"
"github.com/openinfradev/tks-api/pkg/domain"
"github.com/openinfradev/tks-api/pkg/httpErrors"
"github.com/openinfradev/tks-api/pkg/log"
)

Expand Down Expand Up @@ -189,6 +191,9 @@ func (u *AppServeAppUsecase) DeleteAppServeApp(appId string) (res string, err er
return "", fmt.Errorf("error while getting ASA Info from DB. Err: %s", err)
}

if app == nil {
return "", httpErrors.NewNoContentError(fmt.Errorf("the appId don't exists"))
}
// Validate app status
if app.Status == "WAIT_FOR_PROMOTE" || app.Status == "BLUEGREEN_FAILED" {
return "", fmt.Errorf("the app is in blue-green related state. Promote or abort first before deleting")
Expand Down Expand Up @@ -226,12 +231,7 @@ func (u *AppServeAppUsecase) DeleteAppServeApp(appId string) (res string, err er
"app_name=" + app.Name,
"asa_id=" + app.ID,
"asa_task_id=" + taskId,
"artifact_url=" + "NA",
"image_url=" + "NA",
"port=" + "NA",
"profile=" + "NA",
"resource_spec=" + "NA",
"executable_path=" + "NA",
"tks_info_host=" + viper.GetString("external-address"),
},
})
if err != nil {
Expand Down