hashicorp / nomad-skeleton-driver-plugin

A template for writing a Nomad driver plugin.
Mozilla Public License 2.0
31 stars 10 forks source link

not enough arguments in call to executor.ReattachToExecutor #39

Closed FibreFoX closed 2 months ago

FibreFoX commented 2 months ago

I freshly cloned this repository and was greeted with an compile error:

go: downloading github.com/google/uuid v1.3.1
go: downloading github.com/huandu/xstrings v1.4.0
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading github.com/imdario/mergo v0.3.13
go: downloading github.com/spf13/cast v1.5.0
# github.com/hashicorp/nomad-skeleton-driver-plugin/hello
hello/driver.go:455:69: not enough arguments in call to executor.ReattachToExecutor
        have (*"github.com/hashicorp/go-plugin".ReattachConfig, hclog.Logger)
        want (*"github.com/hashicorp/go-plugin".ReattachConfig, hclog.Logger, cpustats.Compute)

After comparing with official driver plugins, I found out that the current example is just missing this. After changing the faulty line the example did compile again

Faulty line: https://github.com/hashicorp/nomad-skeleton-driver-plugin/blob/31c4704a58c19954f91ce21506b227476b6f6fbb/hello/driver.go#L455

Old code:

execImpl, pluginClient, err := executor.ReattachToExecutor(plugRC, d.logger)

Fixed code:

execImpl, pluginClient, err := executor.ReattachToExecutor(plugRC, d.logger, d.nomadConfig.Topology.Compute())
tgross commented 2 months ago

Thanks @FibreFoX. Happy to take a PR if you're open to it, otherwise we'll get that fixed up.