mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 00:23:18 +00:00
UYUNI SD: Validate HTTP config
Related-to #12810 Signed-off-by: Jayapriya Pai <janantha@redhat.com>
This commit is contained in:
parent
92f463a51d
commit
34c8dcc73f
@ -1893,6 +1893,10 @@ var expectedErrors = []struct {
|
|||||||
filename: "uyuni_no_server.bad.yml",
|
filename: "uyuni_no_server.bad.yml",
|
||||||
errMsg: "Uyuni SD configuration requires server host",
|
errMsg: "Uyuni SD configuration requires server host",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
filename: "uyuni_token_file.bad.yml",
|
||||||
|
errMsg: "at most one of bearer_token & bearer_token_file must be configured",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
filename: "ionos_datacenter.bad.yml",
|
filename: "ionos_datacenter.bad.yml",
|
||||||
errMsg: "datacenter id can't be empty",
|
errMsg: "datacenter id can't be empty",
|
||||||
|
8
config/testdata/uyuni_token_file.bad.yml
vendored
Normal file
8
config/testdata/uyuni_token_file.bad.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
scrape_configs:
|
||||||
|
- job_name: uyuni
|
||||||
|
uyuni_sd_configs:
|
||||||
|
- server: "server"
|
||||||
|
username: "username"
|
||||||
|
password: "password"
|
||||||
|
bearer_token: foo
|
||||||
|
bearer_token_file: foo
|
@ -146,7 +146,7 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
if c.Password == "" {
|
if c.Password == "" {
|
||||||
return errors.New("Uyuni SD configuration requires a password")
|
return errors.New("Uyuni SD configuration requires a password")
|
||||||
}
|
}
|
||||||
return nil
|
return c.HTTPClientConfig.Validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
func login(rpcclient *xmlrpc.Client, user, pass string, duration int) (string, error) {
|
func login(rpcclient *xmlrpc.Client, user, pass string, duration int) (string, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user