spelling and grammar fixes

This commit is contained in:
Matthew Hooker 2017-05-25 18:49:35 -07:00
parent 66bd707f7c
commit e72163264b
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
15 changed files with 75 additions and 63 deletions

View File

@ -2,10 +2,11 @@ package ecs
import (
"fmt"
"os"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/template/interpolate"
"os"
)
// Config of alicloud
@ -56,8 +57,7 @@ func (c *AlicloudAccessConfig) Config() error {
c.AlicloudSecretKey = os.Getenv("ALICLOUD_SECRET_KEY")
}
if c.AlicloudAccessKey == "" || c.AlicloudSecretKey == "" {
return fmt.Errorf("ALICLOUD_ACCESS_KEY and ALICLOUD_SECRET_KEY must set in template file " +
"or environment variables")
return fmt.Errorf("ALICLOUD_ACCESS_KEY and ALICLOUD_SECRET_KEY must be set in template file or environment variables.")
}
return nil

View File

@ -3,13 +3,14 @@
package ecs
import (
"log"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate"
"github.com/mitchellh/multistep"
"log"
)
// The unique ID for this builder

View File

@ -13,7 +13,7 @@ func message(state multistep.StateBag, module string) {
ui := state.Get("ui").(packer.Ui)
if cancelled || halted {
ui.Say(fmt.Sprintf("Delete the %s because cancelation or error...", module))
ui.Say(fmt.Sprintf("Delete the %s because cancellation or error...", module))
} else {
ui.Say(fmt.Sprintf("Clean the created %s", module))
}

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
@ -19,36 +20,36 @@ func (s *setpConfigAlicloudEIP) Run(state multistep.StateBag) multistep.StepActi
client := state.Get("client").(*ecs.Client)
ui := state.Get("ui").(packer.Ui)
instance := state.Get("instance").(*ecs.InstanceAttributesType)
ui.Say("Start allocated alicloud eip")
ui.Say("Allocating eip")
ipaddress, allocateId, err := client.AllocateEipAddress(&ecs.AllocateEipAddressArgs{
RegionId: common.Region(s.RegionId), InternetChargeType: common.InternetChargeType(s.InternetChargeType),
})
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Error allocate eip: %s", err))
ui.Say(fmt.Sprintf("Error allocating eip: %s", err))
return multistep.ActionHalt
}
s.allocatedId = allocateId
if err = client.WaitForEip(common.Region(s.RegionId), allocateId,
ecs.EipStatusAvailable, ALICLOUD_DEFAULT_SHORT_TIMEOUT); err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Error allocate alicloud eip: %s", err))
ui.Say(fmt.Sprintf("Error allocating eip: %s", err))
return multistep.ActionHalt
}
if err = client.AssociateEipAddress(allocateId, instance.InstanceId); err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Error binding alicloud eip: %s", err))
ui.Say(fmt.Sprintf("Error binding eip: %s", err))
return multistep.ActionHalt
}
if err = client.WaitForEip(common.Region(s.RegionId), allocateId,
ecs.EipStatusInUse, ALICLOUD_DEFAULT_SHORT_TIMEOUT); err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Error associating alicloud eip: %s", err))
ui.Say(fmt.Sprintf("Error associating eip: %s", err))
return multistep.ActionHalt
}
ui.Say(fmt.Sprintf("Allocated alicloud eip %s", ipaddress))
ui.Say(fmt.Sprintf("Allocated eip %s", ipaddress))
state.Put("ipaddress", ipaddress)
return multistep.ActionContinue
}
@ -65,15 +66,14 @@ func (s *setpConfigAlicloudEIP) Cleanup(state multistep.StateBag) {
message(state, "EIP")
if err := client.UnassociateEipAddress(s.allocatedId, instance.InstanceId); err != nil {
ui.Say(fmt.Sprintf("Unassociate alicloud eip failed "))
ui.Say(fmt.Sprintf("Unassociating eip failed."))
}
if err := client.WaitForEip(common.Region(s.RegionId), s.allocatedId,
ecs.EipStatusAvailable, ALICLOUD_DEFAULT_SHORT_TIMEOUT); err != nil {
ui.Say(fmt.Sprintf("Unassociate alicloud eip timeout "))
if err := client.WaitForEip(common.Region(s.RegionId), s.allocatedId, ecs.EipStatusAvailable, ALICLOUD_DEFAULT_SHORT_TIMEOUT); err != nil {
ui.Say(fmt.Sprintf("Timeout while unassociating eip."))
}
if err := client.ReleaseEipAddress(s.allocatedId); err != nil {
ui.Say(fmt.Sprintf("Release alicloud eip failed "))
ui.Say(fmt.Sprintf("Releasing eip failed."))
}
}

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
@ -20,7 +21,7 @@ func (s *stepConfigAlicloudPublicIP) Run(state multistep.StateBag) multistep.Ste
ipaddress, err := client.AllocatePublicIpAddress(instance.InstanceId)
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Error allocate public ip: %s", err))
ui.Say(fmt.Sprintf("Error allocating public ip: %s", err))
return multistep.ActionHalt
}
s.publicIPAdress = ipaddress

