PUPPETDB SD: Validate HTTP config
Related-to #12810 Signed-off-by: Jayapriya Pai <janantha@redhat.com>
This commit is contained in:
parent
92f463a51d
commit
344f9d8d15
|
@ -1825,6 +1825,10 @@ var expectedErrors = []struct {
|
||||||
filename: "puppetdb_no_scheme.bad.yml",
|
filename: "puppetdb_no_scheme.bad.yml",
|
||||||
errMsg: "URL scheme must be 'http' or 'https'",
|
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",
|
filename: "hetzner_role.bad.yml",
|
||||||
errMsg: "unknown role",
|
errMsg: "unknown role",
|
||||||
|
|
|
@ -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 == "" {
|
if c.Query == "" {
|
||||||
return fmt.Errorf("query missing")
|
return fmt.Errorf("query missing")
|
||||||
}
|
}
|
||||||
return nil
|
return c.HTTPClientConfig.Validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discovery provides service discovery functionality based
|
// Discovery provides service discovery functionality based
|
||||||
|
|
Loading…
Reference in New Issue