Update GetArtifact by removing unused logger

This commit is contained in:
Kenjiro Nakayama 2016-08-06 23:37:32 +09:00
parent ec63c7a3fa
commit 60b58eed84
3 changed files with 6 additions and 14 deletions

View File

@ -2,7 +2,6 @@ package getter
import (
"fmt"
"log"
"net/url"
"path/filepath"
"sync"
@ -63,9 +62,7 @@ func getGetterUrl(taskEnv *env.TaskEnvironment, artifact *structs.TaskArtifact)
}
// GetArtifact downloads an artifact into the specified task directory.
func GetArtifact(taskEnv *env.TaskEnvironment, artifact *structs.TaskArtifact,
taskDir string, logger *log.Logger) error {
func GetArtifact(taskEnv *env.TaskEnvironment, artifact *structs.TaskArtifact, taskDir string) error {
url, err := getGetterUrl(taskEnv, artifact)
if err != nil {
return err

View File

@ -3,7 +3,6 @@ package getter
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"os"
@ -40,8 +39,7 @@ func TestGetArtifact_FileAndChecksum(t *testing.T) {
// Download the artifact
taskEnv := env.NewTaskEnvironment(mock.Node())
logger := log.New(os.Stderr, "", log.LstdFlags)
if err := GetArtifact(taskEnv, artifact, taskDir, logger); err != nil {
if err := GetArtifact(taskEnv, artifact, taskDir); err != nil {
t.Fatalf("GetArtifact failed: %v", err)
}
@ -76,8 +74,7 @@ func TestGetArtifact_File_RelativeDest(t *testing.T) {
// Download the artifact
taskEnv := env.NewTaskEnvironment(mock.Node())
logger := log.New(os.Stderr, "", log.LstdFlags)
if err := GetArtifact(taskEnv, artifact, taskDir, logger); err != nil {
if err := GetArtifact(taskEnv, artifact, taskDir); err != nil {
t.Fatalf("GetArtifact failed: %v", err)
}
@ -128,8 +125,7 @@ func TestGetArtifact_InvalidChecksum(t *testing.T) {
// Download the artifact and expect an error
taskEnv := env.NewTaskEnvironment(mock.Node())
logger := log.New(os.Stderr, "", log.LstdFlags)
if err := GetArtifact(taskEnv, artifact, taskDir, logger); err == nil {
if err := GetArtifact(taskEnv, artifact, taskDir); err == nil {
t.Fatalf("GetArtifact should have failed")
}
}
@ -195,8 +191,7 @@ func TestGetArtifact_Archive(t *testing.T) {
}
taskEnv := env.NewTaskEnvironment(mock.Node())
logger := log.New(os.Stderr, "", log.LstdFlags)
if err := GetArtifact(taskEnv, artifact, taskDir, logger); err != nil {
if err := GetArtifact(taskEnv, artifact, taskDir); err != nil {
t.Fatalf("GetArtifact failed: %v", err)
}

View File

@ -323,7 +323,7 @@ func (r *TaskRunner) run() {
}
for _, artifact := range r.task.Artifacts {
if err := getter.GetArtifact(r.taskEnv, artifact, taskDir, r.logger); err != nil {
if err := getter.GetArtifact(r.taskEnv, artifact, taskDir); err != nil {
r.setState(structs.TaskStateDead,
structs.NewTaskEvent(structs.TaskArtifactDownloadFailed).SetDownloadError(err))
r.restartTracker.SetStartError(dstructs.NewRecoverableError(err, true))