mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
moved JSON handlers and extension code around a bit for proper order of
initialization
This commit is contained in:
@@ -6,13 +6,14 @@ import (
|
||||
"github.com/hashicorp/go-msgpack/codec"
|
||||
"github.com/hashicorp/hcl"
|
||||
"github.com/hashicorp/hcl/hcl/ast"
|
||||
"github.com/hashicorp/nomad/helper/pluginutils/hclspecutils"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/hashicorp/nomad/plugins/drivers"
|
||||
"github.com/hashicorp/nomad/plugins/shared/hclspec"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
|
||||
"github.com/hashicorp/nomad/helper/pluginutils/hclspecutils"
|
||||
"github.com/hashicorp/nomad/nomad/json/handlers"
|
||||
"github.com/hashicorp/nomad/plugins/drivers"
|
||||
"github.com/hashicorp/nomad/plugins/shared/hclspec"
|
||||
)
|
||||
|
||||
type HCLParser struct {
|
||||
@@ -121,7 +122,7 @@ func JsonConfigToInterface(t *testing.T, config string) interface{} {
|
||||
t.Helper()
|
||||
|
||||
// Decode from json
|
||||
dec := codec.NewDecoderBytes([]byte(config), structs.JsonHandle)
|
||||
dec := codec.NewDecoderBytes([]byte(config), handlers.JsonHandle)
|
||||
|
||||
var m map[string]interface{}
|
||||
err := dec.Decode(&m)
|
||||
|
||||
@@ -9,7 +9,9 @@ import (
|
||||
hcl "github.com/hashicorp/hcl/v2"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
hjson "github.com/hashicorp/hcl/v2/json"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
|
||||
"github.com/hashicorp/nomad/nomad/json/handlers"
|
||||
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
"github.com/zclconf/go-cty/cty/function"
|
||||
"github.com/zclconf/go-cty/cty/function/stdlib"
|
||||
@@ -26,7 +28,7 @@ func ParseHclInterface(val interface{}, spec hcldec.Spec, vars map[string]cty.Va
|
||||
|
||||
// Encode to json
|
||||
var buf bytes.Buffer
|
||||
enc := codec.NewEncoder(&buf, structs.JsonHandle)
|
||||
enc := codec.NewEncoder(&buf, handlers.JsonHandle)
|
||||
err := enc.Encode(val)
|
||||
if err != nil {
|
||||
// Convert to a hcl diagnostics message
|
||||
|
||||
Reference in New Issue
Block a user