Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions api/appStore/deployment/AppStoreDeploymentRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
handler.Logger.Debugw("request payload, UpdateInstalledApp", "payload", request)
installedApp, err := handler.appStoreDeploymentDBService.GetInstalledApp(request.InstalledAppId)
if err != nil {
if util.IsErrNoRows(err) {
common.HandleResourceNotFound(w, r, "installedApp", strconv.Itoa(request.InstalledAppVersionId))
return
}
handler.Logger.Errorw("service err, UpdateInstalledApp", "err", err, "payload", request)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
Expand Down Expand Up @@ -461,6 +465,8 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
if err != nil {
if strings.Contains(err.Error(), "application spec is invalid") {
err = &util.ApiError{Code: "400", HttpStatusCode: 400, UserMessage: "application spec is invalid, please check provided chart values"}
} else if util.IsErrNoRows(err) {
handler.Logger.Errorw("installed app not found", "err", err, "payload", request)
}
handler.Logger.Errorw("service err, UpdateInstalledApp", "err", err, "payload", request)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
Expand Down
24 changes: 20 additions & 4 deletions api/restHandler/ConfigMapRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ func (handler ConfigMapRestHandlerImpl) CMGlobalDelete(w http.ResponseWriter, r
return
}
name := vars["name"]
handler.Logger.Errorw("request payload, CMGlobalDelete", "appId", appId, "id", id, "name", name)
if name == "" || len(name) == 0 {
// handler.Logger.Errorw("request payload, CMGlobalDelete", "appId", appId, "id", id, "name", name)
common.WriteMissingRequiredFieldError(w, "name")
return
}

//RBAC START
token := r.Header.Get("token")
Expand Down Expand Up @@ -574,7 +578,11 @@ func (handler ConfigMapRestHandlerImpl) CMEnvironmentDelete(w http.ResponseWrite
return
}
name := vars["name"]
handler.Logger.Errorw("request payload, CMEnvironmentDelete", "appId", appId, "envId", envId, "id", id, "name", name)
if name == "" || len(name) == 0 {
// handler.Logger.Errorw("request payload, CMGlobalDelete", "appId", appId, "id", id, "name", name)
common.WriteMissingRequiredFieldError(w, "name")
return
}

//RBAC START
token := r.Header.Get("token")
Expand Down Expand Up @@ -630,7 +638,11 @@ func (handler ConfigMapRestHandlerImpl) CSGlobalDelete(w http.ResponseWriter, r
return
}
name := vars["name"]
handler.Logger.Errorw("request payload, CSGlobalDelete", "appId", appId, "id", id, "name", name)
if name == "" || len(name) == 0 {
// handler.Logger.Errorw("request payload, CMGlobalDelete", "appId", appId, "id", id, "name", name)
common.WriteMissingRequiredFieldError(w, "name")
return
}

//RBAC START
token := r.Header.Get("token")
Expand Down Expand Up @@ -684,7 +696,11 @@ func (handler ConfigMapRestHandlerImpl) CSEnvironmentDelete(w http.ResponseWrite
return
}
name := vars["name"]
handler.Logger.Errorw("request payload, CSEnvironmentDelete", "appId", appId, "envId", envId, "id", id, "name", name)
if name == "" || len(name) == 0 {
// handler.Logger.Errorw("request payload, CMGlobalDelete", "appId", appId, "id", id, "name", name)
common.WriteMissingRequiredFieldError(w, "name")
return
}

//RBAC START
token := r.Header.Get("token")
Expand Down
5 changes: 1 addition & 4 deletions api/restHandler/app/pipeline/AutoCompleteRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ func (handler DevtronAppAutoCompleteRestHandlerImpl) GetAppListForAutocomplete(w
if err != nil {
// Error already written by ExtractIntPathParamWithContext
return
}
if err != nil {
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return

} else {
apps, err = handler.devtronAppConfigService.FindAppsByTeamId(teamIdInt)
if err != nil {
Expand Down
28 changes: 20 additions & 8 deletions pkg/pipeline/ConfigMapService.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,10 @@ func (impl ConfigMapServiceImpl) CMGlobalDelete(name string, id int, userId int3
return false, err
}
} else {
impl.logger.Debugw("no config map found for delete with this name", "name", name)

// impl.logger.Debugw("no config map found for delete with this name", "name", name)
// this should return false as no config map found
impl.logger.Errorw("config map does not exist", "name", name, "id", id)
return false, err
}

return true, nil
Expand Down Expand Up @@ -1049,7 +1051,10 @@ func (impl ConfigMapServiceImpl) CMEnvironmentDelete(name string, id int, userId
return false, err
}
} else {
impl.logger.Debugw("no config map found for delete with this name", "name", name)
// impl.logger.Debugw("no config map found for delete with this name", "name", name)
// this should return false as no config map found
impl.logger.Errorw("config map does not exist", "name", name, "id", id)
return false, err
}
return true, nil
}
Expand Down Expand Up @@ -1103,8 +1108,10 @@ func (impl ConfigMapServiceImpl) CSGlobalDelete(name string, id int, userId int3
return false, err
}
} else {
impl.logger.Debugw("no config map found for delete with this name", "name", name)

// impl.logger.Debugw("no config map found for delete with this name", "name", name)
// this should return false as no config map found
impl.logger.Errorw("cs does not exist", "name", name, "id", id)
return false, err
}

return true, nil
Expand Down Expand Up @@ -1158,7 +1165,10 @@ func (impl ConfigMapServiceImpl) CSEnvironmentDelete(name string, id int, userId
return false, err
}
} else {
impl.logger.Debugw("no config map found for delete with this name", "name", name)
// impl.logger.Debugw("no config map found for delete with this name", "name", name)
// this should return false as no config map found
impl.logger.Errorw("cs does not exist", "name", name, "id", id)
return false, err
}

return true, nil
Expand Down Expand Up @@ -1209,8 +1219,10 @@ func (impl ConfigMapServiceImpl) CMGlobalDeleteByAppId(name string, appId int, u
return false, err
}
} else {
impl.logger.Debugw("no config map found for delete with this name", "name", name)

// impl.logger.Debugw("no config map found for delete with this name", "name", name)
// this should return false as no config map found
impl.logger.Errorw("cnfog map does not exist", "name", name)
return false, err
}

return true, nil
Expand Down
Loading