View File

@ -3,11 +3,12 @@ package ecs
import (
"errors"
"fmt"
"time"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
"time"
)
type stepConfigAlicloudSecurityGroup struct {
@ -40,7 +41,7 @@ func (s *stepConfigAlicloudSecurityGroup) Run(state multistep.StateBag) multiste
}
if err != nil {
ui.Say(fmt.Sprintf("Query alicloud security grouip failed: %s", err))
ui.Say(fmt.Sprintf("Failed querying security group: %s", err))
state.Put("error", err)
return multistep.ActionHalt
}
@ -52,7 +53,7 @@ func (s *stepConfigAlicloudSecurityGroup) Run(state multistep.StateBag) multiste
}
}
s.isCreate = false
message := fmt.Sprintf("The specific security group {%s} isn't exist.", s.SecurityGroupId)
message := fmt.Sprintf("The specified security group {%s} doesn't exist.", s.SecurityGroupId)
state.Put("error", errors.New(message))
ui.Say(message)
return multistep.ActionHalt
@ -75,7 +76,7 @@ func (s *stepConfigAlicloudSecurityGroup) Run(state multistep.StateBag) multiste
}
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Create security group failed %v", err))
ui.Say(fmt.Sprintf("Create security group failed %s", err))
return multistep.ActionHalt
}
state.Put("securitygroupid", securityGroupId)
@ -91,7 +92,7 @@ func (s *stepConfigAlicloudSecurityGroup) Run(state multistep.StateBag) multiste
})
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("authorzie security group failed %v", err))
ui.Say(fmt.Sprintf("Failed authorizing security group: %s", err))
return multistep.ActionHalt
}
err = client.AuthorizeSecurityGroup(&ecs.AuthorizeSecurityGroupArgs{
@ -104,7 +105,7 @@ func (s *stepConfigAlicloudSecurityGroup) Run(state multistep.StateBag) multiste
})
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("authorzie security group failed %v", err))
ui.Say(fmt.Sprintf("Failed authorizing security group: %s", err))
return multistep.ActionHalt
}
@ -128,7 +129,7 @@ func (s *stepConfigAlicloudSecurityGroup) Cleanup(state multistep.StateBag) {
time.Sleep(1 * time.Second)
continue
}
ui.Error(fmt.Sprintf("Error delete security group failed, may still be around: %s", err))
ui.Error(fmt.Sprintf("Failed to delete security group, it may still be around: %s", err))
return
}
break

View File

