provider/openstack: Don't log the catalog (#13075)
The OS_DEBUG feature has worked out great, but frequent logging of the service catalog during client initialization can make logging very chatty. This commit omits the service catalog in the logs.
This commit is contained in:
parent
86d599cb3c
commit
89905368b9
|
@ -97,7 +97,9 @@ func (lrt *LogRoundTripper) logResponseBody(original io.ReadCloser, headers http
|
|||
return nil, err
|
||||
}
|
||||
debugInfo := lrt.formatJSON(bs.Bytes())
|
||||
log.Printf("[DEBUG] OpenStack Response Body: %s", debugInfo)
|
||||
if debugInfo != "" {
|
||||
log.Printf("[DEBUG] OpenStack Response Body: %s", debugInfo)
|
||||
}
|
||||
return ioutil.NopCloser(strings.NewReader(bs.String())), nil
|
||||
}
|
||||
|
||||
|
@ -127,6 +129,13 @@ func (lrt *LogRoundTripper) formatJSON(raw []byte) string {
|
|||
}
|
||||
}
|
||||
|
||||
// Ignore the catalog
|
||||
if v, ok := data["token"].(map[string]interface{}); ok {
|
||||
if _, ok := v["catalog"]; ok {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
pretty, err := json.MarshalIndent(data, "", " ")
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Unable to re-marshal OpenStack JSON: %s", err)
|
||||
|
|
Loading…
Reference in New Issue