don't use influxdata/config, just use influxdata/toml

This commit is contained in:
Cameron Sparr 2017-02-10 17:27:18 +00:00
parent b550328aa8
commit 4b289fc60d
2 changed files with 8 additions and 10 deletions

1
Godeps
View File

@ -25,7 +25,6 @@ github.com/gorilla/mux 392c28fe23e1c45ddba891b0320b3b5df220beea
github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478 github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
github.com/hashicorp/consul 63d2fc68239b996096a1c55a0d4b400ea4c2583f github.com/hashicorp/consul 63d2fc68239b996096a1c55a0d4b400ea4c2583f
github.com/hpcloud/tail 915e5feba042395f5fda4dbe9c0e99aeab3088b3 github.com/hpcloud/tail 915e5feba042395f5fda4dbe9c0e99aeab3088b3
github.com/influxdata/config 8ec4638a81500c20be24855812bc8498ebe2dc92
github.com/influxdata/toml 5d1d907f22ead1cd47adde17ceec5bda9cacaf8f github.com/influxdata/toml 5d1d907f22ead1cd47adde17ceec5bda9cacaf8f
github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec
github.com/jackc/pgx c8080fc4a1bfa44bf90383ad0fdce2f68b7d313c github.com/jackc/pgx c8080fc4a1bfa44bf90383ad0fdce2f68b7d313c

View File

@ -25,7 +25,6 @@ import (
"github.com/influxdata/telegraf/plugins/processors" "github.com/influxdata/telegraf/plugins/processors"
"github.com/influxdata/telegraf/plugins/serializers" "github.com/influxdata/telegraf/plugins/serializers"
"github.com/influxdata/config"
"github.com/influxdata/toml" "github.com/influxdata/toml"
"github.com/influxdata/toml/ast" "github.com/influxdata/toml/ast"
) )
@ -566,7 +565,7 @@ func (c *Config) LoadConfig(path string) error {
if !ok { if !ok {
return fmt.Errorf("%s: invalid configuration", path) return fmt.Errorf("%s: invalid configuration", path)
} }
if err = config.UnmarshalTable(subTable, c.Tags); err != nil { if err = toml.UnmarshalTable(subTable, c.Tags); err != nil {
log.Printf("E! Could not parse [global_tags] config\n") log.Printf("E! Could not parse [global_tags] config\n")
return fmt.Errorf("Error parsing %s, %s", path, err) return fmt.Errorf("Error parsing %s, %s", path, err)
} }
@ -579,7 +578,7 @@ func (c *Config) LoadConfig(path string) error {
if !ok { if !ok {
return fmt.Errorf("%s: invalid configuration", path) return fmt.Errorf("%s: invalid configuration", path)
} }
if err = config.UnmarshalTable(subTable, c.Agent); err != nil { if err = toml.UnmarshalTable(subTable, c.Agent); err != nil {
log.Printf("E! Could not parse [agent] config\n") log.Printf("E! Could not parse [agent] config\n")
return fmt.Errorf("Error parsing %s, %s", path, err) return fmt.Errorf("Error parsing %s, %s", path, err)
} }
@ -716,7 +715,7 @@ func (c *Config) addAggregator(name string, table *ast.Table) error {
return err return err
} }
if err := config.UnmarshalTable(table, aggregator); err != nil { if err := toml.UnmarshalTable(table, aggregator); err != nil {
return err return err
} }
@ -736,7 +735,7 @@ func (c *Config) addProcessor(name string, table *ast.Table) error {
return err return err
} }
if err := config.UnmarshalTable(table, processor); err != nil { if err := toml.UnmarshalTable(table, processor); err != nil {
return err return err
} }
@ -776,7 +775,7 @@ func (c *Config) addOutput(name string, table *ast.Table) error {
return err return err
} }
if err := config.UnmarshalTable(table, output); err != nil { if err := toml.UnmarshalTable(table, output); err != nil {
return err return err
} }
@ -817,7 +816,7 @@ func (c *Config) addInput(name string, table *ast.Table) error {
return err return err
} }
if err := config.UnmarshalTable(table, input); err != nil { if err := toml.UnmarshalTable(table, input); err != nil {
return err return err
} }
@ -909,7 +908,7 @@ func buildAggregator(name string, tbl *ast.Table) (*models.AggregatorConfig, err
conf.Tags = make(map[string]string) conf.Tags = make(map[string]string)
if node, ok := tbl.Fields["tags"]; ok { if node, ok := tbl.Fields["tags"]; ok {
if subtbl, ok := node.(*ast.Table); ok { if subtbl, ok := node.(*ast.Table); ok {
if err := config.UnmarshalTable(subtbl, conf.Tags); err != nil { if err := toml.UnmarshalTable(subtbl, conf.Tags); err != nil {
log.Printf("Could not parse tags for input %s\n", name) log.Printf("Could not parse tags for input %s\n", name)
} }
} }
@ -1146,7 +1145,7 @@ func buildInput(name string, tbl *ast.Table) (*models.InputConfig, error) {
cp.Tags = make(map[string]string) cp.Tags = make(map[string]string)
if node, ok := tbl.Fields["tags"]; ok { if node, ok := tbl.Fields["tags"]; ok {
if subtbl, ok := node.(*ast.Table); ok { if subtbl, ok := node.(*ast.Table); ok {
if err := config.UnmarshalTable(subtbl, cp.Tags); err != nil { if err := toml.UnmarshalTable(subtbl, cp.Tags); err != nil {
log.Printf("E! Could not parse tags for input %s\n", name) log.Printf("E! Could not parse tags for input %s\n", name)
} }
} }