deps: updates for packages and imports (#10962)
parent
a59e6b8d25
commit
5266cba346
|
@ -16,6 +16,7 @@ import (
|
|||
platform "github.com/influxdata/influxdb"
|
||||
"github.com/influxdata/influxdb/cmd/influxd/launcher"
|
||||
"github.com/influxdata/influxdb/http"
|
||||
_ "github.com/influxdata/influxdb/query/builtin"
|
||||
)
|
||||
|
||||
// Default context.
|
||||
|
|
2
go.mod
2
go.mod
|
@ -73,7 +73,7 @@ require (
|
|||
github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20181106190520-2236f141171e // indirect
|
||||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
|
||||
github.com/imdario/mergo v0.3.6 // indirect
|
||||
github.com/influxdata/flux v0.13.1-0.20190109181605-45cc7b741a21
|
||||
github.com/influxdata/flux v0.13.1-0.20190110181412-b10896e80291
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
|
||||
github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368
|
||||
github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -215,8 +215,8 @@ github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
|
|||
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/flux v0.13.1-0.20190109181605-45cc7b741a21 h1:zeeKoL71vc9yy99h8wFEIU0RFLefzAl4sPm0kY0XZvQ=
|
||||
github.com/influxdata/flux v0.13.1-0.20190109181605-45cc7b741a21/go.mod h1:0f5Yrm4VPSd/Ne6jIVOVtPo0MFe6jpLCr6vdaZYp7wY=
|
||||
github.com/influxdata/flux v0.13.1-0.20190110181412-b10896e80291 h1:rjfc0AtIJi/JIUT7Y0toX/cKO45kUtRFKGYwzTcbkB0=
|
||||
github.com/influxdata/flux v0.13.1-0.20190110181412-b10896e80291/go.mod h1:0f5Yrm4VPSd/Ne6jIVOVtPo0MFe6jpLCr6vdaZYp7wY=
|
||||
github.com/influxdata/goreleaser v0.86.2-0.20181010170531-0fd209ba67f5/go.mod h1:aVuBpDAT5VtjtUxzvBt8HOd0buzvvk7OX3H2iaviixg=
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6 h1:CFx+pP90q/qg3spoiZjf8donE4WpAdjeJfPOcoNqkWo=
|
||||
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZgb3N+tzevNgo=
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/influxdata/flux"
|
||||
"github.com/influxdata/flux/ast"
|
||||
"github.com/influxdata/flux/csv"
|
||||
"github.com/influxdata/flux/interpreter"
|
||||
"github.com/influxdata/flux/lang"
|
||||
"github.com/influxdata/flux/parser"
|
||||
"github.com/influxdata/flux/semantic"
|
||||
|
@ -216,17 +217,32 @@ func nowFunc(now time.Time) values.Function {
|
|||
}
|
||||
|
||||
func toSpec(p *ast.Package, now func() time.Time) (*flux.Spec, error) {
|
||||
itrp := flux.NewInterpreter()
|
||||
itrp.SetOption("now", nowFunc(now()))
|
||||
semProg, err := semantic.New(p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := itrp.Eval(semProg, nil); err != nil {
|
||||
scope := flux.Prelude()
|
||||
scope.Set("now", nowFunc(now()))
|
||||
|
||||
itrp := interpreter.NewInterpreter()
|
||||
|
||||
sideEffects, err := itrp.Eval(semProg, scope, flux.StdLib())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return flux.ToSpec(itrp, itrp.SideEffects()...), nil
|
||||
|
||||
nowOpt, ok := scope.Lookup("now")
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("now option not set")
|
||||
}
|
||||
|
||||
nowTime, err := nowOpt.Function().Call(nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return flux.ToSpec(sideEffects, nowTime.Time().Time())
|
||||
}
|
||||
|
||||
// ProxyRequest returns a request to proxy from the flux.
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
_ "github.com/influxdata/flux/functions/outputs"
|
||||
_ "github.com/influxdata/flux/functions/tests"
|
||||
_ "github.com/influxdata/flux/functions/transformations"
|
||||
_ "github.com/influxdata/flux/functions/universe"
|
||||
_ "github.com/influxdata/flux/options" // Import the built-in options
|
||||
_ "github.com/influxdata/influxdb/query/functions" // Import the built-in functions
|
||||
_ "github.com/influxdata/influxdb/query/functions/inputs"
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
_ "github.com/influxdata/flux/functions/outputs"
|
||||
_ "github.com/influxdata/flux/functions/tests"
|
||||
_ "github.com/influxdata/flux/functions/transformations"
|
||||
_ "github.com/influxdata/flux/functions/universe"
|
||||
_ "github.com/influxdata/flux/options" // Import the built-in options
|
||||
_ "github.com/influxdata/influxdb/query/functions" // Import the built-in functions
|
||||
_ "github.com/influxdata/influxdb/query/functions/inputs"
|
||||
|
|
|
@ -61,14 +61,14 @@ func FromScript(script string) (Options, error) {
|
|||
|
||||
opt := Options{Retry: 1, Concurrency: 1}
|
||||
|
||||
inter := flux.NewInterpreter()
|
||||
if err := flux.Eval(inter, script); err != nil {
|
||||
_, scope, err := flux.Eval(script)
|
||||
if err != nil {
|
||||
return opt, err
|
||||
}
|
||||
|
||||
// pull options from interpreter
|
||||
task := inter.Option("task")
|
||||
if task == nil {
|
||||
// pull options from the program scope
|
||||
task, ok := scope.Lookup("task")
|
||||
if !ok {
|
||||
return opt, errors.New("task not defined")
|
||||
}
|
||||
optObject := task.Object()
|
||||
|
|
Loading…
Reference in New Issue