Always send basic auth in jenkins input (#5329)
This commit is contained in:
parent
aabb60dfec
commit
d1610d50e6
|
@ -15,10 +15,10 @@ This plugin does not require a plugin on jenkins and it makes use of Jenkins API
|
|||
## Set response_timeout
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional SSL Config
|
||||
# ssl_ca = /path/to/cafile
|
||||
# ssl_cert = /path/to/certfile
|
||||
# ssl_key = /path/to/keyfile
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use SSL but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ func (c *client) init() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if c.username != "" && c.password != "" {
|
||||
// set auth
|
||||
if c.username != "" || c.password != "" {
|
||||
req.SetBasicAuth(c.username, c.password)
|
||||
}
|
||||
resp, err := c.httpClient.Do(req)
|
||||
|
@ -123,10 +122,11 @@ func createGetRequest(url string, username, password string, sessionCookie *http
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if username != "" || password != "" {
|
||||
req.SetBasicAuth(username, password)
|
||||
}
|
||||
if sessionCookie != nil {
|
||||
req.AddCookie(sessionCookie)
|
||||
} else if username != "" && password != "" {
|
||||
req.SetBasicAuth(username, password)
|
||||
}
|
||||
req.Header.Add("Accept", "application/json")
|
||||
return req, nil
|
||||
|
|
|
@ -51,10 +51,10 @@ const sampleConfig = `
|
|||
## Set response_timeout
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional SSL Config
|
||||
# ssl_ca = /path/to/cafile
|
||||
# ssl_cert = /path/to/certfile
|
||||
# ssl_key = /path/to/keyfile
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use SSL but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
|
||||
|
|
Loading…
Reference in New Issue