mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
plugins device: remove trace level containing config contents
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
|||||||
"github.com/hashicorp/nomad/plugins/device"
|
"github.com/hashicorp/nomad/plugins/device"
|
||||||
"github.com/kr/pretty"
|
"github.com/kr/pretty"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/zclconf/go-cty/cty/msgpack"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeviceCommandFactory(meta Meta) cli.CommandFactory {
|
func DeviceCommandFactory(meta Meta) cli.CommandFactory {
|
||||||
@@ -100,8 +99,6 @@ func (c *Device) Run(args []string) int {
|
|||||||
c.logger.Error("failed to read config file", "error", err)
|
c.logger.Error("failed to read config file", "error", err)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Trace("read config", "config", string(config))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the plugin
|
// Get the plugin
|
||||||
@@ -173,8 +170,6 @@ func (c *Device) getSpec() (hcldec.Spec, error) {
|
|||||||
return nil, fmt.Errorf("failed to get config schema: %v", err)
|
return nil, fmt.Errorf("failed to get config schema: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Trace("device spec", "spec", hclog.Fmt("% #v", pretty.Formatter(spec)))
|
|
||||||
|
|
||||||
// Convert the schema
|
// Convert the schema
|
||||||
schema, diag := hclspecutils.Convert(spec)
|
schema, diag := hclspecutils.Convert(spec)
|
||||||
if diag.HasErrors() {
|
if diag.HasErrors() {
|
||||||
@@ -195,18 +190,10 @@ func (c *Device) setConfig(spec hcldec.Spec, apiVersion string, config []byte, n
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Trace("raw hcl config", "config", hclog.Fmt("% #v", pretty.Formatter(configVal)))
|
_, diag, diagErrs := hclutils.ParseHclInterface(configVal, spec, nil)
|
||||||
|
|
||||||
val, diag, diagErrs := hclutils.ParseHclInterface(configVal, spec, nil)
|
|
||||||
if diag.HasErrors() {
|
if diag.HasErrors() {
|
||||||
return multierror.Append(errors.New("failed to parse config: "), diagErrs...)
|
return multierror.Append(errors.New("failed to parse config: "), diagErrs...)
|
||||||
}
|
}
|
||||||
c.logger.Trace("parsed hcl config", "config", hclog.Fmt("% #v", pretty.Formatter(val)))
|
|
||||||
|
|
||||||
cdata, err := msgpack.Marshal(val, val.Type())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
req := &base.Config{
|
req := &base.Config{
|
||||||
PluginConfig: cdata,
|
PluginConfig: cdata,
|
||||||
@@ -214,7 +201,6 @@ func (c *Device) setConfig(spec hcldec.Spec, apiVersion string, config []byte, n
|
|||||||
ApiVersion: apiVersion,
|
ApiVersion: apiVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Trace("msgpack config", "config", string(cdata))
|
|
||||||
if err := c.dev.SetConfig(req); err != nil {
|
if err := c.dev.SetConfig(req); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user