fix(flux): inject sane defaults dependency for flux (#23309) (#23314)

This is to prevent an error and also to remove the size limit for
queries.
/ # cat broke.flux 
import "types"

host="http://127.0.0.1:8086"
token="myuser:mypass"

from(bucket: "vehicle_communication/30days", host: host, token: token)
    |> range(start: -1h)
    |> filter(fn: (r) => types.isType(v: r["_value"], type: "int"))
    |> aggregateWindow(every: 1m, fn: mean)



/ # cat broke.flux | /influx -username influx_support -type flux -password <pass>
{"error":"failed to initialize execute state: Provider.ReaderFor called on an error dependency"}
pull/23338/head
J. Emrys Landivar 2022-04-29 12:22:25 -05:00 committed by GitHub
parent 8f78c4bb02
commit aa53a85774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -5,6 +5,10 @@ import (
"errors"
"github.com/influxdata/flux"
"github.com/influxdata/flux/dependencies"
"github.com/influxdata/flux/dependencies/http"
"github.com/influxdata/flux/dependencies/secret"
"github.com/influxdata/flux/dependencies/url"
"github.com/influxdata/influxdb/coordinator"
)
@ -65,7 +69,16 @@ func NewDependencies(
authEnabled bool,
writer PointsWriter,
) (Dependencies, error) {
fdeps := flux.NewDefaultDependencies()
validator := &url.PassValidator{}
fdeps := dependencies.NewDefaultDependencies("")
fdeps.Deps = flux.Deps{
Deps: flux.WrappedDeps{
HTTPClient: http.NewDefaultClient(validator),
FilesystemService: nil,
SecretService: secret.EmptySecretService{},
URLValidator: validator,
},
}
deps := Dependencies{FluxDeps: fdeps}
deps.StorageDeps = StorageDependencies{
Reader: reader,