From 96f1b6eceafdb74ac6b0e8a8f901798b183a47ea Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 9 Feb 2019 11:51:50 +0100 Subject: [PATCH] Always set (empty) UpdateStatus When deploying a service the `UpdateStatus.State` field is not present during `docker service create`. This complicates creating scripts that check for `UpdateStatus.State` to reach a certain state, as they have to take into account that the `UpdateStatus` as a whole is missing. This patch always sets the `UpdateStatus.State` to make it easier to consume. Signed-off-by: Sebastiaan van Stijn --- manager/controlapi/service.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manager/controlapi/service.go b/manager/controlapi/service.go index e4db20b17f..8aa8fc3d25 100644 --- a/manager/controlapi/service.go +++ b/manager/controlapi/service.go @@ -730,9 +730,10 @@ func (s *Server) CreateService(ctx context.Context, request *api.CreateServiceRe // TODO(aluzzardi): Consider using `Name` as a primary key to handle // duplicate creations. See #65 service := &api.Service{ - ID: identity.NewID(), - Spec: *request.Spec, - SpecVersion: &api.Version{}, + ID: identity.NewID(), + Spec: *request.Spec, + SpecVersion: &api.Version{}, + UpdateStatus: &api.UpdateStatus{}, } if isJobSpec(request.Spec) {