Skip to content

Commit

Permalink
Merge pull request #14297 from hashicorp/b-logmon-fork-mystery-bin
Browse files Browse the repository at this point in the history
client/logmon: acquire executable in init block
  • Loading branch information
shoenig committed Aug 24, 2022
2 parents 34e4b08 + 24a1c48 commit bb72d81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/14297.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
client/logmon: fixed a bug where logmon cannot find nomad executable
```
19 changes: 12 additions & 7 deletions client/logmon/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ import (
"os"
"os/exec"

hclog "github.com/hashicorp/go-hclog"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/client/logmon/proto"
"github.com/hashicorp/nomad/plugins/base"
"google.golang.org/grpc"
)

var bin = getBin()

func getBin() string {
b, err := os.Executable()
if err != nil {
panic(err)
}
return b
}

// LaunchLogMon launches a new logmon or reattaches to an existing one.
// TODO: Integrate with base plugin loader
func LaunchLogMon(logger hclog.Logger, reattachConfig *plugin.ReattachConfig) (LogMon, *plugin.Client, error) {
logger = logger.Named("logmon")
bin, err := os.Executable()
if err != nil {
return nil, nil, err
}

conf := &plugin.ClientConfig{
HandshakeConfig: base.Handshake,
Plugins: map[string]plugin.Plugin{
Expand Down

0 comments on commit bb72d81

Please sign in to comment.