summaryrefslogtreecommitdiffstats
path: root/lib/xdsserver/apiv1-sdks.go
diff options
context:
space:
mode:
authorClément Bénier <clement.benier@iot.bzh>2018-10-01 11:51:47 +0200
committerClément Bénier <clement.benier@iot.bzh>2018-10-16 14:57:58 +0200
commit5e979f0ba451e64fc44ffaa8b79d714d9ad75a57 (patch)
tree6fb6ba51e034ba361fd833b482fb061d4f918da7 /lib/xdsserver/apiv1-sdks.go
parent4982769bd48b5c67c5eff4d9c6f297fa2a7531a4 (diff)
update xds-server package in docker
scripts/package-update: bash scripts to update xds-server package in docker monitor updates: default time is 24h, a update is tried at startup api/v1: 2 new requests: - get(updates): return various information about xds-server packages - post(updates): update xds-server packages Change-Id: I1673f7860e57cfe1d4abe5a24609ee46a90b67d8 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Diffstat (limited to 'lib/xdsserver/apiv1-sdks.go')
-rw-r--r--lib/xdsserver/apiv1-sdks.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/xdsserver/apiv1-sdks.go b/lib/xdsserver/apiv1-sdks.go
index 7bb9767..a943da5 100644
--- a/lib/xdsserver/apiv1-sdks.go
+++ b/lib/xdsserver/apiv1-sdks.go
@@ -74,8 +74,13 @@ func (s *APIService) installSdk(c *gin.Context) {
return
}
+ //increment lock xds counter: it will be decremented,
+ //when SDK is installed in file sdk.go in function ExitCB
+ //at line 308 or when install is aborted in following function
+ LockXdsUpdateCounter(s.Context, true)
sdk, err := s.sdks.Install(id, args.Filename, args.Force, args.Timeout, args.InstallArgs, sess)
if err != nil {
+ LockXdsUpdateCounter(s.Context, false)
common.APIError(c, err.Error())
return
}
@@ -103,6 +108,7 @@ func (s *APIService) abortInstallSdk(c *gin.Context) {
return
}
+ LockXdsUpdateCounter(s.Context, false)
c.JSON(http.StatusOK, sdk)
}
@@ -123,10 +129,12 @@ func (s *APIService) removeSdk(c *gin.Context) {
s.Log.Debugln("Remove SDK id ", id)
+ LockXdsUpdateCounter(s.Context, true)
delEntry, err := s.sdks.Remove(id, -1, sess)
if err != nil {
common.APIError(c, err.Error())
return
}
+ LockXdsUpdateCounter(s.Context, false)
c.JSON(http.StatusOK, delEntry)
}