summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjw_wonny.cha <jw_wonny.cha@samsung.com>2019-04-02 21:42:58 +0900
committerjw_wonny.cha <jw_wonny.cha@samsung.com>2019-04-02 21:42:58 +0900
commit64c1f5e16c900e8ef33e019c0a07cdc1e5143824 (patch)
tree193008eed065e580f638ebd7a3d60d10867cf5a6
parent0c5440268d6efb03753aa9bb697f8ae9a0b461ba (diff)
downloadedge-orchestration-EDGE-332.tar.gz
edge-orchestration-EDGE-332.tar.bz2
edge-orchestration-EDGE-332.zip
Clean up servicemgrEDGE-332
-rw-r--r--src/servicemgr/configure.go9
-rw-r--r--src/servicemgr/service_execution.go2
-rw-r--r--src/servicemgr/servicemgr.go8
3 files changed, 5 insertions, 14 deletions
diff --git a/src/servicemgr/configure.go b/src/servicemgr/configure.go
index cec8d52..d473759 100644
--- a/src/servicemgr/configure.go
+++ b/src/servicemgr/configure.go
@@ -36,20 +36,11 @@ const (
// ConstServiceNotFound is service status is not found
ConstServiceNotFound = "NotFound"
- // ConstWellknownPort is wellknonw port
- ConstWellknownPort = 56001
-
// ConstServiceExecuteURI is URI for creating & executing service
ConstServiceExecuteURI = "/api/v1/servicemgr/services"
// ConstServiceStatusNotiURI is URI for notification status of service
ConstServiceStatusNotiURI = "/api/v1/servicemgr/services/notification/"
-
- // ConstLocalTarget is for knowing local environments
- ConstLocalTarget = "localhost"
-
- // ConstPrefixHTTP is "http://"
- ConstPrefixHTTP = "http://"
)
var (
diff --git a/src/servicemgr/service_execution.go b/src/servicemgr/service_execution.go
index b300b0c..b0462d8 100644
--- a/src/servicemgr/service_execution.go
+++ b/src/servicemgr/service_execution.go
@@ -86,7 +86,7 @@ func (p Service) notifyServiceStatus(status string) (err error) {
reqbytes, _ := json.Marshal(statusNotificationRequest)
- if strings.Compare(p.notificationTargetURL, ConstLocalTarget) == 0 {
+ if strings.Compare(p.notificationTargetURL, httpclient.ConstLocalTarget) == 0 {
HandleNoti(statusNotificationRequest)
} else {
targetURL := p.notificationTargetURL + ConstServiceStatusNotiURI + strconv.FormatUint(p.serviceID, 10)
diff --git a/src/servicemgr/servicemgr.go b/src/servicemgr/servicemgr.go
index b068aea..f90e19d 100644
--- a/src/servicemgr/servicemgr.go
+++ b/src/servicemgr/servicemgr.go
@@ -29,11 +29,11 @@ func ExecuteApp(target string, name string, args []string, notiChan chan string)
}
appInfo[ConstKeyServiceName] = name
- if strings.Compare(target, getOutboundIP()) == 0 || strings.Compare(target, ConstLocalTarget) == 0 {
- appInfo[ConstKeyNotiTargetURL] = ConstLocalTarget
+ if strings.Compare(target, getOutboundIP()) == 0 || strings.Compare(target, httpclient.ConstLocalTarget) == 0 {
+ appInfo[ConstKeyNotiTargetURL] = httpclient.ConstLocalTarget
err = executeLocalEnv(appInfo)
} else {
- appInfo[ConstKeyNotiTargetURL] = ConstPrefixHTTP + target + ":" + strconv.Itoa(ConstWellknownPort)
+ appInfo[ConstKeyNotiTargetURL] = httpclient.ConstPrefixHTTP + target + ":" + strconv.Itoa(httpclient.ConstWellknownPort)
err = executeRemoteEnv(appInfo, target)
}
@@ -132,7 +132,7 @@ func executeLocalEnv(appInfo map[string]interface{}) (err error) {
func executeRemoteEnv(appInfo map[string]interface{}, target string) (err error) {
reqBytes, _ := json.Marshal(appInfo)
- executeTarget := target + ":" + strconv.Itoa(ConstWellknownPort) + ConstServiceExecuteURI
+ executeTarget := target + ":" + strconv.Itoa(httpclient.ConstWellknownPort) + ConstServiceExecuteURI
respBytes, err := httpclient.DoPost(executeTarget, reqBytes)