- applied changed function EDGE-331
authorjw_wonny.cha <jw_wonny.cha@samsung.com>
Tue, 2 Apr 2019 09:40:49 +0000 (18:40 +0900)
committerjw_wonny.cha <jw_wonny.cha@samsung.com>
Tue, 2 Apr 2019 09:40:49 +0000 (18:40 +0900)
src/servicemgr/service_execution.go
src/servicemgr/servicemgr.go

index b0a6e24..300fe74 100644 (file)
@@ -5,6 +5,7 @@ import (
        "log"
        "os"
        "os/exec"
+       "restapi/httpclient"
        "strconv"
        "strings"
 )
@@ -89,7 +90,7 @@ func (p Service) notifyServiceStatus(status string) (err error) {
 
        } else {
                targetURL := p.notificationTargetURL + ConstServiceStatusNotiURI + strconv.FormatUint(p.serviceID, 10)
-               _, err = sendPostJSONMsg(targetURL, reqbytes)
+               _, err = httpclient.DoPost(targetURL, reqbytes)
                if err != nil {
                        log.Println(err.Error())
                }
index 42fc12a..b068aea 100644 (file)
@@ -7,6 +7,7 @@ import (
        "log"
        "net"
        "os/exec"
+       "restapi/httpclient"
        "strconv"
        "strings"
 )
@@ -133,12 +134,20 @@ func executeRemoteEnv(appInfo map[string]interface{}, target string) (err error)
        reqBytes, _ := json.Marshal(appInfo)
        executeTarget := target + ":" + strconv.Itoa(ConstWellknownPort) + ConstServiceExecuteURI
 
-       str, err := sendPostJSONMsg(executeTarget, reqBytes)
+       respBytes, err := httpclient.DoPost(executeTarget, reqBytes)
 
-       if err == nil {
-               if str == ConstServiceStatusFailed {
-                       err = errors.New("Failed")
-               }
+       var responseMsg map[string]interface{}
+
+       err = json.Unmarshal(respBytes, &responseMsg)
+       if err != nil {
+               return
+       }
+
+       log.Println("[JSON] : ", responseMsg)
+
+       str := responseMsg[ConstKeyStatus].(string)
+       if str == ConstServiceStatusFailed {
+               err = errors.New(ConstServiceStatusFailed)
        }
 
        return