From 0b65031e909462d2c7cd16d93d9ab0e2a825534c Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Thu, 16 Mar 2017 14:16:29 -0700 Subject: [PATCH] services/rootfs: return grpc code on existence Signed-off-by: Stephen J Day --- services/rootfs/service.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/rootfs/service.go b/services/rootfs/service.go index 21c98ca..b82a1fc 100644 --- a/services/rootfs/service.go +++ b/services/rootfs/service.go @@ -15,6 +15,7 @@ import ( ocispec "github.com/opencontainers/image-spec/specs-go/v1" "golang.org/x/net/context" "google.golang.org/grpc" + "google.golang.org/grpc/codes" ) func init() { @@ -67,7 +68,7 @@ func (s *Service) Unpack(ctx context.Context, pr *rootfsapi.UnpackRequest) (*roo func (s *Service) Prepare(ctx context.Context, ir *rootfsapi.PrepareRequest) (*rootfsapi.MountResponse, error) { mounts, err := rootfs.InitRootFS(ctx, ir.Name, ir.ChainID, ir.Readonly, s.snapshotter, mounter{}) if err != nil { - return nil, err + return nil, grpc.Errorf(codes.AlreadyExists, "%v", err) } return &rootfsapi.MountResponse{ Mounts: apiMounts(mounts),