diff --git a/.dredd/hooks/capabilities.go b/.dredd/hooks/capabilities.go index 37c53dbd..ccfcf6a4 100644 --- a/.dredd/hooks/capabilities.go +++ b/.dredd/hooks/capabilities.go @@ -26,7 +26,7 @@ var templateID int64 var capabilities = map[string][]string{ "user": {}, "project": {"user"}, - "access_key": {"project"}, + //"access_key": {"project"}, "repository": {"access_key"}, "inventory": {"repository"}, "environment": {"repository"}, diff --git a/api/tasks/pool.go b/api/tasks/pool.go index ebe42664..b7e64d35 100644 --- a/api/tasks/pool.go +++ b/api/tasks/pool.go @@ -98,7 +98,7 @@ func (p *taskPool) run() { p.queue = append(p.queue[1:], t) continue } - log.Info("Set resourse locker with task " + strconv.Itoa(t.task.ID)) + log.Info("Set resource locker with task " + strconv.Itoa(t.task.ID)) resourceLocker <- &resourceLock{lock: true, holder: t} if !t.prepared { go t.prepareRun() diff --git a/api/tasks/runner.go b/api/tasks/runner.go index f18606c5..1edba49a 100644 --- a/api/tasks/runner.go +++ b/api/tasks/runner.go @@ -52,7 +52,7 @@ func (t *task) prepareRun() { defer func() { log.Info("Stopped preparing task " + strconv.Itoa(t.task.ID)) - log.Info("Release resourse locker with task " + strconv.Itoa(t.task.ID)) + log.Info("Release resource locker with task " + strconv.Itoa(t.task.ID)) resourceLocker <- &resourceLock{lock: false, holder: t} objType := taskTypeID diff --git a/db/sql/task.go b/db/sql/task.go index 1e7bab2a..44f90691 100644 --- a/db/sql/task.go +++ b/db/sql/task.go @@ -85,23 +85,31 @@ func (d *SqlDb) GetProjectTasks(projectID int, params db.RetrieveQueryParams) ([ } func (d *SqlDb) DeleteTaskWithOutputs(projectID int, taskID int) (err error) { + // check if task exists in the project _, err = d.GetTask(projectID, taskID) if err != nil { return } - _, err = d.sql.Exec("delete from task__output where project_id=? AND task_id=?", projectID, taskID) + _, err = d.sql.Exec("delete from task__output where task_id=?", taskID) if err != nil { return } - _, err = d.sql.Exec("delete from task where id=?", projectID, taskID) + _, err = d.sql.Exec("delete from task where id=?", taskID) return } func (d *SqlDb) GetTaskOutputs(projectID int, taskID int) (output []db.TaskOutput, err error) { + // check if task exists in the project + _, err = d.GetTask(projectID, taskID) + + if err != nil { + return + } + _, err = d.sql.Select(&output, "select task_id, task, time, output from task__output where task_id=? order by time asc", taskID) diff --git a/go.mod b/go.mod index 13044adc..3c8f730f 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/radovskyb/watcher v1.0.7 // indirect github.com/russross/blackfriday v1.5.2 github.com/sirupsen/logrus v1.4.2 // indirect - github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa // indirect + github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/cobra v0.0.5 // indirect github.com/ziutek/mymysql v1.5.4 // indirect golang.org/x/crypto v0.0.0-20200208060501-ecb85df21340