update message of ucloud import

This commit is contained in:
mingsheng.su 2019-10-21 11:26:02 +08:00 committed by Megan Marsh
parent 2c513fce64
commit 083d7896f4
2 changed files with 4 additions and 18 deletions

View File

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

View File

@ -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.