From 4ecb32b907a3d7914c81fe5d7cd50585f2aec153 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 ab4fe38169..e36aaa7cff 100644 --- a/manager/controlapi/service.go +++ b/manager/controlapi/service.go @@ -655,9 +655,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 allocator.IsIngressNetworkNeeded(service) {