Parse default job on client side

This commit is contained in:
sirkrypt0
2021-05-07 10:35:07 +02:00
committed by Konrad Hanff
parent 1aaad5c5fe
commit 9a5d982dfc
3 changed files with 823 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ import (
_ "embed"
"fmt"
nomadApi "github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/jobspec2"
"strconv"
)
@@ -17,7 +18,12 @@ const (
)
func (apiClient *ApiClient) defaultJob() *nomadApi.Job {
job, err := apiClient.client.Jobs().ParseHCL(defaultJobHCL, true)
config := jobspec2.ParseConfig{
Body: []byte(defaultJobHCL),
AllowFS: false,
Strict: true,
}
job, err := jobspec2.ParseWithConfig(&config)
if err != nil {
log.WithError(err).Fatal("Error parsing default Nomad job")
return nil