api: fix missing silence initialization

This commit is contained in:
Fabian Reinartz 2016-06-21 16:38:35 +02:00
parent 202235fb79
commit 1a93b01234
1 changed files with 4 additions and 3 deletions

7
api.go
View File

@ -283,14 +283,15 @@ func (api *API) insertAlerts(w http.ResponseWriter, r *http.Request, alerts ...*
}
func (api *API) addSilence(w http.ResponseWriter, r *http.Request) {
var sil types.Silence
if err := receive(r, &sil); err != nil {
var msil model.Silence
if err := receive(r, &msil); err != nil {
respondError(w, apiError{
typ: errorBadData,
err: err,
}, nil)
return
}
sil := types.NewSilence(&msil)
if sil.CreatedAt.IsZero() {
sil.CreatedAt = time.Now()
@ -304,7 +305,7 @@ func (api *API) addSilence(w http.ResponseWriter, r *http.Request) {
return
}
sid, err := api.silences.Set(&sil)
sid, err := api.silences.Set(sil)
if err != nil {
respondError(w, apiError{
typ: errorInternal,