Fix get charts API
Fixed the charts API to return the response in JSON format.
Signed-off-by: subhash kumar singh <subh.singh@samsung.com>
Change-Id: Ic9b41e40345db0fe8b4b50d61a4015cbb02d8368
diff --git a/pkg/charts/chart_manager.go b/pkg/charts/chart_manager.go
index c0308dd..6a3fc8e 100644
--- a/pkg/charts/chart_manager.go
+++ b/pkg/charts/chart_manager.go
@@ -34,7 +34,7 @@
}
type IChartMgr interface {
- GetCharts() (string, error)
+ GetCharts() (map[string]interface{}, error)
DownloadChart(string, string) (io.ReadCloser, error)
GetChartsByName(name string) ([]map[string]interface{}, error)
GetChartsByNameAndVersion(name, version string) (map[string]interface{}, error)
@@ -44,13 +44,13 @@
return &ChartMgr{}
}
-func (c *ChartMgr) GetCharts() (string, error) {
+func (c *ChartMgr) GetCharts() (map[string]interface{}, error) {
ricdms.Logger.Debug("GetCharts invoked")
resp, err := http.Get(ricdms.Config.GetChartsURL)
if err != nil {
ricdms.Logger.Debug("Error in getting charts : %+v", err)
- return "", err
+ return make(map[string]interface{}, 0), err
}
defer resp.Body.Close()
@@ -58,11 +58,14 @@
if err != nil {
ricdms.Logger.Debug("error in response: %+v", respByte)
- return "", err
+ return make(map[string]interface{}, 0), err
}
ricdms.Logger.Debug("response : %+v", string(respByte))
- return string(respByte), nil
+
+ v := make(map[string]interface{}, 0)
+ json.Unmarshal(respByte, &v)
+ return v, nil
}
func (c *ChartMgr) DownloadChart(chartName string, version string) (io.ReadCloser, error) {