You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think everything should provide sane defaults, problem is that there are no sane defaults in the Gornir object (at least for now). I also don't think gornir.New() is the place to provide sane defaults, instead, each plugin should handle its own sane defaults and gornir.New construct a valid Gornir object. For instance:
// url is mandatory while optsForNSOT overrides some default valuesinv, err:=inventory.NewSomeRESTInventory(url, optsForNSOT...)
iferr!=nil {
// handle err
}
// address is mandatory while optsForES overrides some default valueslogger:=logger.NewSomeLogger(address, optsForES...)
iferr!=nil {
// handle err
}
// Parallel doesn't have mandatory options so everything is set via optsParallelrnr:=runner.Parallel(optsParallel...)
gr:=gornir.New(logger, inv, rnr)
So each plugin handles its own defaults and optional builders (I am thinking the pattern you originally proposed for gornir would be great for the plugins) while gornir is just what glues everything together.
Later on we could also implement complex "initializers" that abstracts the pattern above (as another form of plugin?). For instance, nornir has the same pattern as described above (ish) but then there is an initializer InitNornir that takes a configuration file in YAML format and does all the magic for you. For instance:
Should
gornir.New()
provide safe defaults?. Should require you to provide mandatory attributes?. Today looks as simple as:The text was updated successfully, but these errors were encountered: