- Add path of service binary in ServiceParam type
authorjw_wonny.cha <jw_wonny.cha@samsung.com>
Tue, 26 Mar 2019 04:19:18 +0000 (13:19 +0900)
committerjw_wonny.cha <jw_wonny.cha@samsung.com>
Tue, 26 Mar 2019 04:19:18 +0000 (13:19 +0900)
- Add path information on binary

src/servicemgr/http_handler.go
src/servicemgr/service_agent.go
src/servicemgr/types.go

index b875f75..649b594 100644 (file)
@@ -26,7 +26,9 @@ func CreateServiceHandler(w http.ResponseWriter, req *http.Request) (servicePara
                return
        }
 
-       _, err = exec.LookPath(serviceParam.ServiceName)
+       binary := serviceParam.ServiceBinPath + serviceParam.ServiceName
+
+       _, err = exec.LookPath(binary)
        if err != nil {
                log.Println(err.Error())
                err = ErrInvalidService
index 2d966e7..9fd95df 100644 (file)
@@ -24,7 +24,7 @@ func Create(serviceParam ServiceParam) []byte {
        for index := 0; index < instanceCount; index++ {
                var cmd *exec.Cmd
 
-               id, _, _ := CreateServiceMap(cmd, serviceParam.ServiceName, serviceParam.AppName)
+               id, _, _ := CreateServiceMap(cmd, serviceParam.ServiceBinPath+serviceParam.ServiceName, serviceParam.AppName)
 
                serviceInfo := ServiceCreationResponseItem{id, makeTime()}
                ret.ServiceList[index] = serviceInfo
index f8ac65d..5edf2d5 100644 (file)
@@ -4,10 +4,10 @@ var logPrefix = "servicemgr"
 
 // ServiceParam structrue
 type ServiceParam struct {
-       AppName     string `json:"AppName"`
-       ServiceName string `json:"ServiceName"`
-       Count       int    `json:"Count"`
-       // IOType      bool
+       AppName        string `json:"AppName"`
+       ServiceName    string `json:"ServiceName"`
+       Count          int    `json:"Count"`
+       ServiceBinPath string `json:"ServiceBinPath`
 }
 
 // DistService structure