@ -3,11 +3,12 @@ package ecs
import (
"errors"
"fmt"
"time"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
"time"
)
type stepConfigAlicloudVPC struct {
@ -28,7 +29,7 @@ func (s *stepConfigAlicloudVPC) Run(state multistep.StateBag) multistep.StepActi
RegionId: common.Region(config.AlicloudRegion),
})
if err != nil {
ui.Say(fmt.Sprintf("Query vpcs failed: %s", err))
ui.Say(fmt.Sprintf("Failed querying vpcs: %s", err))
state.Put("error", err)
return multistep.ActionHalt
}
@ -38,13 +39,13 @@ func (s *stepConfigAlicloudVPC) Run(state multistep.StateBag) multistep.StepActi
s.isCreate = false
return multistep.ActionContinue
}
message := fmt.Sprintf("The specific vpc {%s} isn't exist.", s.VpcId)
message := fmt.Sprintf("The specified vpc {%s} doesn't exist.", s.VpcId)
state.Put("error", errors.New(message))
ui.Say(message)
return multistep.ActionHalt
}
ui.Say("Start creating alicloud vpc")
ui.Say("Start create vpc")
vpc, err := client.CreateVpc(&ecs.CreateVpcArgs{
RegionId: common.Region(config.AlicloudRegion),
CidrBlock: s.CidrBlock,
@ -52,13 +53,13 @@ func (s *stepConfigAlicloudVPC) Run(state multistep.StateBag) multistep.StepActi
})
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Create vps failed %v", err))
ui.Say(fmt.Sprintf("Create vpc failed %s", err))
return multistep.ActionHalt
}
err = client.WaitForVpcAvailable(common.Region(config.AlicloudRegion), vpc.VpcId, ALICLOUD_DEFAULT_SHORT_TIMEOUT)
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Waiting vps avabalibe failed %v", err))
ui.Say(fmt.Sprintf("Failed waiting for vpc to become available %s", err))
return multistep.ActionHalt
}
@ -87,7 +88,7 @@ func (s *stepConfigAlicloudVPC) Cleanup(state multistep.StateBag) {
time.Sleep(1 * time.Second)
continue
}
ui.Error(fmt.Sprintf("Error delete vpc, may still be around: %s", err))
ui.Error(fmt.Sprintf("Error deleting vpc, it may still be around: %s", err))
return
}
break

View File

