crioctl images: should check input args.

Signed-off-by: CuiHaozhi <cuihz@wise2c.com>
This commit is contained in:
CuiHaozhi 2017-08-29 10:51:59 -04:00
parent 62f275c784
commit 75d6dc7558

View file

@ -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}})
}