mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Fix vet and staticcheck warning
This commit is contained in:
parent
1d0bdd56c7
commit
0c2904d982
@ -182,7 +182,7 @@ func (api *RestApi) tagJob(rw http.ResponseWriter, r *http.Request) {
|
|||||||
// there are optional here (e.g. `jobState` defaults to "running").
|
// there are optional here (e.g. `jobState` defaults to "running").
|
||||||
func (api *RestApi) startJob(rw http.ResponseWriter, r *http.Request) {
|
func (api *RestApi) startJob(rw http.ResponseWriter, r *http.Request) {
|
||||||
if user := auth.GetUser(r.Context()); user != nil && !user.HasRole(auth.RoleApi) {
|
if user := auth.GetUser(r.Context()); user != nil && !user.HasRole(auth.RoleApi) {
|
||||||
log.Warnf("user '%s' used /api/jobs/start_job/ without having the API role")
|
log.Warnf("user '%s' used /api/jobs/start_job/ without having the API role", user.Username)
|
||||||
http.Error(rw, "missing 'api' role", http.StatusForbidden)
|
http.Error(rw, "missing 'api' role", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -264,9 +264,10 @@ func (api *RestApi) stopJob(rw http.ResponseWriter, r *http.Request) {
|
|||||||
var job *schema.Job
|
var job *schema.Job
|
||||||
var err error
|
var err error
|
||||||
if ok {
|
if ok {
|
||||||
id, err := strconv.ParseInt(id, 10, 64)
|
id, e := strconv.ParseInt(id, 10, 64)
|
||||||
if err != nil {
|
if e != nil {
|
||||||
http.Error(rw, err.Error(), http.StatusBadRequest)
|
http.Error(rw, e.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
job, err = api.JobRepository.FindById(id)
|
job, err = api.JobRepository.FindById(id)
|
||||||
|
Loading…
Reference in New Issue
Block a user