@ -3,11 +3,12 @@ package ecs
import (
"errors"
"fmt"
"time"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
"time"
)
type stepConfigAlicloudVSwitch struct {
@ -31,7 +32,7 @@ func (s *stepConfigAlicloudVSwitch) Run(state multistep.StateBag) multistep.Step
ZoneId: s.ZoneId,
})
if err != nil {
ui.Say(fmt.Sprintf("Query vswitch failed: %s", err))
ui.Say(fmt.Sprintf("Failed querying vswitch: %s", err))
state.Put("error", err)
return multistep.ActionHalt
}
@ -42,7 +43,7 @@ func (s *stepConfigAlicloudVSwitch) Run(state multistep.StateBag) multistep.Step
return multistep.ActionContinue
}
s.isCreate = false
message := fmt.Sprintf("The specific vswitch {%s} doesn't exist.", s.VSwitchId)
message := fmt.Sprintf("The specified vswitch {%s} doesn't exist.", s.VSwitchId)
state.Put("error", errors.New(message))
ui.Say(message)
return multistep.ActionHalt
@ -139,7 +140,7 @@ func (s *stepConfigAlicloudVSwitch) Cleanup(state multistep.StateBag) {
time.Sleep(1 * time.Second)
continue
}
ui.Error(fmt.Sprintf("Error delete vswitch, may still be around: %s", err))
ui.Error(fmt.Sprintf("Error deleting vswitch, it may still be around: %s", err))
return
}
break

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
@ -18,7 +19,7 @@ func (s *stepCreateAlicloudImage) Run(state multistep.StateBag) multistep.StepAc
ui := state.Get("ui").(packer.Ui)
// Create the alicloud image
ui.Say(fmt.Sprintf("Creating alicloud images: %s", config.AlicloudImageName))
ui.Say(fmt.Sprintf("Creating image: %s", config.AlicloudImageName))
var imageId string
var err error
@ -31,7 +32,7 @@ func (s *stepCreateAlicloudImage) Run(state multistep.StateBag) multistep.StepAc
Description: config.AlicloudImageDescription})
if err != nil {
err := fmt.Errorf("Error creating alicloud images: %s", err)
err := fmt.Errorf("Error creating image: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -39,7 +40,7 @@ func (s *stepCreateAlicloudImage) Run(state multistep.StateBag) multistep.StepAc
err = client.WaitForImageReady(common.Region(config.AlicloudRegion),
imageId, ALICLOUD_DEFAULT_LONG_TIMEOUT)
if err != nil {
err := fmt.Errorf("Waiting alicloud image creating timeout: %s", err)
err := fmt.Errorf("Timeout waiting for image to be created: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -49,14 +50,14 @@ func (s *stepCreateAlicloudImage) Run(state multistep.StateBag) multistep.StepAc
RegionId: common.Region(config.AlicloudRegion),
ImageId: imageId})
if err != nil {
err := fmt.Errorf("Query created alicloud image failed: %s", err)
err := fmt.Errorf("Error querying created image: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
if len(images) == 0 {
err := fmt.Errorf("Query created alicloud image failed: %s", err)
err := fmt.Errorf("Unable to find created image: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -85,9 +86,9 @@ func (s *stepCreateAlicloudImage) Cleanup(state multistep.StateBag) {
ui := state.Get("ui").(packer.Ui)
config := state.Get("config").(Config)
ui.Say("Delete the alicloud image because cancelation or error...")
ui.Say("Deleting the image because of cancellation or error...")
if err := client.DeleteImage(common.Region(config.AlicloudRegion), s.image.ImageId); err != nil {
ui.Error(fmt.Sprintf("Error delete alicloud image, may still be around: %s", err))
ui.Error(fmt.Sprintf("Error deleting image, it may still be around: %s", err))
return
}
}

View File

@ -2,12 +2,13 @@ package ecs
import (
"fmt"
"io/ioutil"
"log"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
"io/ioutil"
"log"
)
type stepCreateAlicloudInstance struct {
@ -67,7 +68,7 @@ func (s *stepCreateAlicloudInstance) Run(state multistep.StateBag) multistep.Ste
DataDisk: diskDeviceToDiskType(config.AlicloudImageConfig.ECSImagesDiskMappings),
})
if err != nil {
err := fmt.Errorf("Error create alicloud instance: %s", err)
err := fmt.Errorf("Error creating instance: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -93,7 +94,7 @@ func (s *stepCreateAlicloudInstance) Run(state multistep.StateBag) multistep.Ste
DataDisk: diskDeviceToDiskType(config.AlicloudImageConfig.ECSImagesDiskMappings),
})
if err != nil {
err := fmt.Errorf("Error create instance: %s", err)
err := fmt.Errorf("Error creating instance: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -108,7 +109,7 @@ func (s *stepCreateAlicloudInstance) Run(state multistep.StateBag) multistep.Ste
}
instance, err := client.DescribeInstanceAttribute(instanceId)
if err != nil {
ui.Say(fmt.Sprint(err))
ui.Say(err.Error())
return multistep.ActionHalt
}
s.instance = instance
@ -126,7 +127,7 @@ func (s *stepCreateAlicloudInstance) Cleanup(state multistep.StateBag) {
ui := state.Get("ui").(packer.Ui)
err := client.DeleteInstance(s.instance.InstanceId)
if err != nil {
ui.Say(fmt.Sprintf("Cleaning instance: %s failed ", s.instance.InstanceId))
ui.Say(fmt.Sprintf("Cleaning instance %s failed ", s.instance.InstanceId))
}
}

View File

@ -2,11 +2,12 @@ package ecs
import (
"fmt"
"log"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
"log"
)
type stepDeleteAlicloudImageSnapshots struct {
@ -36,7 +37,7 @@ func (s *stepDeleteAlicloudImageSnapshots) Run(state multistep.StateBag) multist
}
err = client.DeleteImage(common.Region(config.AlicloudRegion), image.ImageId)
if err != nil {
err := fmt.Errorf("Delete alicloud image failed: %s", err)
err := fmt.Errorf("Failed to delete image: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
@ -23,7 +24,7 @@ func (s *stepMountAlicloudDisk) Run(state multistep.StateBag) multistep.StepActi
disks, _, err := client.DescribeDisks(&ecs.DescribeDisksArgs{InstanceId: instance.InstanceId,
RegionId: instance.RegionId})
if err != nil {
err := fmt.Errorf("Error query alicloud disks failed: %s", err)
err := fmt.Errorf("Error querying disks: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -34,7 +35,7 @@ func (s *stepMountAlicloudDisk) Run(state multistep.StateBag) multistep.StepActi
InstanceId: instance.InstanceId,
Device: getDevice(&disk, alicloudDiskDevices),
}); err != nil {
err := fmt.Errorf("Error mount alicloud disks failed: %s", err)
err := fmt.Errorf("Error mounting disks: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -43,13 +44,13 @@ func (s *stepMountAlicloudDisk) Run(state multistep.StateBag) multistep.StepActi
}
for _, disk := range disks {
if err := client.WaitForDisk(instance.RegionId, disk.DiskId, ecs.DiskStatusInUse, ALICLOUD_DEFAULT_SHORT_TIMEOUT); err != nil {
err := fmt.Errorf("Timeout waiting for mount of alicloud disk: %s", err)
err := fmt.Errorf("Timeout waiting for mount: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
}
ui.Say("Finish mounting disks")
ui.Say("Finished mounting disks")
return multistep.ActionContinue
}

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
@ -42,7 +43,7 @@ func (s *setpRegionCopyAlicloudImage) Run(state multistep.StateBag) multistep.St
})
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Error copy alicloud images: %s", err))
ui.Say(fmt.Sprintf("Error copying images: %s", err))
return multistep.ActionHalt
}
alicloudImages[destinationRegion] = imageId
@ -57,7 +58,7 @@ func (s *setpRegionCopyAlicloudImage) Cleanup(state multistep.StateBag) {
ui := state.Get("ui").(packer.Ui)
client := state.Get("client").(*ecs.Client)
alicloudImages := state.Get("alicloudimages").(map[string]string)
ui.Say(fmt.Sprintf("Cancel copy image because cancelation or error..."))
ui.Say(fmt.Sprintf("Cancel copy image because cancellation or error..."))
for copyedRegionId, copyedImageId := range alicloudImages {
if copyedRegionId == s.RegionId {
continue

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
"github.com/mitchellh/multistep"
@ -17,7 +18,7 @@ func (s *stepRunAlicloudInstance) Run(state multistep.StateBag) multistep.StepAc
err := client.StartInstance(instance.InstanceId)
if err != nil {
err := fmt.Errorf("Error start alicloud instance: %s", err)
err := fmt.Errorf("Error starting instance: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -25,7 +26,7 @@ func (s *stepRunAlicloudInstance) Run(state multistep.StateBag) multistep.StepAc
ui.Say("Alcoud instance starting")
err = client.WaitForInstance(instance.InstanceId, ecs.Running, ALICLOUD_DEFAULT_TIMEOUT)
if err != nil {
err := fmt.Errorf("Starting alicloud instance timeout: %s", err)
err := fmt.Errorf("Timeout waiting for instance to start: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
@ -44,11 +45,11 @@ func (s *stepRunAlicloudInstance) Cleanup(state multistep.StateBag) {
instanceAttrubite, _ := client.DescribeInstanceAttribute(instance.InstanceId)
if instanceAttrubite.Status == ecs.Starting || instanceAttrubite.Status == ecs.Running {
if err := client.StopInstance(instance.InstanceId, true); err != nil {
ui.Say(fmt.Sprintf("Stop alicloud instance %s failed %v", instance.InstanceId, err))
ui.Say(fmt.Sprintf("Error stopping instance %s, it may still be around %s", instance.InstanceId, err))
return
}
err := client.WaitForInstance(instance.InstanceId, ecs.Stopped, ALICLOUD_DEFAULT_TIMEOUT)
ui.Say(fmt.Sprintf("Stop alicloud instance %s failed %v", instance.InstanceId, err))
ui.Say(fmt.Sprintf("Error stopping instance %s, it may still be around %s", instance.InstanceId, err))
}
}
}

View File

@ -2,6 +2,7 @@ package ecs
import (
"fmt"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/packer/packer"
@ -28,7 +29,7 @@ func (s *setpShareAlicloudImage) Run(state multistep.StateBag) multistep.StepAct
})
if err != nil {
state.Put("error", err)
ui.Say(fmt.Sprintf("Modify alicloud image share permission failed: %s", err))
ui.Say(fmt.Sprintf("Failed modifying image share permissions: %s", err))
return multistep.ActionHalt
}
}
@ -42,7 +43,7 @@ func (s *setpShareAlicloudImage) Cleanup(state multistep.StateBag) {
ui := state.Get("ui").(packer.Ui)
client := state.Get("client").(*ecs.Client)
alicloudImages := state.Get("alicloudimages").(map[string]string)
ui.Say("Restore alicloud image share permission because cancelations or error...")
ui.Say("Restoring image share permission because cancellations or error...")
for copyedRegion, copyedImageId := range alicloudImages {
err := client.ModifyImageSharePermission(
&ecs.ModifyImageSharePermissionArgs{
@ -52,7 +53,7 @@ func (s *setpShareAlicloudImage) Cleanup(state multistep.StateBag) {
RemoveAccount: s.AlicloudImageShareAccounts,
})
if err != nil {
ui.Say(fmt.Sprintf("Restore alicloud image share permission failed: %s", err))
ui.Say(fmt.Sprintf("Restoring image share permission failed: %s", err))
}
}
}