2016-11-22 22:05:37 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2016-10-18 14:48:33 +00:00
|
|
|
"fmt"
|
|
|
|
|
2016-11-22 22:05:37 +00:00
|
|
|
"github.com/Sirupsen/logrus"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RemoveImage removes the image.
|
|
|
|
func (s *Server) RemoveImage(ctx context.Context, req *pb.RemoveImageRequest) (*pb.RemoveImageResponse, error) {
|
2016-10-18 14:48:33 +00:00
|
|
|
logrus.Debugf("RemoveImageRequest: %+v", req)
|
|
|
|
image := ""
|
|
|
|
img := req.GetImage()
|
|
|
|
if img != nil {
|
2017-02-03 14:41:28 +00:00
|
|
|
image = img.Image
|
2016-10-18 14:48:33 +00:00
|
|
|
}
|
|
|
|
if image == "" {
|
|
|
|
return nil, fmt.Errorf("no image specified")
|
|
|
|
}
|
|
|
|
err := s.images.RemoveImage(s.imageContext, image)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
resp := &pb.RemoveImageResponse{}
|
|
|
|
logrus.Debugf("RemoveImageResponse: %+v", resp)
|
|
|
|
return resp, nil
|
2016-11-22 22:05:37 +00:00
|
|
|
}
|