-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run / Stop commands #74
Conversation
// convertJob is used to take a *structs.Job and convert it to an *api.Job. | ||
// This function is just a hammer and probably needs to be revisited. | ||
func convertJob(in *structs.Job) (*api.Job, error) { | ||
var apiJob *api.Job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapstructure
maybe cleaner for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did look at mapstructure for this but it seemed like I still needed to first convert to a map[string]interface{}
, then from that to the *api.Job
. Maybe there's something I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanuber Take a look here: http://godoc.org/github.com/mitchellh/mapstructure#Decode
It is interface{} to interface{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... PHP mode isn't working.
package main
import "github.com/mitchellh/mapstructure"
type x struct {
ID string
}
type y struct {
ID string
}
func main() {
in := &x{"hi"}
out := new(y)
if err := mapstructure.Decode(in, out); err != nil {
println(err.Error())
return
}
}
$ go run test.go
'' expected a map, got 'struct'
The reason I was thinking a map was required was because of these comments.
/cc @mitchellh
Left some UX feedback, but LGTM |
Great feedback, will get these addressed! |
47f542c
to
5a36ace
Compare
BOOM |
allow a node to vote for the current leader, fixes hashicorp#74
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR has the new
run
andstop
commands, as well as theeval-monitor
command. There is a small state monitor that we use in all of these commands to watch what Nomad does once the commands are issued. You can optionally detach immediately using the-detach
option for run or stop.I've included docs and tests for everything so far, all suggestions for the UX welcome.