Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: dm/appengine/distributor/jobsim/run.go

Issue 2227113002: Update bulidbucket client (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: add readme Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dm/appengine/distributor/jobsim/run.go
diff --git a/dm/appengine/distributor/jobsim/run.go b/dm/appengine/distributor/jobsim/run.go
index 7ffaaf91c436cf0788e8b4a29fc57c78d55f5f61..afdce1237178b5d63a3e9e496d155f3683dc5bda 100644
--- a/dm/appengine/distributor/jobsim/run.go
+++ b/dm/appengine/distributor/jobsim/run.go
@@ -8,7 +8,6 @@ import (
"encoding/json"
"fmt"
"math/rand"
- "strings"
"time"
"github.com/golang/protobuf/jsonpb"
@@ -16,6 +15,7 @@ import (
"github.com/luci/luci-go/common/clock"
"github.com/luci/luci-go/common/data/rand/cryptorand"
+ "github.com/luci/luci-go/common/lhttp"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/transport"
"github.com/luci/luci-go/dm/api/distributor/jobsim"
@@ -318,19 +318,6 @@ func (r *runner) doFailure(seed int64, chance float32) (stop bool, err error) {
return
}
-func isLocalHost(host string) bool {
- switch {
- case host == "localhost", strings.HasPrefix(host, "localhost:"):
- case host == "127.0.0.1", strings.HasPrefix(host, "127.0.0.1:"):
- case host == "[::1]", strings.HasPrefix(host, "[::1]:"):
- case strings.HasPrefix(host, ":"):
-
- default:
- return false
- }
- return true
-}
-
// runJob is analogous to a single Execution of a recipe. It will:
// * Activate itself with DM.
// * Inspect its previous State to determine where it left off on the previous
@@ -348,7 +335,7 @@ func runJob(c context.Context, host string, state *state, job *jobsim.Phrase, au
Host: host,
Options: prpc.DefaultOptions(),
}
- pcli.Options.Insecure = isLocalHost(host)
+ pcli.Options.Insecure = lhttp.IsLocalHost(host)
dmc := dm.NewDepsPRPCClient(pcli)
r := runner{c, auth, dmc, state}
« common/lhttp/utils.go ('K') | « common/lhttp/utils.go ('k') | dm/tools/dmtool/vizQuery.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698