mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Merge pull request #12814 from slashpai/puppetdb
PUPPETDB SD: Validate HTTP config
This commit is contained in:
commit
738e0dbaf0
|
@ -1829,6 +1829,10 @@ var expectedErrors = []struct {
|
|||
filename: "puppetdb_no_scheme.bad.yml",
|
||||
errMsg: "URL scheme must be 'http' or 'https'",
|
||||
},
|
||||
{
|
||||
filename: "puppetdb_token_file.bad.yml",
|
||||
errMsg: "at most one of bearer_token & bearer_token_file must be configured",
|
||||
},
|
||||
{
|
||||
filename: "hetzner_role.bad.yml",
|
||||
errMsg: "unknown role",
|
||||
|
|
7
config/testdata/puppetdb_token_file.bad.yml
vendored
Normal file
7
config/testdata/puppetdb_token_file.bad.yml
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
scrape_configs:
|
||||
- job_name: puppetdb
|
||||
puppetdb_sd_configs:
|
||||
- url: http://puppet
|
||||
query: 'resources { type = "Package" and title = "httpd" }'
|
||||
bearer_token: foo
|
||||
bearer_token_file: foo
|
|
@ -115,7 +115,7 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
if c.Query == "" {
|
||||
return fmt.Errorf("query missing")
|
||||
}
|
||||
return nil
|
||||
return c.HTTPClientConfig.Validate()
|
||||
}
|
||||
|
||||
// Discovery provides service discovery functionality based
|
||||
|
|
Loading…
Reference in a new issue