From 083d7896f4d68bbd3e0229dbe40665dfd65858e5 Mon Sep 17 00:00:00 2001 From: "mingsheng.su" Date: Mon, 21 Oct 2019 11:26:02 +0800 Subject: [PATCH] update message of ucloud import --- post-processor/ucloud-import/post-processor.go | 16 +--------------- .../docs/post-processors/ucloud-import.html.md | 6 +++--- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/post-processor/ucloud-import/post-processor.go b/post-processor/ucloud-import/post-processor.go index c65d0dfb0..a5a2e73cd 100644 --- a/post-processor/ucloud-import/post-processor.go +++ b/post-processor/ucloud-import/post-processor.go @@ -24,13 +24,6 @@ const ( VHDFileFormat = "vhd" VMDKFileFormat = "vmdk" QCOW2FileFormat = "qcow2" - - CentOSOsType = "CentOS" - UbuntuOsType = "Ubuntu" - WindowsOsType = "Windows" - RedHatOsType = "RedHat" - DebianOsType = "Debian" - OtherOsType = "Other" ) var regionForFileMap = ucloudcommon.NewStringConverter(map[string]string{ @@ -123,13 +116,6 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { errs = packer.MultiErrorAppend(errs, fmt.Errorf("expected %q to be 1-63 characters and only support chinese, english, numbers, '-_,.:[]', got %q", "image_name", imageName)) } - switch p.config.OSType { - case CentOSOsType, UbuntuOsType, WindowsOsType, RedHatOsType, DebianOsType, OtherOsType: - default: - errs = packer.MultiErrorAppend( - errs, fmt.Errorf("expected %q only be one of 'CentOS', 'Ubuntu', 'Windows', 'RedHat', 'Debian' or 'Other', got %q", "image_os_type", p.config.OSType)) - } - switch p.config.Format { case VHDFileFormat, RAWFileFormat, VMDKFileFormat, QCOW2FileFormat: default: @@ -207,7 +193,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact return nil, false, false, fmt.Errorf("Failed to Upload image file, %s", err) } - ui.Say(fmt.Sprintf("Image file %s has been uploaded to UFile %s", source, ufileUrl)) + ui.Say(fmt.Sprintf("Image file %s has been uploaded to UFile %s/%s", source, bucketUrl, p.config.UFileKey)) importImageRequest := p.buildImportImageRequest(uhostconn, ufileUrl) importImageResponse, err := uhostconn.ImportCustomImage(importImageRequest) diff --git a/website/source/docs/post-processors/ucloud-import.html.md b/website/source/docs/post-processors/ucloud-import.html.md index 5671cf561..08b8c7b2c 100644 --- a/website/source/docs/post-processors/ucloud-import.html.md +++ b/website/source/docs/post-processors/ucloud-import.html.md @@ -39,14 +39,14 @@ are two categories: required and optional parameters. - `image_os_name` (string) - The name of OS. Such as: `CentOS 7.2 64位`, set `Other` When `image_os_type` is `Other`. -- `format` (string) - The format of the import image , Possible values are: `RAW`, `VHD`, `VMDK`, or `qcow2`. +- `format` (string) - The format of the import image , Possible values are: `raw`, `vhd`, `vmdk`, or `qcow2`. ### Optional: -- `ufile_key_name` (string) - The name of the object key in `ufile_bucket_name` where the RAW, VHD, VMDK, or qcow2 file will be copied to for import. +- `ufile_key_name` (string) - The name of the object key in `ufile_bucket_name` where the RAW, VHD, VMDK, or qcow2 file will be copied to import. -- `skip_clean` (boolean) - Whether we should skip removing the RAW or VHD file uploaded to UFile after the import process has completed. Possible values are: `true` as leave it in the UFile bucket, `false` as clean it out.(Default: `false`). +- `skip_clean` (boolean) - Whether we should skip removing the RAW, VHD, VMDK, or qcow2 file uploaded to UFile after the import process has completed. Possible values are: `true` as leave it in the UFile bucket, `false` as clean it out.(Default: `false`). - `image_description` (string) - The description of the image.