From 75d6dc75583a819731776917895dcd185b1f0b1c Mon Sep 17 00:00:00 2001 From: CuiHaozhi Date: Tue, 29 Aug 2017 10:51:59 -0400 Subject: [PATCH] crioctl images: should check input args. Signed-off-by: CuiHaozhi --- cmd/crioctl/image.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/crioctl/image.go b/cmd/crioctl/image.go index 426c67e9..2426d8fe 100644 --- a/cmd/crioctl/image.go +++ b/cmd/crioctl/image.go @@ -148,6 +148,9 @@ var removeImageCommand = cli.Command{ // PullImage sends a PullImageRequest to the server, and parses // the returned PullImageResponse. func PullImage(client pb.ImageServiceClient, image string) (*pb.PullImageResponse, error) { + if image == "" { + return nil, fmt.Errorf("an image name must be specified") + } return client.PullImage(context.Background(), &pb.PullImageRequest{Image: &pb.ImageSpec{Image: image}}) } @@ -160,6 +163,9 @@ func ListImages(client pb.ImageServiceClient, image string) (*pb.ListImagesRespo // ImageStatus sends an ImageStatusRequest to the server, and parses // the returned ImageStatusResponse. func ImageStatus(client pb.ImageServiceClient, image string) (*pb.ImageStatusResponse, error) { + if image == "" { + return nil, fmt.Errorf("ID cannot be empty") + } return client.ImageStatus(context.Background(), &pb.ImageStatusRequest{Image: &pb.ImageSpec{Image: image}}) }