Skip to content

Commit

Permalink
worker/awsCertlint: disable worker if we can't find our binary
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Apr 9, 2018
1 parent b14f752 commit b6753c7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions worker/awsCertlint/awsCertlint.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"time"

"github.com/mozilla/tls-observatory/certificate"
"github.com/mozilla/tls-observatory/logger"
"github.com/mozilla/tls-observatory/worker"
)

Expand All @@ -20,6 +22,9 @@ var (
workerDesc = "Runs the awslabs certificate linter and saves output"

certlintDirectory = "/go/certlint" // path from tools/Dockerfile-scanner
binaryPath = "bin/certlint" // path inside `certlintDirectory`

log = logger.GetLogger()
)

type Result struct {
Expand All @@ -37,6 +42,14 @@ func init() {
certlintDirectory = path
}

// Verify code was pulled down
fullPath := filepath.Join(certlintDirectory, binaryPath)
_, err := os.Stat(fullPath)
if err != nil && os.IsNotExist(err) {
log.Printf("Could not find awslabs/certlint (tried %s), disabling worker\n", fullPath)
return
}

runner := new(eval)
worker.RegisterWorker(workerName, worker.Info{Runner: runner, Description: workerDesc})
}
Expand Down

0 comments on commit b6753c7

Please sign in to comment.