diff --git a/builder/alicloud/ecs/builder.go b/builder/alicloud/ecs/builder.go index 0c4cd0fe1..f3d9d73a1 100644 --- a/builder/alicloud/ecs/builder.go +++ b/builder/alicloud/ecs/builder.go @@ -79,7 +79,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe return nil, err } state := new(multistep.BasicStateBag) - state.Put("config", b.config) + state.Put("config", &b.config) state.Put("client", client) state.Put("hook", hook) state.Put("ui", ui) diff --git a/builder/alicloud/ecs/builder_acc_test.go b/builder/alicloud/ecs/builder_acc_test.go index 77094f019..e6157b8c9 100644 --- a/builder/alicloud/ecs/builder_acc_test.go +++ b/builder/alicloud/ecs/builder_acc_test.go @@ -292,8 +292,7 @@ const testBuilderAccBasic = ` "type": "test", "region": "cn-beijing", "instance_type": "ecs.n1.tiny", - "source_image":"ubuntu_16_0402_64_40G_base_20170222.vhd", - "ssh_username": "ubuntu", + "source_image":"ubuntu_16_0402_64_20G_alibase_20180409.vhd", "io_optimized":"true", "ssh_username":"root", "image_name": "packer-test_{{timestamp}}" diff --git a/builder/alicloud/ecs/step_attach_keypair.go b/builder/alicloud/ecs/step_attach_keypair.go index 9f5b63676..08c52d0d8 100644 --- a/builder/alicloud/ecs/step_attach_keypair.go +++ b/builder/alicloud/ecs/step_attach_keypair.go @@ -18,7 +18,7 @@ type stepAttachKeyPair struct { func (s *stepAttachKeyPair) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) client := state.Get("client").(*ecs.Client) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) instance := state.Get("instance").(*ecs.InstanceAttributesType) timeoutPoint := time.Now().Add(120 * time.Second) keyPairName := config.Comm.SSHKeyPairName @@ -52,7 +52,7 @@ func (s *stepAttachKeyPair) Run(_ context.Context, state multistep.StateBag) mul func (s *stepAttachKeyPair) Cleanup(state multistep.StateBag) { client := state.Get("client").(*ecs.Client) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui := state.Get("ui").(packer.Ui) instance := state.Get("instance").(*ecs.InstanceAttributesType) keyPairName := config.Comm.SSHKeyPairName diff --git a/builder/alicloud/ecs/step_check_source_image.go b/builder/alicloud/ecs/step_check_source_image.go index f0fbf46e2..ebd4e56cb 100644 --- a/builder/alicloud/ecs/step_check_source_image.go +++ b/builder/alicloud/ecs/step_check_source_image.go @@ -16,7 +16,7 @@ type stepCheckAlicloudSourceImage struct { func (s *stepCheckAlicloudSourceImage) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ecs.Client) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui := state.Get("ui").(packer.Ui) args := &ecs.DescribeImagesArgs{ RegionId: common.Region(config.AlicloudRegion), diff --git a/builder/alicloud/ecs/step_config_vpc.go b/builder/alicloud/ecs/step_config_vpc.go index 8ce5663ed..c86746d1f 100644 --- a/builder/alicloud/ecs/step_config_vpc.go +++ b/builder/alicloud/ecs/step_config_vpc.go @@ -20,7 +20,7 @@ type stepConfigAlicloudVPC struct { } func (s *stepConfigAlicloudVPC) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - config := state.Get("config").(Config) + config := state.Get("config").(*Config) client := state.Get("client").(*ecs.Client) ui := state.Get("ui").(packer.Ui) diff --git a/builder/alicloud/ecs/step_config_vswitch.go b/builder/alicloud/ecs/step_config_vswitch.go index 4bbb19773..4daa81a69 100644 --- a/builder/alicloud/ecs/step_config_vswitch.go +++ b/builder/alicloud/ecs/step_config_vswitch.go @@ -24,7 +24,7 @@ func (s *stepConfigAlicloudVSwitch) Run(_ context.Context, state multistep.State client := state.Get("client").(*ecs.Client) ui := state.Get("ui").(packer.Ui) vpcId := state.Get("vpcid").(string) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) if len(s.VSwitchId) != 0 { vswitchs, _, err := client.DescribeVSwitches(&ecs.DescribeVSwitchesArgs{ diff --git a/builder/alicloud/ecs/step_create_image.go b/builder/alicloud/ecs/step_create_image.go index ae5840c09..fedbfb272 100644 --- a/builder/alicloud/ecs/step_create_image.go +++ b/builder/alicloud/ecs/step_create_image.go @@ -15,7 +15,7 @@ type stepCreateAlicloudImage struct { } func (s *stepCreateAlicloudImage) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - config := state.Get("config").(Config) + config := state.Get("config").(*Config) client := state.Get("client").(*ecs.Client) ui := state.Get("ui").(packer.Ui) @@ -85,7 +85,7 @@ func (s *stepCreateAlicloudImage) Cleanup(state multistep.StateBag) { client := state.Get("client").(*ecs.Client) ui := state.Get("ui").(packer.Ui) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui.Say("Deleting the image because of cancellation or error...") if err := client.DeleteImage(common.Region(config.AlicloudRegion), s.image.ImageId); err != nil { diff --git a/builder/alicloud/ecs/step_create_instance.go b/builder/alicloud/ecs/step_create_instance.go index ff41a3df6..082b39188 100644 --- a/builder/alicloud/ecs/step_create_instance.go +++ b/builder/alicloud/ecs/step_create_instance.go @@ -28,7 +28,7 @@ type stepCreateAlicloudInstance struct { func (s *stepCreateAlicloudInstance) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ecs.Client) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui := state.Get("ui").(packer.Ui) source_image := state.Get("source_image").(*ecs.ImageType) network_type := state.Get("networktype").(InstanceNetWork) diff --git a/builder/alicloud/ecs/step_delete_images_snapshots.go b/builder/alicloud/ecs/step_delete_images_snapshots.go index 9e294c45f..6718744d9 100644 --- a/builder/alicloud/ecs/step_delete_images_snapshots.go +++ b/builder/alicloud/ecs/step_delete_images_snapshots.go @@ -20,7 +20,7 @@ type stepDeleteAlicloudImageSnapshots struct { func (s *stepDeleteAlicloudImageSnapshots) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ecs.Client) ui := state.Get("ui").(packer.Ui) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui.Say("Deleting image snapshots.") // Check for force delete if s.AlicloudImageForceDelete { diff --git a/builder/alicloud/ecs/step_mount_disk.go b/builder/alicloud/ecs/step_mount_disk.go index 642605bee..40b3dc792 100644 --- a/builder/alicloud/ecs/step_mount_disk.go +++ b/builder/alicloud/ecs/step_mount_disk.go @@ -14,7 +14,7 @@ type stepMountAlicloudDisk struct { func (s *stepMountAlicloudDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ecs.Client) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui := state.Get("ui").(packer.Ui) instance := state.Get("instance").(*ecs.InstanceAttributesType) alicloudDiskDevices := config.ECSImagesDiskMappings diff --git a/builder/alicloud/ecs/step_pre_validate.go b/builder/alicloud/ecs/step_pre_validate.go index 6bc3b1060..57c3546b6 100644 --- a/builder/alicloud/ecs/step_pre_validate.go +++ b/builder/alicloud/ecs/step_pre_validate.go @@ -23,7 +23,7 @@ func (s *stepPreValidate) Run(_ context.Context, state multistep.StateBag) multi } client := state.Get("client").(*ecs.Client) - config := state.Get("config").(Config) + config := state.Get("config").(*Config) ui.Say("Prevalidating image name...") images, _, err := client.DescribeImages(&ecs.DescribeImagesArgs{ ImageName: s.AlicloudDestImageName,