Merge pull request #12815 from slashpai/Uyuni

UYUNI SD: Validate HTTP config
This commit is contained in:
Julien Pivotto 2023-09-08 14:59:50 +02:00 committed by GitHub
commit a2208b2849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -1897,6 +1897,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) {