i know not a single thing about golang
also i hate tabs
This commit is contained in:
@@ -7,6 +7,7 @@ type Source struct {
|
|||||||
ConsulToken string `json:"consul_token"`
|
ConsulToken string `json:"consul_token"`
|
||||||
VaultToken string `json:"vault_token"`
|
VaultToken string `json:"vault_token"`
|
||||||
Templating bool `json:"templating"`
|
Templating bool `json:"templating"`
|
||||||
|
Restart bool `json:"restart"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type JobVersion struct {
|
type JobVersion struct {
|
||||||
|
20
out/main.go
20
out/main.go
@@ -68,6 +68,26 @@ func main() {
|
|||||||
common.Check(err, "Error writing output file")
|
common.Check(err, "Error writing output file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( config.Source.Restart != false ) {
|
||||||
|
cmd := exec.Command(
|
||||||
|
"nomad",
|
||||||
|
"job",
|
||||||
|
"stop",
|
||||||
|
"-purge",
|
||||||
|
"-address="+config.Source.URL,
|
||||||
|
"-token="+config.Source.Token,
|
||||||
|
config.Source.Name,
|
||||||
|
)
|
||||||
|
var out bytes.Buffer
|
||||||
|
cmd.Stdout = &out
|
||||||
|
cmd.Stderr = &out
|
||||||
|
err = cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error executing nomad: %s\n", err)
|
||||||
|
fmt.Fprint(os.Stderr, out.String())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
cmd := exec.Command(
|
cmd := exec.Command(
|
||||||
"nomad",
|
"nomad",
|
||||||
"job",
|
"job",
|
||||||
|
Reference in New Issue
Block a user