From 7360474a376cc0f9d9755c8c1540fac8ff9b2596 Mon Sep 17 00:00:00 2001 From: barnettZQG Date: Fri, 1 Jun 2018 10:51:05 +0800 Subject: [PATCH] [REV] update delete plugin,change monitor build --- api/handler/service.go | 5 +++-- api/handler/share/plugin_share.go | 2 +- api/handler/share/service_share.go | 2 +- hack/contrib/docker/monitor/Dockerfile | 7 ++++--- release.sh | 2 ++ 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/api/handler/service.go b/api/handler/service.go index dd2b2ca2c..4d8fe699d 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -1494,11 +1494,12 @@ func (s *ServiceAction) VolumnVar(tsv *dbmodel.TenantServiceVolume, tenantID, ac } case "delete": if tsv.VolumeName != "" { - if err := db.GetManager().TenantServiceVolumeDao().DeleteModel(tsv.ServiceID, tsv.VolumeName); err != nil { + err := db.GetManager().TenantServiceVolumeDao().DeleteModel(tsv.ServiceID, tsv.VolumeName) + if err != nil && err.Error() != gorm.ErrRecordNotFound.Error() { return util.CreateAPIHandleErrorFromDBError("delete volume", err) } } else { - if err := db.GetManager().TenantServiceVolumeDao().DeleteByServiceIDAndVolumePath(tsv.ServiceID, tsv.VolumePath); err != nil { + if err := db.GetManager().TenantServiceVolumeDao().DeleteByServiceIDAndVolumePath(tsv.ServiceID, tsv.VolumePath); err != nil && err.Error() != gorm.ErrRecordNotFound.Error() { return util.CreateAPIHandleErrorFromDBError("delete volume", err) } } diff --git a/api/handler/share/plugin_share.go b/api/handler/share/plugin_share.go index 701dd18e2..c2bacbe14 100644 --- a/api/handler/share/plugin_share.go +++ b/api/handler/share/plugin_share.go @@ -123,7 +123,7 @@ func (s *PluginShareHandle) ShareResult(shareID string) (i exector.ShareStatus, e = util.CreateAPIHandleError(500, err) } else { if res.Count == 0 { - i.ShareID = "shareID" + i.ShareID = shareID } else { if err := ffjson.Unmarshal(res.Kvs[0].Value, &i); err != nil { return i, util.CreateAPIHandleError(500, err) diff --git a/api/handler/share/service_share.go b/api/handler/share/service_share.go index 7184a2003..8e949d02a 100644 --- a/api/handler/share/service_share.go +++ b/api/handler/share/service_share.go @@ -133,7 +133,7 @@ func (s *ServiceShareHandle) ShareResult(shareID string) (i exector.ShareStatus, e = util.CreateAPIHandleError(500, err) } else { if res.Count == 0 { - i.ShareID = "shareID" + i.ShareID = shareID } else { if err := ffjson.Unmarshal(res.Kvs[0].Value, &i); err != nil { return i, util.CreateAPIHandleError(500, err) diff --git a/hack/contrib/docker/monitor/Dockerfile b/hack/contrib/docker/monitor/Dockerfile index ab97dbd80..58652ba33 100644 --- a/hack/contrib/docker/monitor/Dockerfile +++ b/hack/contrib/docker/monitor/Dockerfile @@ -1,9 +1,10 @@ -FROM prom/prometheus +FROM prom/prometheus:v2.2.1 VOLUME ["/prometheusdata"] ENV RELEASE_DESC=__RELEASE_DESC__ -ADD /rainbond-monitor /usr/bin/monitor +ADD rainbond-monitor /run/monitor -ENTRYPOINT /usr/bin/monitor \ No newline at end of file +ENTRYPOINT [""] +CMD [ "/run/monitor" ] \ No newline at end of file diff --git a/release.sh b/release.sh index 9840b9cef..c2bd1b4f4 100755 --- a/release.sh +++ b/release.sh @@ -56,6 +56,8 @@ function build::image() { docker run --rm -v `pwd`:${WORK_DIR} -w ${WORK_DIR} goodraim.me/event-build:v1 go build -ldflags '-w -s' -o ${DOCKER_PATH}/${BASE_NAME}-$1 ./cmd/eventlog elif [ "$1" = "chaos" ];then docker run --rm -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build -ldflags '-w -s' -o ${DOCKER_PATH}/${BASE_NAME}-$1 ./cmd/builder + elif [ "$1" = "monitor" ];then + GOOS=linux go build -ldflags '-w -s' -o ${DOCKER_PATH}/${BASE_NAME}-$1 ./cmd/builder else docker run --rm -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build -ldflags '-w -s' -o ${DOCKER_PATH}/${BASE_NAME}-$1 ./cmd/$1 fi