UYUNI SD: Validate HTTP config

Related-to #12810

Signed-off-by: Jayapriya Pai <janantha@redhat.com>
This commit is contained in:
Jayapriya Pai 2023-09-08 17:29:49 +05:30
parent 92f463a51d
commit 34c8dcc73f
No known key found for this signature in database
GPG Key ID: 5ED742D95C787611
3 changed files with 13 additions and 1 deletions

View File

@ -1893,6 +1893,10 @@ var expectedErrors = []struct {
filename: "uyuni_no_server.bad.yml",
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",
errMsg: "datacenter id can't be empty",

View 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

View File

@ -146,7 +146,7 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
if c.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) {