14807: Accept .../instances/_/drain?instance_id=X.
authorTom Clegg <tclegg@veritasgenetics.com>
Wed, 13 Feb 2019 06:52:21 +0000 (01:52 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Fri, 15 Feb 2019 21:13:19 +0000 (16:13 -0500)
Azure Instance IDs contain slashes, so they don't work well as path
parameters.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

lib/dispatchcloud/dispatcher.go

index b7ea15933b0d8c42aefd86993d1036fe0f39038d..814dba917faae2ac4ee8c5b45c00782501e3d02b 100644 (file)
@@ -212,6 +212,9 @@ func (disp *dispatcher) apiInstanceRun(w http.ResponseWriter, r *http.Request) {
 func (disp *dispatcher) apiInstanceIdleBehavior(w http.ResponseWriter, r *http.Request, want worker.IdleBehavior) {
        params, _ := r.Context().Value(httprouter.ParamsKey).(httprouter.Params)
        id := cloud.InstanceID(params.ByName("instance_id"))
+       if qp := r.FormValue("instance_id"); qp != "" {
+               id = cloud.InstanceID(qp)
+       }
        err := disp.pool.SetIdleBehavior(id, want)
        if err != nil {
                httpserver.Error(w, err.Error(), http.StatusNotFound)