Merge pull request #166 from mrunalp/image_no_nil
Make image APIs return empty struct instead of nil
This commit is contained in:
commit
5290ca593a
1 changed files with 8 additions and 3 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/image/directory"
|
"github.com/containers/image/directory"
|
||||||
"github.com/containers/image/image"
|
"github.com/containers/image/image"
|
||||||
"github.com/containers/image/transports"
|
"github.com/containers/image/transports"
|
||||||
|
@ -15,22 +16,25 @@ import (
|
||||||
|
|
||||||
// ListImages lists existing images.
|
// ListImages lists existing images.
|
||||||
func (s *Server) ListImages(ctx context.Context, req *pb.ListImagesRequest) (*pb.ListImagesResponse, error) {
|
func (s *Server) ListImages(ctx context.Context, req *pb.ListImagesRequest) (*pb.ListImagesResponse, error) {
|
||||||
|
logrus.Debugf("ListImages: %+v", req)
|
||||||
// TODO
|
// TODO
|
||||||
// containers/storage will take care of this by looking inside /var/lib/ocid/images
|
// containers/storage will take care of this by looking inside /var/lib/ocid/images
|
||||||
// and listing images.
|
// and listing images.
|
||||||
return nil, nil
|
return &pb.ListImagesResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageStatus returns the status of the image.
|
// ImageStatus returns the status of the image.
|
||||||
func (s *Server) ImageStatus(ctx context.Context, req *pb.ImageStatusRequest) (*pb.ImageStatusResponse, error) {
|
func (s *Server) ImageStatus(ctx context.Context, req *pb.ImageStatusRequest) (*pb.ImageStatusResponse, error) {
|
||||||
|
logrus.Debugf("ImageStatus: %+v", req)
|
||||||
// TODO
|
// TODO
|
||||||
// containers/storage will take care of this by looking inside /var/lib/ocid/images
|
// containers/storage will take care of this by looking inside /var/lib/ocid/images
|
||||||
// and getting the image status
|
// and getting the image status
|
||||||
return nil, nil
|
return &pb.ImageStatusResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PullImage pulls a image with authentication config.
|
// PullImage pulls a image with authentication config.
|
||||||
func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.PullImageResponse, error) {
|
func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.PullImageResponse, error) {
|
||||||
|
logrus.Debugf("PullImage: %+v", req)
|
||||||
img := req.GetImage().GetImage()
|
img := req.GetImage().GetImage()
|
||||||
if img == "" {
|
if img == "" {
|
||||||
return nil, errors.New("got empty imagespec name")
|
return nil, errors.New("got empty imagespec name")
|
||||||
|
@ -97,5 +101,6 @@ func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.P
|
||||||
|
|
||||||
// RemoveImage removes the image.
|
// RemoveImage removes the image.
|
||||||
func (s *Server) RemoveImage(ctx context.Context, req *pb.RemoveImageRequest) (*pb.RemoveImageResponse, error) {
|
func (s *Server) RemoveImage(ctx context.Context, req *pb.RemoveImageRequest) (*pb.RemoveImageResponse, error) {
|
||||||
return nil, nil
|
logrus.Debugf("RemoveImage: %+v", req)
|
||||||
|
return &pb.RemoveImageResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue