Allow for empty MetaURL in UpdateSource
Currently, if an empty source is supplied, then the source's meta url will not be updated. Now, if the MetaURL is supplied and is different than the one that is currently on the source, the value will be updated. Even in the case of empty string meta urls.pull/10616/head
parent
eaecdce3b6
commit
8cfc6bbbae
|
@ -53,6 +53,9 @@ func newSourceResponse(src chronograf.Source) sourceResponse {
|
|||
},
|
||||
}
|
||||
|
||||
// MetaURL is currently a string, but eventually, we'd like to change it
|
||||
// to a slice. Checking len(src.MetaURL) is functionally equivalent to
|
||||
// checking if it is equal to the empty string.
|
||||
if src.Type == chronograf.InfluxEnterprise && len(src.MetaURL) != 0 {
|
||||
res.Links.Roles = fmt.Sprintf("%s/%d/roles", httpAPISrcs, src.ID)
|
||||
}
|
||||
|
@ -243,7 +246,9 @@ func (h *Service) UpdateSource(w http.ResponseWriter, r *http.Request) {
|
|||
if req.URL != "" {
|
||||
src.URL = req.URL
|
||||
}
|
||||
if req.MetaURL != "" {
|
||||
// If the supplied MetaURL is different from the
|
||||
// one supplied on the request, update the value
|
||||
if req.MetaURL != src.MetaURL {
|
||||
src.MetaURL = req.MetaURL
|
||||
}
|
||||
if req.Type != "" {
|
||||
|
|
Loading…
Reference in New Issue