SEBA-902 mock testing of redfish importer;
Remove hardcoded addresses and replace with config file / cmdline;
Support hostnames in importer as alternative to ip addresses;
Treat response 204 as success
Change-Id: I17e8e585e388c501c02867ce952bbe1fa9b09668
diff --git a/event_subscriber.go b/event_subscriber.go
index a6740b4..160b599 100644
--- a/event_subscriber.go
+++ b/event_subscriber.go
@@ -19,6 +19,7 @@
"encoding/json"
"fmt"
logrus "github.com/sirupsen/logrus"
+ "io"
"io/ioutil"
"net/http"
"os"
@@ -52,11 +53,11 @@
return
}
- if resp.StatusCode != 201 {
+ if resp.StatusCode != 201 && resp.StatusCode != 204 {
result := make(map[string]interface{})
dec := json.NewDecoder(resp.Body)
- if err := dec.Decode(&result); err != nil {
- logrus.Errorf("ERROR while adding event subscription:%s " + err.Error())
+ if err := dec.Decode(&result); err != nil && err != io.EOF {
+ logrus.Errorf("ERROR while adding event subscription:%s ", err.Error())
return
}
logrus.Infof("Result Decode %s", result)