Skip to content

Commit

Permalink
fix: null pointer to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Feb 4, 2024
1 parent 94c5dcb commit 78c93b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion db_lib/AppFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ package db_lib

import (
"github.com/ansible-semaphore/semaphore/db"
"github.com/ansible-semaphore/semaphore/lib"
)

func CreateApp(template db.Template, repository db.Repository) LocalApp {
func CreateApp(template db.Template, repository db.Repository, logger lib.Logger) LocalApp {
switch template.App {
case db.TemplateAnsible:
return &AnsibleApp{
Template: template,
Repository: repository,
Logger: logger,
Playbook: &AnsiblePlaybook{
TemplateID: template.ID,
Repository: repository,
Expand Down
2 changes: 1 addition & 1 deletion services/runners/JobPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func (p *JobPool) checkNewJobs() {
Inventory: newJob.Inventory,
Repository: newJob.Repository,
Environment: newJob.Environment,
App: db_lib.CreateApp(newJob.Template, newJob.Repository),
App: db_lib.CreateApp(newJob.Template, newJob.Repository, nil),
},
}

Expand Down
2 changes: 1 addition & 1 deletion services/tasks/TaskPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func (p *TaskPool) AddTask(taskObj db.Task, userID *int, projectID int) (newTask
Repository: taskRunner.Repository,
Environment: taskRunner.Environment,
Logger: &taskRunner,
App: db_lib.CreateApp(taskRunner.Template, taskRunner.Repository),
App: db_lib.CreateApp(taskRunner.Template, taskRunner.Repository, &taskRunner),
}
}

Expand Down

0 comments on commit 78c93b1

Please sign in to comment.