diff --git a/builder/alicloud/ecs/builder.go b/builder/alicloud/ecs/builder.go index 9fc5f679f..93a801dd2 100644 --- a/builder/alicloud/ecs/builder.go +++ b/builder/alicloud/ecs/builder.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -80,7 +81,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { client, err := b.config.Client() if err != nil { diff --git a/builder/alicloud/ecs/packer_helper.go b/builder/alicloud/ecs/packer_helper.go index 4074d7ad7..51169f4ec 100644 --- a/builder/alicloud/ecs/packer_helper.go +++ b/builder/alicloud/ecs/packer_helper.go @@ -4,15 +4,15 @@ import ( "fmt" "strconv" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func cleanUpMessage(state multistep.StateBag, module string) { _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if cancelled || halted { ui.Say(fmt.Sprintf("Deleting %s because of cancellation or error...", module)) @@ -22,7 +22,7 @@ func cleanUpMessage(state multistep.StateBag, module string) { } func halt(state multistep.StateBag, err error, prefix string) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if prefix != "" { err = fmt.Errorf("%s: %s", prefix, err) diff --git a/builder/alicloud/ecs/step_attach_keypair.go b/builder/alicloud/ecs/step_attach_keypair.go index 16596eef1..55f81f8ca 100644 --- a/builder/alicloud/ecs/step_attach_keypair.go +++ b/builder/alicloud/ecs/step_attach_keypair.go @@ -6,8 +6,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepAttachKeyPair struct { @@ -21,7 +21,7 @@ var attachKeyPairNotRetryErrors = []string{ } func (s *stepAttachKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*ClientWrapper) config := state.Get("config").(*Config) instance := state.Get("instance").(*ecs.Instance) @@ -52,7 +52,7 @@ func (s *stepAttachKeyPair) Run(ctx context.Context, state multistep.StateBag) m func (s *stepAttachKeyPair) Cleanup(state multistep.StateBag) { client := state.Get("client").(*ClientWrapper) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*ecs.Instance) keyPairName := config.Comm.SSHKeyPairName if keyPairName == "" { diff --git a/builder/alicloud/ecs/step_check_source_image.go b/builder/alicloud/ecs/step_check_source_image.go index 66c26dc96..95c2168c5 100644 --- a/builder/alicloud/ecs/step_check_source_image.go +++ b/builder/alicloud/ecs/step_check_source_image.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCheckAlicloudSourceImage struct { @@ -16,7 +16,7 @@ type stepCheckAlicloudSourceImage struct { func (s *stepCheckAlicloudSourceImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) describeImagesRequest := ecs.CreateDescribeImagesRequest() describeImagesRequest.RegionId = config.AlicloudRegion diff --git a/builder/alicloud/ecs/step_config_eip.go b/builder/alicloud/ecs/step_config_eip.go index 4053a6bcd..ce17b35d4 100644 --- a/builder/alicloud/ecs/step_config_eip.go +++ b/builder/alicloud/ecs/step_config_eip.go @@ -9,8 +9,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepConfigAlicloudEIP struct { @@ -28,7 +28,7 @@ var allocateEipAddressRetryErrors = []string{ func (s *stepConfigAlicloudEIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*ecs.Instance) if s.SSHPrivateIp { @@ -96,7 +96,7 @@ func (s *stepConfigAlicloudEIP) Cleanup(state multistep.StateBag) { client := state.Get("client").(*ClientWrapper) instance := state.Get("instance").(*ecs.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) unassociateEipAddressRequest := ecs.CreateUnassociateEipAddressRequest() unassociateEipAddressRequest.AllocationId = s.allocatedId diff --git a/builder/alicloud/ecs/step_config_key_pair.go b/builder/alicloud/ecs/step_config_key_pair.go index 428198bec..49e551f01 100644 --- a/builder/alicloud/ecs/step_config_key_pair.go +++ b/builder/alicloud/ecs/step_config_key_pair.go @@ -8,8 +8,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepConfigAlicloudKeyPair struct { @@ -22,7 +22,7 @@ type stepConfigAlicloudKeyPair struct { } func (s *stepConfigAlicloudKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") @@ -108,7 +108,7 @@ func (s *stepConfigAlicloudKeyPair) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Remove the keypair ui.Say("Deleting temporary keypair...") diff --git a/builder/alicloud/ecs/step_config_public_ip.go b/builder/alicloud/ecs/step_config_public_ip.go index 8d8c7403e..94a6a2cbf 100644 --- a/builder/alicloud/ecs/step_config_public_ip.go +++ b/builder/alicloud/ecs/step_config_public_ip.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepConfigAlicloudPublicIP struct { @@ -17,7 +17,7 @@ type stepConfigAlicloudPublicIP struct { func (s *stepConfigAlicloudPublicIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*ecs.Instance) if s.SSHPrivateIp { diff --git a/builder/alicloud/ecs/step_config_security_group.go b/builder/alicloud/ecs/step_config_security_group.go index 694a10817..0a3ff9685 100644 --- a/builder/alicloud/ecs/step_config_security_group.go +++ b/builder/alicloud/ecs/step_config_security_group.go @@ -6,8 +6,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -30,7 +30,7 @@ var deleteSecurityGroupRetryErrors = []string{ func (s *stepConfigAlicloudSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) networkType := state.Get("networktype").(InstanceNetWork) if len(s.SecurityGroupId) != 0 { @@ -117,7 +117,7 @@ func (s *stepConfigAlicloudSecurityGroup) Cleanup(state multistep.StateBag) { cleanUpMessage(state, "security group") client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, err := client.WaitForExpected(&WaitForExpectArgs{ RequestFunc: func() (responses.AcsResponse, error) { diff --git a/builder/alicloud/ecs/step_config_vpc.go b/builder/alicloud/ecs/step_config_vpc.go index 53ecb8476..72d990aac 100644 --- a/builder/alicloud/ecs/step_config_vpc.go +++ b/builder/alicloud/ecs/step_config_vpc.go @@ -7,8 +7,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -35,7 +35,7 @@ var deleteVpcRetryErrors = []string{ func (s *stepConfigAlicloudVPC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.VpcId) != 0 { describeVpcsRequest := ecs.CreateDescribeVpcsRequest() @@ -118,7 +118,7 @@ func (s *stepConfigAlicloudVPC) Cleanup(state multistep.StateBag) { cleanUpMessage(state, "VPC") client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, err := client.WaitForExpected(&WaitForExpectArgs{ RequestFunc: func() (responses.AcsResponse, error) { diff --git a/builder/alicloud/ecs/step_config_vswitch.go b/builder/alicloud/ecs/step_config_vswitch.go index 38e51a346..0718e1f8e 100644 --- a/builder/alicloud/ecs/step_config_vswitch.go +++ b/builder/alicloud/ecs/step_config_vswitch.go @@ -6,8 +6,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -33,7 +33,7 @@ var deleteVSwitchRetryErrors = []string{ func (s *stepConfigAlicloudVSwitch) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vpcId := state.Get("vpcid").(string) config := state.Get("config").(*Config) @@ -176,7 +176,7 @@ func (s *stepConfigAlicloudVSwitch) Cleanup(state multistep.StateBag) { cleanUpMessage(state, "vSwitch") client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, err := client.WaitForExpected(&WaitForExpectArgs{ RequestFunc: func() (responses.AcsResponse, error) { diff --git a/builder/alicloud/ecs/step_create_image.go b/builder/alicloud/ecs/step_create_image.go index a1f47b61a..7506777cf 100644 --- a/builder/alicloud/ecs/step_create_image.go +++ b/builder/alicloud/ecs/step_create_image.go @@ -9,8 +9,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -27,7 +27,7 @@ var createImageRetryErrors = []string{ func (s *stepCreateAlicloudImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) tempImageName := config.AlicloudImageName if config.ImageEncrypted.True() { @@ -95,7 +95,7 @@ func (s *stepCreateAlicloudImage) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !cancelled && !halted && encryptedSet { ui.Say(fmt.Sprintf("Deleting temporary image %s(%s) and related snapshots after finishing encryption...", s.image.ImageId, s.image.ImageName)) diff --git a/builder/alicloud/ecs/step_create_instance.go b/builder/alicloud/ecs/step_create_instance.go index 0d9958d40..a086a42a1 100644 --- a/builder/alicloud/ecs/step_create_instance.go +++ b/builder/alicloud/ecs/step_create_instance.go @@ -12,8 +12,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -41,7 +41,7 @@ var deleteInstanceRetryErrors = []string{ func (s *stepCreateAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating instance...") createInstanceRequest, err := s.buildCreateInstanceRequest(state) @@ -91,7 +91,7 @@ func (s *stepCreateAlicloudInstance) Cleanup(state multistep.StateBag) { cleanUpMessage(state, "instance") client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, err := client.WaitForExpected(&WaitForExpectArgs{ RequestFunc: func() (responses.AcsResponse, error) { diff --git a/builder/alicloud/ecs/step_create_snapshot.go b/builder/alicloud/ecs/step_create_snapshot.go index 056a4ba87..dd29c2925 100644 --- a/builder/alicloud/ecs/step_create_snapshot.go +++ b/builder/alicloud/ecs/step_create_snapshot.go @@ -7,8 +7,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateAlicloudSnapshot struct { @@ -19,7 +19,7 @@ type stepCreateAlicloudSnapshot struct { func (s *stepCreateAlicloudSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*ecs.Instance) describeDisksRequest := ecs.CreateDescribeDisksRequest() @@ -77,7 +77,7 @@ func (s *stepCreateAlicloudSnapshot) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting the snapshot because of cancellation or error...") diff --git a/builder/alicloud/ecs/step_create_tags.go b/builder/alicloud/ecs/step_create_tags.go index f374dcba4..31224a709 100644 --- a/builder/alicloud/ecs/step_create_tags.go +++ b/builder/alicloud/ecs/step_create_tags.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateTags struct { @@ -16,7 +16,7 @@ type stepCreateTags struct { func (s *stepCreateTags) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) imageId := state.Get("alicloudimage").(string) snapshotIds := state.Get("alicloudsnapshots").([]string) diff --git a/builder/alicloud/ecs/step_delete_images_snapshots.go b/builder/alicloud/ecs/step_delete_images_snapshots.go index bffbb5068..4eac1d103 100644 --- a/builder/alicloud/ecs/step_delete_images_snapshots.go +++ b/builder/alicloud/ecs/step_delete_images_snapshots.go @@ -6,8 +6,8 @@ import ( "log" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepDeleteAlicloudImageSnapshots struct { @@ -54,7 +54,7 @@ func (s *stepDeleteAlicloudImageSnapshots) Run(ctx context.Context, state multis func (s *stepDeleteAlicloudImageSnapshots) deleteImageAndSnapshots(state multistep.StateBag, imageName string, region string) error { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) describeImagesRequest := ecs.CreateDescribeImagesRequest() describeImagesRequest.RegionId = region diff --git a/builder/alicloud/ecs/step_pre_validate.go b/builder/alicloud/ecs/step_pre_validate.go index 8481f34f4..6a2f6723e 100644 --- a/builder/alicloud/ecs/step_pre_validate.go +++ b/builder/alicloud/ecs/step_pre_validate.go @@ -7,6 +7,7 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepPreValidate struct { @@ -27,7 +28,7 @@ func (s *stepPreValidate) Run(ctx context.Context, state multistep.StateBag) mul } func (s *stepPreValidate) validateRegions(state multistep.StateBag) error { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.AlicloudSkipValidation { @@ -55,7 +56,7 @@ func (s *stepPreValidate) validateRegions(state multistep.StateBag) error { } func (s *stepPreValidate) validateDestImageName(state multistep.StateBag) error { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*ClientWrapper) config := state.Get("config").(*Config) diff --git a/builder/alicloud/ecs/step_region_copy_image.go b/builder/alicloud/ecs/step_region_copy_image.go index 6905b179d..716639f12 100644 --- a/builder/alicloud/ecs/step_region_copy_image.go +++ b/builder/alicloud/ecs/step_region_copy_image.go @@ -7,8 +7,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -31,7 +31,7 @@ func (s *stepRegionCopyAlicloudImage) Run(ctx context.Context, state multistep.S } client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) srcImageId := state.Get("alicloudimage").(string) alicloudImages := state.Get("alicloudimages").(map[string]string) @@ -83,7 +83,7 @@ func (s *stepRegionCopyAlicloudImage) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Stopping copy image because cancellation or error...")) client := state.Get("client").(*ClientWrapper) diff --git a/builder/alicloud/ecs/step_run_instance.go b/builder/alicloud/ecs/step_run_instance.go index d84d2028c..2f99e9f3e 100644 --- a/builder/alicloud/ecs/step_run_instance.go +++ b/builder/alicloud/ecs/step_run_instance.go @@ -6,8 +6,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepRunAlicloudInstance struct { @@ -15,7 +15,7 @@ type stepRunAlicloudInstance struct { func (s *stepRunAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*ecs.Instance) startInstanceRequest := ecs.CreateStartInstanceRequest() @@ -42,7 +42,7 @@ func (s *stepRunAlicloudInstance) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*ClientWrapper) instance := state.Get("instance").(*ecs.Instance) diff --git a/builder/alicloud/ecs/step_share_image.go b/builder/alicloud/ecs/step_share_image.go index 552f41de4..f7c07a0b2 100644 --- a/builder/alicloud/ecs/step_share_image.go +++ b/builder/alicloud/ecs/step_share_image.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepShareAlicloudImage struct { @@ -41,7 +41,7 @@ func (s *stepShareAlicloudImage) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*ClientWrapper) alicloudImages := state.Get("alicloudimages").(map[string]string) diff --git a/builder/alicloud/ecs/step_stop_instance.go b/builder/alicloud/ecs/step_stop_instance.go index 7b6daaaab..7fbebc19b 100644 --- a/builder/alicloud/ecs/step_stop_instance.go +++ b/builder/alicloud/ecs/step_stop_instance.go @@ -8,8 +8,8 @@ import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepStopAlicloudInstance struct { @@ -20,7 +20,7 @@ type stepStopAlicloudInstance struct { func (s *stepStopAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ClientWrapper) instance := state.Get("instance").(*ecs.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !s.DisableStop { ui.Say(fmt.Sprintf("Stopping instance: %s", instance.InstanceId)) diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index a6c750aca..2ae2ad611 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -345,7 +346,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return generatedData, warns, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { if runtime.GOOS != "linux" { return nil, errors.New("The amazon-chroot builder only works on Linux environments.") } diff --git a/builder/amazon/chroot/step_attach_volume.go b/builder/amazon/chroot/step_attach_volume.go index d87b03ca0..572ebce6e 100644 --- a/builder/amazon/chroot/step_attach_volume.go +++ b/builder/amazon/chroot/step_attach_volume.go @@ -8,8 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepAttachVolume attaches the previously created volume to an @@ -28,7 +28,7 @@ func (s *StepAttachVolume) Run(ctx context.Context, state multistep.StateBag) mu ec2conn := state.Get("ec2").(*ec2.EC2) device := state.Get("device").(string) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) volumeId := state.Get("volume_id").(string) // For the API call, it expects "sd" prefixed devices. @@ -65,7 +65,7 @@ func (s *StepAttachVolume) Run(ctx context.Context, state multistep.StateBag) mu } func (s *StepAttachVolume) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } @@ -77,7 +77,7 @@ func (s *StepAttachVolume) CleanupFunc(state multistep.StateBag) error { } ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Detaching EBS volume...") _, err := ec2conn.DetachVolume(&ec2.DetachVolumeInput{VolumeId: &s.volumeId}) diff --git a/builder/amazon/chroot/step_check_root_device.go b/builder/amazon/chroot/step_check_root_device.go index cb1d06d8e..e9391c41e 100644 --- a/builder/amazon/chroot/step_check_root_device.go +++ b/builder/amazon/chroot/step_check_root_device.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCheckRootDevice makes sure the root device on the AMI is EBS-backed. @@ -14,7 +14,7 @@ type StepCheckRootDevice struct{} func (s *StepCheckRootDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { image := state.Get("source_image").(*ec2.Image) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Checking the root device on source AMI...") diff --git a/builder/amazon/chroot/step_create_volume.go b/builder/amazon/chroot/step_create_volume.go index f59bf689d..2b4a2a061 100644 --- a/builder/amazon/chroot/step_create_volume.go +++ b/builder/amazon/chroot/step_create_volume.go @@ -9,8 +9,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -32,7 +32,7 @@ func (s *StepCreateVolume) Run(ctx context.Context, state multistep.StateBag) mu config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) volTags, err := awscommon.TagMap(s.RootVolumeTags).EC2Tags(s.Ctx, *ec2conn.Config.Region, state) if err != nil { @@ -129,7 +129,7 @@ func (s *StepCreateVolume) Cleanup(state multistep.StateBag) { } ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting the created EBS volume...") _, err := ec2conn.DeleteVolume(&ec2.DeleteVolumeInput{VolumeId: &s.volumeId}) diff --git a/builder/amazon/chroot/step_early_unflock.go b/builder/amazon/chroot/step_early_unflock.go index a5378557f..5abe7dd1d 100644 --- a/builder/amazon/chroot/step_early_unflock.go +++ b/builder/amazon/chroot/step_early_unflock.go @@ -5,9 +5,9 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/chroot" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepEarlyUnflock unlocks the flock. @@ -15,7 +15,7 @@ type StepEarlyUnflock struct{} func (s *StepEarlyUnflock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { cleanup := state.Get("flock_cleanup").(chroot.Cleanup) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) log.Println("Unlocking file lock...") if err := cleanup.CleanupFunc(state); err != nil { diff --git a/builder/amazon/chroot/step_flock.go b/builder/amazon/chroot/step_flock.go index 5465a72fe..c8d92f5a3 100644 --- a/builder/amazon/chroot/step_flock.go +++ b/builder/amazon/chroot/step_flock.go @@ -7,8 +7,8 @@ import ( "os" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepFlock provisions the instance within a chroot. @@ -20,7 +20,7 @@ type StepFlock struct { } func (s *StepFlock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) lockfile := "/var/lock/packer-chroot/lock" if err := os.MkdirAll(filepath.Dir(lockfile), 0755); err != nil { diff --git a/builder/amazon/chroot/step_instance_info.go b/builder/amazon/chroot/step_instance_info.go index 618577146..4cc488991 100644 --- a/builder/amazon/chroot/step_instance_info.go +++ b/builder/amazon/chroot/step_instance_info.go @@ -8,8 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepInstanceInfo verifies that this builder is running on an EC2 instance. @@ -18,7 +18,7 @@ type StepInstanceInfo struct{} func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) session := state.Get("awsSession").(*session.Session) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Get our own instance ID ui.Say("Gathering information about this EC2 instance...") diff --git a/builder/amazon/chroot/step_mount_device.go b/builder/amazon/chroot/step_mount_device.go index d167e73eb..b4e56f42c 100644 --- a/builder/amazon/chroot/step_mount_device.go +++ b/builder/amazon/chroot/step_mount_device.go @@ -10,9 +10,9 @@ import ( "strings" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -36,7 +36,7 @@ type StepMountDevice struct { func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := state.Get("device").(string) if config.NVMEDevicePath != "" { // customizable device path for mounting NVME block devices on c5 and m5 HVM @@ -127,7 +127,7 @@ func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) mul } func (s *StepMountDevice) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } @@ -138,7 +138,7 @@ func (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error { return nil } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) ui.Say("Unmounting the root device...") diff --git a/builder/amazon/chroot/step_prepare_device.go b/builder/amazon/chroot/step_prepare_device.go index 970c29b13..464dd950e 100644 --- a/builder/amazon/chroot/step_prepare_device.go +++ b/builder/amazon/chroot/step_prepare_device.go @@ -6,8 +6,8 @@ import ( "log" "os" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" ) @@ -18,7 +18,7 @@ type StepPrepareDevice struct { func (s *StepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := config.DevicePath if device == "" { diff --git a/builder/amazon/chroot/step_register_ami.go b/builder/amazon/chroot/step_register_ami.go index 74f10e271..1f29a051c 100644 --- a/builder/amazon/chroot/step_register_ami.go +++ b/builder/amazon/chroot/step_register_ami.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/random" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -26,7 +26,7 @@ func (s *StepRegisterAMI) Run(ctx context.Context, state multistep.StateBag) mul config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) snapshotID := state.Get("snapshot_id").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Registering the AMI...") diff --git a/builder/amazon/chroot/step_snapshot.go b/builder/amazon/chroot/step_snapshot.go index ba7391516..3f01cd1b2 100644 --- a/builder/amazon/chroot/step_snapshot.go +++ b/builder/amazon/chroot/step_snapshot.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepSnapshot creates a snapshot of the created volume. @@ -22,7 +22,7 @@ type StepSnapshot struct { func (s *StepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) volumeId := state.Get("volume_id").(string) ui.Say("Creating snapshot...") @@ -72,7 +72,7 @@ func (s *StepSnapshot) Cleanup(state multistep.StateBag) { if cancelled || halted { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Removing snapshot since we cancelled or halted...") _, err := ec2conn.DeleteSnapshot(&ec2.DeleteSnapshotInput{SnapshotId: &s.snapshotId}) if err != nil { diff --git a/builder/amazon/common/ssm/session.go b/builder/amazon/common/ssm/session.go index 8e3f0fa84..4dc3cf923 100644 --- a/builder/amazon/common/ssm/session.go +++ b/builder/amazon/common/ssm/session.go @@ -13,7 +13,7 @@ import ( "github.com/aws/aws-sdk-go/service/ssm" "github.com/aws/aws-sdk-go/service/ssm/ssmiface" "github.com/hashicorp/packer/builder/amazon/common/awserrors" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/shell-local/localexec" ) @@ -89,7 +89,7 @@ func (s Session) getCommand(ctx context.Context) ([]string, string, error) { // context. If you do not wish to terminate the session manually: calling // StopSession on a instance of this driver will terminate the active session // created from calling StartSession. -func (s Session) Start(ctx context.Context, ui packer.Ui) error { +func (s Session) Start(ctx context.Context, ui packersdk.Ui) error { for ctx.Err() == nil { log.Printf("ssm: Starting PortForwarding session to instance %s", s.InstanceID) args, sessionID, err := s.getCommand(ctx) diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index 1395b3f80..182cb9de3 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -62,7 +63,7 @@ func (s *StepAMIRegionCopy) DeduplicateRegions(intermediary bool) { } func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) amis := state.Get("amis").(map[string]string) snapshots := state.Get("snapshots").(map[string][]string) intermediary, _ := state.Get("intermediary_image").(bool) @@ -150,7 +151,7 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m func (s *StepAMIRegionCopy) Cleanup(state multistep.StateBag) { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.toDelete) == 0 { return diff --git a/builder/amazon/common/step_cleanup_volumes.go b/builder/amazon/common/step_cleanup_volumes.go index 67c0a7939..87a562bd2 100644 --- a/builder/amazon/common/step_cleanup_volumes.go +++ b/builder/amazon/common/step_cleanup_volumes.go @@ -6,8 +6,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepCleanupVolumes cleans up any orphaned volumes that were not designated to @@ -29,7 +29,7 @@ func (s *StepCleanupVolumes) Cleanup(state multistep.StateBag) { if instanceRaw != nil { instance = instanceRaw.(*ec2.Instance) } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if instance == nil { ui.Say("No volumes to clean up, skipping") return diff --git a/builder/amazon/common/step_create_ssm_tunnel.go b/builder/amazon/common/step_create_ssm_tunnel.go index 2b1de42af..cdb41f8bf 100644 --- a/builder/amazon/common/step_create_ssm_tunnel.go +++ b/builder/amazon/common/step_create_ssm_tunnel.go @@ -10,9 +10,9 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ssm" pssm "github.com/hashicorp/packer/builder/amazon/common/ssm" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateSSMTunnel struct { @@ -27,7 +27,7 @@ type StepCreateSSMTunnel struct { // Run executes the Packer build step that creates a session tunnel. func (s *StepCreateSSMTunnel) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !s.SSMAgentEnabled { return multistep.ActionContinue diff --git a/builder/amazon/common/step_create_tags.go b/builder/amazon/common/step_create_tags.go index c875f5e49..4301c4c40 100644 --- a/builder/amazon/common/step_create_tags.go +++ b/builder/amazon/common/step_create_tags.go @@ -9,8 +9,8 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/packer/builder/amazon/common/awserrors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -24,7 +24,7 @@ type StepCreateTags struct { func (s *StepCreateTags) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) session := state.Get("awsSession").(*session.Session) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) amis := state.Get("amis").(map[string]string) if len(s.Tags) == 0 && len(s.SnapshotTags) == 0 { diff --git a/builder/amazon/common/step_deregister_ami.go b/builder/amazon/common/step_deregister_ami.go index 8ab5685c7..ea5a4f385 100644 --- a/builder/amazon/common/step_deregister_ami.go +++ b/builder/amazon/common/step_deregister_ami.go @@ -6,8 +6,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDeregisterAMI struct { @@ -24,7 +24,7 @@ func (s *StepDeregisterAMI) Run(ctx context.Context, state multistep.StateBag) m return multistep.ActionContinue } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ec2conn := state.Get("ec2").(*ec2.EC2) // Add the session region to list of regions will deregister AMIs in regions := append(s.Regions, *ec2conn.Config.Region) diff --git a/builder/amazon/common/step_get_password.go b/builder/amazon/common/step_get_password.go index 007f8c5f2..f1e1410cc 100644 --- a/builder/amazon/common/step_get_password.go +++ b/builder/amazon/common/step_get_password.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -28,7 +29,7 @@ type StepGetPassword struct { } func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip if we're not using winrm if s.Comm.Type != "winrm" { diff --git a/builder/amazon/common/step_iam_instance_profile.go b/builder/amazon/common/step_iam_instance_profile.go index 91a6ec2b0..09ac5030c 100644 --- a/builder/amazon/common/step_iam_instance_profile.go +++ b/builder/amazon/common/step_iam_instance_profile.go @@ -8,8 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -25,7 +25,7 @@ type StepIamInstanceProfile struct { func (s *StepIamInstanceProfile) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { iamsvc := state.Get("iam").(*iam.IAM) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) state.Put("iamInstanceProfile", "") @@ -147,7 +147,7 @@ func (s *StepIamInstanceProfile) Run(ctx context.Context, state multistep.StateB func (s *StepIamInstanceProfile) Cleanup(state multistep.StateBag) { iamsvc := state.Get("iam").(*iam.IAM) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) var err error if s.roleIsAttached == true { diff --git a/builder/amazon/common/step_key_pair.go b/builder/amazon/common/step_key_pair.go index a477524de..2de8d676c 100644 --- a/builder/amazon/common/step_key_pair.go +++ b/builder/amazon/common/step_key_pair.go @@ -9,8 +9,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -23,7 +23,7 @@ type StepKeyPair struct { } func (s *StepKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") @@ -114,7 +114,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) { } ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Remove the keypair ui.Say("Deleting temporary keypair...") diff --git a/builder/amazon/common/step_modify_ami_attributes.go b/builder/amazon/common/step_modify_ami_attributes.go index b60caff4c..3f45639dd 100644 --- a/builder/amazon/common/step_modify_ami_attributes.go +++ b/builder/amazon/common/step_modify_ami_attributes.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -28,7 +28,7 @@ type StepModifyAMIAttributes struct { func (s *StepModifyAMIAttributes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) session := state.Get("awsSession").(*session.Session) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) amis := state.Get("amis").(map[string]string) snapshots := state.Get("snapshots").(map[string][]string) diff --git a/builder/amazon/common/step_modify_ebs_instance.go b/builder/amazon/common/step_modify_ebs_instance.go index a578bcb24..776deced6 100644 --- a/builder/amazon/common/step_modify_ebs_instance.go +++ b/builder/amazon/common/step_modify_ebs_instance.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2/ec2iface" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -21,7 +21,7 @@ type StepModifyEBSBackedInstance struct { func (s *StepModifyEBSBackedInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(ec2iface.EC2API) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip when it is a spot instance if s.Skip { diff --git a/builder/amazon/common/step_network_info.go b/builder/amazon/common/step_network_info.go index b66bef233..75477863a 100644 --- a/builder/amazon/common/step_network_info.go +++ b/builder/amazon/common/step_network_info.go @@ -8,8 +8,8 @@ import ( "sort" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepNetworkInfo queries AWS for information about @@ -46,7 +46,7 @@ func mostFreeSubnet(subnets []*ec2.Subnet) *ec2.Subnet { func (s *StepNetworkInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // VPC if s.VpcId == "" && !s.VpcFilter.Empty() { diff --git a/builder/amazon/common/step_pre_validate.go b/builder/amazon/common/step_pre_validate.go index 993b4d940..7f43fc0be 100644 --- a/builder/amazon/common/step_pre_validate.go +++ b/builder/amazon/common/step_pre_validate.go @@ -10,8 +10,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/hashicorp/packer/builder/amazon/common/awserrors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -28,7 +28,7 @@ type StepPreValidate struct { } func (s *StepPreValidate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if accessConfig, ok := state.GetOk("access_config"); ok { accessconf := accessConfig.(*AccessConfig) diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index ded2f19ff..49e32fab2 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/packer/builder/amazon/common/awserrors" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -49,7 +49,7 @@ func (s *StepRunSourceInstance) Run(ctx context.Context, state multistep.StateBa securityGroupIds := aws.StringSlice(state.Get("securityGroupIds").([]string)) iamInstanceProfile := aws.String(state.Get("iamInstanceProfile").(string)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) userData := s.UserData if s.UserDataFile != "" { @@ -371,7 +371,7 @@ func (s *StepRunSourceInstance) Run(ctx context.Context, state multistep.StateBa func (s *StepRunSourceInstance) Cleanup(state multistep.StateBag) { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Terminate the source instance if it exists if s.instanceId != "" { diff --git a/builder/amazon/common/step_run_spot_instance.go b/builder/amazon/common/step_run_spot_instance.go index 039198f78..587efae64 100644 --- a/builder/amazon/common/step_run_spot_instance.go +++ b/builder/amazon/common/step_run_spot_instance.go @@ -14,8 +14,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/hashicorp/packer/builder/amazon/common/awserrors" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/random" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -161,7 +161,7 @@ func (s *StepRunSpotInstance) LoadUserData() (string, error) { func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(ec2iface.EC2API) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Launching a spot AWS instance...") @@ -485,7 +485,7 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) func (s *StepRunSpotInstance) Cleanup(state multistep.StateBag) { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) launchTemplateName := state.Get("launchTemplateName").(string) // Terminate the source instance if it exists diff --git a/builder/amazon/common/step_security_group.go b/builder/amazon/common/step_security_group.go index d77f4bfb4..515e4a42c 100644 --- a/builder/amazon/common/step_security_group.go +++ b/builder/amazon/common/step_security_group.go @@ -11,8 +11,8 @@ import ( "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -28,7 +28,7 @@ type StepSecurityGroup struct { func (s *StepSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vpcId := state.Get("vpc_id").(string) if len(s.SecurityGroupIds) > 0 { @@ -165,7 +165,7 @@ func (s *StepSecurityGroup) Cleanup(state multistep.StateBag) { } ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting temporary security group...") diff --git a/builder/amazon/common/step_source_ami_info.go b/builder/amazon/common/step_source_ami_info.go index 3c387a1c0..32b4dabc5 100644 --- a/builder/amazon/common/step_source_ami_info.go +++ b/builder/amazon/common/step_source_ami_info.go @@ -8,8 +8,8 @@ import ( "time" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -45,7 +45,7 @@ func mostRecentAmi(images []*ec2.Image) *ec2.Image { func (s *StepSourceAMIInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) params := &ec2.DescribeImagesInput{} diff --git a/builder/amazon/common/step_stop_ebs_instance.go b/builder/amazon/common/step_stop_ebs_instance.go index db0591e44..4351de063 100644 --- a/builder/amazon/common/step_stop_ebs_instance.go +++ b/builder/amazon/common/step_stop_ebs_instance.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/packer/builder/amazon/common/awserrors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -21,7 +21,7 @@ type StepStopEBSBackedInstance struct { func (s *StepStopEBSBackedInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip when it is a spot instance if s.Skip { diff --git a/builder/amazon/common/tags.go b/builder/amazon/common/tags.go index 299574c25..2ecac7f8c 100644 --- a/builder/amazon/common/tags.go +++ b/builder/amazon/common/tags.go @@ -5,8 +5,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -14,7 +14,7 @@ import ( type TagMap map[string]string type EC2Tags []*ec2.Tag -func (t EC2Tags) Report(ui packer.Ui) { +func (t EC2Tags) Report(ui packersdk.Ui) { for _, tag := range t { ui.Message(fmt.Sprintf("Adding tag: \"%s\": \"%s\"", aws.StringValue(tag.Key), aws.StringValue(tag.Value))) diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index a7be359c2..3271bc93b 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -150,7 +151,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return generatedData, warns, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { session, err := b.config.Session() if err != nil { diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go index 25efa7666..8f741c3d5 100644 --- a/builder/amazon/ebs/step_create_ami.go +++ b/builder/amazon/ebs/step_create_ami.go @@ -10,8 +10,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" "github.com/hashicorp/packer/builder/amazon/common/awserrors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/random" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -26,7 +26,7 @@ func (s *stepCreateAMI) Run(ctx context.Context, state multistep.StateBag) multi config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Create the image amiName := config.AMIName @@ -144,7 +144,7 @@ func (s *stepCreateAMI) Cleanup(state multistep.StateBag) { } ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deregistering the AMI and deleting associated snapshots because " + "of cancellation, or error...") diff --git a/builder/amazon/ebssurrogate/builder.go b/builder/amazon/ebssurrogate/builder.go index a6036bd76..d8453421d 100644 --- a/builder/amazon/ebssurrogate/builder.go +++ b/builder/amazon/ebssurrogate/builder.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -173,7 +174,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return generatedData, warns, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { session, err := b.config.Session() if err != nil { return nil, err diff --git a/builder/amazon/ebssurrogate/step_register_ami.go b/builder/amazon/ebssurrogate/step_register_ami.go index 66865250f..cf4cc1465 100644 --- a/builder/amazon/ebssurrogate/step_register_ami.go +++ b/builder/amazon/ebssurrogate/step_register_ami.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/random" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -31,7 +31,7 @@ func (s *StepRegisterAMI) Run(ctx context.Context, state multistep.StateBag) mul config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) snapshotIds := state.Get("snapshot_ids").(map[string]string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Registering the AMI...") @@ -127,7 +127,7 @@ func (s *StepRegisterAMI) Cleanup(state multistep.StateBag) { } ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deregistering the AMI because cancellation or error...") deregisterOpts := &ec2.DeregisterImageInput{ImageId: s.image.ImageId} diff --git a/builder/amazon/ebssurrogate/step_snapshot_volumes.go b/builder/amazon/ebssurrogate/step_snapshot_volumes.go index 3888fddce..f3225766a 100644 --- a/builder/amazon/ebssurrogate/step_snapshot_volumes.go +++ b/builder/amazon/ebssurrogate/step_snapshot_volumes.go @@ -10,8 +10,8 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" multierror "github.com/hashicorp/go-multierror" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -31,7 +31,7 @@ type StepSnapshotVolumes struct { func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName string, state multistep.StateBag) error { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*ec2.Instance) var volumeId string @@ -88,7 +88,7 @@ func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName str } func (s *StepSnapshotVolumes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) s.snapshotIds = map[string]string{} @@ -132,7 +132,7 @@ func (s *StepSnapshotVolumes) Cleanup(state multistep.StateBag) { if cancelled || halted { ec2conn := state.Get("ec2").(*ec2.EC2) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Removing snapshots since we cancelled or halted...") s.snapshotMutex.Lock() for _, snapshotId := range s.snapshotIds { diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index d5d5bddb1..cea518c6a 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -164,7 +165,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return generatedData, warns, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { session, err := b.config.Session() if err != nil { return nil, err diff --git a/builder/amazon/ebsvolume/step_tag_ebs_volumes.go b/builder/amazon/ebsvolume/step_tag_ebs_volumes.go index 911b2c138..aede0c511 100644 --- a/builder/amazon/ebsvolume/step_tag_ebs_volumes.go +++ b/builder/amazon/ebsvolume/step_tag_ebs_volumes.go @@ -8,8 +8,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -21,7 +21,7 @@ type stepTagEBSVolumes struct { func (s *stepTagEBSVolumes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { ec2conn := state.Get("ec2").(*ec2.EC2) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) volumes := make(EbsVolumes) diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 6a706b0ae..80f8c7c4b 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -233,7 +234,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return generatedData, warns, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { session, err := b.config.Session() if err != nil { return nil, err diff --git a/builder/amazon/instance/step_bundle_volume.go b/builder/amazon/instance/step_bundle_volume.go index 6bcee9b43..043f4f096 100644 --- a/builder/amazon/instance/step_bundle_volume.go +++ b/builder/amazon/instance/step_bundle_volume.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -28,7 +29,7 @@ func (s *StepBundleVolume) Run(ctx context.Context, state multistep.StateBag) mu comm := state.Get("communicator").(packer.Communicator) config := state.Get("config").(*Config) instance := state.Get("instance").(*ec2.Instance) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) x509RemoteCertPath := state.Get("x509RemoteCertPath").(string) x509RemoteKeyPath := state.Get("x509RemoteKeyPath").(string) diff --git a/builder/amazon/instance/step_register_ami.go b/builder/amazon/instance/step_register_ami.go index 10992c1cc..40a72cadc 100644 --- a/builder/amazon/instance/step_register_ami.go +++ b/builder/amazon/instance/step_register_ami.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" awscommon "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/random" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -24,7 +24,7 @@ func (s *StepRegisterAMI) Run(ctx context.Context, state multistep.StateBag) mul config := state.Get("config").(*Config) ec2conn := state.Get("ec2").(*ec2.EC2) manifestPath := state.Get("remote_manifest_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Registering the AMI...") diff --git a/builder/amazon/instance/step_upload_bundle.go b/builder/amazon/instance/step_upload_bundle.go index 8ff2d18c4..6a8dd3186 100644 --- a/builder/amazon/instance/step_upload_bundle.go +++ b/builder/amazon/instance/step_upload_bundle.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -28,7 +29,7 @@ func (s *StepUploadBundle) Run(ctx context.Context, state multistep.StateBag) mu config := state.Get("config").(*Config) manifestName := state.Get("manifest_name").(string) manifestPath := state.Get("manifest_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) accessKey := config.AccessKey secretKey := config.SecretKey diff --git a/builder/amazon/instance/step_upload_x509_cert.go b/builder/amazon/instance/step_upload_x509_cert.go index 37cf4ae6a..a46eb024f 100644 --- a/builder/amazon/instance/step_upload_x509_cert.go +++ b/builder/amazon/instance/step_upload_x509_cert.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepUploadX509Cert struct{} @@ -14,7 +15,7 @@ type StepUploadX509Cert struct{} func (s *StepUploadX509Cert) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) x509RemoteCertPath := config.X509UploadPath + "/cert.pem" x509RemoteKeyPath := config.X509UploadPath + "/key.pem" diff --git a/builder/azure/arm/builder.go b/builder/azure/arm/builder.go index bee0539a1..e7f28b256 100644 --- a/builder/azure/arm/builder.go +++ b/builder/azure/arm/builder.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Builder struct { @@ -51,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, errs } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { ui.Say("Running builder ...") @@ -339,7 +340,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack }, nil } -func (b *Builder) writeSSHPrivateKey(ui packer.Ui, debugKeyPath string) { +func (b *Builder) writeSSHPrivateKey(ui packersdk.Ui, debugKeyPath string) { f, err := os.Create(debugKeyPath) if err != nil { ui.Say(fmt.Sprintf("Error saving debug key: %s", err)) @@ -455,7 +456,7 @@ func (b *Builder) getServicePrincipalTokens(say func(string)) (*adal.ServicePrin return b.config.ClientConfig.GetServicePrincipalTokens(say) } -func getObjectIdFromToken(ui packer.Ui, token *adal.ServicePrincipalToken) string { +func getObjectIdFromToken(ui packersdk.Ui, token *adal.ServicePrincipalToken) string { claims := jwt.MapClaims{} var p jwt.Parser diff --git a/builder/azure/arm/step_capture_image.go b/builder/azure/arm/step_capture_image.go index 025fc96d3..34431971a 100644 --- a/builder/azure/arm/step_capture_image.go +++ b/builder/azure/arm/step_capture_image.go @@ -6,8 +6,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCaptureImage struct { @@ -20,7 +20,7 @@ type StepCaptureImage struct { error func(e error) } -func NewStepCaptureImage(client *AzureClient, ui packer.Ui) *StepCaptureImage { +func NewStepCaptureImage(client *AzureClient, ui packersdk.Ui) *StepCaptureImage { var step = &StepCaptureImage{ client: client, get: func(client *AzureClient) *CaptureTemplate { diff --git a/builder/azure/arm/step_certificate_in_keyvault.go b/builder/azure/arm/step_certificate_in_keyvault.go index 1d1b5800d..62b6d0d6d 100644 --- a/builder/azure/arm/step_certificate_in_keyvault.go +++ b/builder/azure/arm/step_certificate_in_keyvault.go @@ -6,8 +6,8 @@ import ( "github.com/hashicorp/packer/builder/azure/common" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCertificateInKeyVault struct { @@ -17,7 +17,7 @@ type StepCertificateInKeyVault struct { error func(e error) } -func NewStepCertificateInKeyVault(cli common.AZVaultClientIface, ui packer.Ui, config *Config) *StepCertificateInKeyVault { +func NewStepCertificateInKeyVault(cli common.AZVaultClientIface, ui packersdk.Ui, config *Config) *StepCertificateInKeyVault { var step = &StepCertificateInKeyVault{ client: cli, config: config, diff --git a/builder/azure/arm/step_create_resource_group.go b/builder/azure/arm/step_create_resource_group.go index ff0bab59c..9f9ee0edb 100644 --- a/builder/azure/arm/step_create_resource_group.go +++ b/builder/azure/arm/step_create_resource_group.go @@ -7,8 +7,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateResourceGroup struct { @@ -19,7 +19,7 @@ type StepCreateResourceGroup struct { exists func(ctx context.Context, resourceGroupName string) (bool, error) } -func NewStepCreateResourceGroup(client *AzureClient, ui packer.Ui) *StepCreateResourceGroup { +func NewStepCreateResourceGroup(client *AzureClient, ui packersdk.Ui) *StepCreateResourceGroup { var step = &StepCreateResourceGroup{ client: client, say: func(message string) { ui.Say(message) }, @@ -113,7 +113,7 @@ func (s *StepCreateResourceGroup) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if state.Get(constants.ArmIsExistingResourceGroup).(bool) { ui.Say("\nThe resource group was not created by Packer, not deleting ...") return diff --git a/builder/azure/arm/step_delete_additional_disks.go b/builder/azure/arm/step_delete_additional_disks.go index 6ff15a893..0d4e7cf53 100644 --- a/builder/azure/arm/step_delete_additional_disks.go +++ b/builder/azure/arm/step_delete_additional_disks.go @@ -9,8 +9,8 @@ import ( "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDeleteAdditionalDisk struct { @@ -21,7 +21,7 @@ type StepDeleteAdditionalDisk struct { error func(e error) } -func NewStepDeleteAdditionalDisks(client *AzureClient, ui packer.Ui) *StepDeleteAdditionalDisk { +func NewStepDeleteAdditionalDisks(client *AzureClient, ui packersdk.Ui) *StepDeleteAdditionalDisk { var step = &StepDeleteAdditionalDisk{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_deploy_template.go b/builder/azure/arm/step_deploy_template.go index 481af6156..a91cb70fe 100644 --- a/builder/azure/arm/step_deploy_template.go +++ b/builder/azure/arm/step_deploy_template.go @@ -9,8 +9,8 @@ import ( "time" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -27,7 +27,7 @@ type StepDeployTemplate struct { name string } -func NewStepDeployTemplate(client *AzureClient, ui packer.Ui, config *Config, deploymentName string, factory templateFactoryFunc) *StepDeployTemplate { +func NewStepDeployTemplate(client *AzureClient, ui packersdk.Ui, config *Config, deploymentName string, factory templateFactoryFunc) *StepDeployTemplate { var step = &StepDeployTemplate{ client: client, say: func(message string) { ui.Say(message) }, @@ -73,7 +73,7 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("\nThe resource group was not created by Packer, deleting individual resources ...") deploymentName := s.name @@ -109,7 +109,7 @@ func (s *StepDeployTemplate) deployTemplate(ctx context.Context, resourceGroupNa func (s *StepDeployTemplate) deleteTemplate(ctx context.Context, state multistep.StateBag) error { deploymentName := s.name resourceGroupName := state.Get(constants.ArmResourceGroupName).(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Removing the created Deployment object: '%s'", deploymentName)) f, err := s.client.DeploymentsClient.Delete(ctx, resourceGroupName, deploymentName) diff --git a/builder/azure/arm/step_get_additional_disks.go b/builder/azure/arm/step_get_additional_disks.go index 51468a3cd..f1131a907 100644 --- a/builder/azure/arm/step_get_additional_disks.go +++ b/builder/azure/arm/step_get_additional_disks.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepGetDataDisk struct { @@ -19,7 +19,7 @@ type StepGetDataDisk struct { error func(e error) } -func NewStepGetAdditionalDisks(client *AzureClient, ui packer.Ui) *StepGetDataDisk { +func NewStepGetAdditionalDisks(client *AzureClient, ui packersdk.Ui) *StepGetDataDisk { var step = &StepGetDataDisk{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_get_certificate.go b/builder/azure/arm/step_get_certificate.go index ca19b262e..26f1b49a5 100644 --- a/builder/azure/arm/step_get_certificate.go +++ b/builder/azure/arm/step_get_certificate.go @@ -6,8 +6,8 @@ import ( "time" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepGetCertificate struct { @@ -18,7 +18,7 @@ type StepGetCertificate struct { pause func() } -func NewStepGetCertificate(client *AzureClient, ui packer.Ui) *StepGetCertificate { +func NewStepGetCertificate(client *AzureClient, ui packersdk.Ui) *StepGetCertificate { var step = &StepGetCertificate{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_get_ip_address.go b/builder/azure/arm/step_get_ip_address.go index 03620ae00..b284441e6 100644 --- a/builder/azure/arm/step_get_ip_address.go +++ b/builder/azure/arm/step_get_ip_address.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type EndpointType int @@ -33,7 +33,7 @@ type StepGetIPAddress struct { error func(e error) } -func NewStepGetIPAddress(client *AzureClient, ui packer.Ui, endpoint EndpointType) *StepGetIPAddress { +func NewStepGetIPAddress(client *AzureClient, ui packersdk.Ui, endpoint EndpointType) *StepGetIPAddress { var step = &StepGetIPAddress{ client: client, endpoint: endpoint, diff --git a/builder/azure/arm/step_get_os_disk.go b/builder/azure/arm/step_get_os_disk.go index 78eda273b..1fb177472 100644 --- a/builder/azure/arm/step_get_os_disk.go +++ b/builder/azure/arm/step_get_os_disk.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepGetOSDisk struct { @@ -19,7 +19,7 @@ type StepGetOSDisk struct { error func(e error) } -func NewStepGetOSDisk(client *AzureClient, ui packer.Ui) *StepGetOSDisk { +func NewStepGetOSDisk(client *AzureClient, ui packersdk.Ui) *StepGetOSDisk { var step = &StepGetOSDisk{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_power_off_compute.go b/builder/azure/arm/step_power_off_compute.go index f6100ae9a..b7af984fc 100644 --- a/builder/azure/arm/step_power_off_compute.go +++ b/builder/azure/arm/step_power_off_compute.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepPowerOffCompute struct { @@ -16,7 +16,7 @@ type StepPowerOffCompute struct { error func(e error) } -func NewStepPowerOffCompute(client *AzureClient, ui packer.Ui) *StepPowerOffCompute { +func NewStepPowerOffCompute(client *AzureClient, ui packersdk.Ui) *StepPowerOffCompute { var step = &StepPowerOffCompute{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_publish_to_shared_image_gallery.go b/builder/azure/arm/step_publish_to_shared_image_gallery.go index ed7f050b9..5b81d229d 100644 --- a/builder/azure/arm/step_publish_to_shared_image_gallery.go +++ b/builder/azure/arm/step_publish_to_shared_image_gallery.go @@ -7,8 +7,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute" "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepPublishToSharedImageGallery struct { @@ -19,7 +19,7 @@ type StepPublishToSharedImageGallery struct { toSIG func() bool } -func NewStepPublishToSharedImageGallery(client *AzureClient, ui packer.Ui, config *Config) *StepPublishToSharedImageGallery { +func NewStepPublishToSharedImageGallery(client *AzureClient, ui packersdk.Ui, config *Config) *StepPublishToSharedImageGallery { var step = &StepPublishToSharedImageGallery{ client: client, say: func(message string) { diff --git a/builder/azure/arm/step_set_certificate.go b/builder/azure/arm/step_set_certificate.go index 563cc55c1..285f0e19a 100644 --- a/builder/azure/arm/step_set_certificate.go +++ b/builder/azure/arm/step_set_certificate.go @@ -4,8 +4,8 @@ import ( "context" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSetCertificate struct { @@ -14,7 +14,7 @@ type StepSetCertificate struct { error func(e error) } -func NewStepSetCertificate(config *Config, ui packer.Ui) *StepSetCertificate { +func NewStepSetCertificate(config *Config, ui packersdk.Ui) *StepSetCertificate { var step = &StepSetCertificate{ config: config, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_snapshot_data_disks.go b/builder/azure/arm/step_snapshot_data_disks.go index 63e9b0f71..5fc2a263d 100644 --- a/builder/azure/arm/step_snapshot_data_disks.go +++ b/builder/azure/arm/step_snapshot_data_disks.go @@ -8,8 +8,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSnapshotDataDisks struct { @@ -20,7 +20,7 @@ type StepSnapshotDataDisks struct { enable func() bool } -func NewStepSnapshotDataDisks(client *AzureClient, ui packer.Ui, config *Config) *StepSnapshotDataDisks { +func NewStepSnapshotDataDisks(client *AzureClient, ui packersdk.Ui, config *Config) *StepSnapshotDataDisks { var step = &StepSnapshotDataDisks{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_snapshot_os_disk.go b/builder/azure/arm/step_snapshot_os_disk.go index bc84d0d94..9aa1bf00b 100644 --- a/builder/azure/arm/step_snapshot_os_disk.go +++ b/builder/azure/arm/step_snapshot_os_disk.go @@ -7,8 +7,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSnapshotOSDisk struct { @@ -19,7 +19,7 @@ type StepSnapshotOSDisk struct { enable func() bool } -func NewStepSnapshotOSDisk(client *AzureClient, ui packer.Ui, config *Config) *StepSnapshotOSDisk { +func NewStepSnapshotOSDisk(client *AzureClient, ui packersdk.Ui, config *Config) *StepSnapshotOSDisk { var step = &StepSnapshotOSDisk{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/arm/step_validate_template.go b/builder/azure/arm/step_validate_template.go index 4f3204659..cd09bba69 100644 --- a/builder/azure/arm/step_validate_template.go +++ b/builder/azure/arm/step_validate_template.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepValidateTemplate struct { @@ -18,7 +18,7 @@ type StepValidateTemplate struct { factory templateFactoryFunc } -func NewStepValidateTemplate(client *AzureClient, ui packer.Ui, config *Config, factory templateFactoryFunc) *StepValidateTemplate { +func NewStepValidateTemplate(client *AzureClient, ui packersdk.Ui, config *Config, factory templateFactoryFunc) *StepValidateTemplate { var step = &StepValidateTemplate{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/chroot/builder.go b/builder/azure/chroot/builder.go index 58e146d3e..b0d0c83e4 100644 --- a/builder/azure/chroot/builder.go +++ b/builder/azure/chroot/builder.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -392,7 +393,7 @@ func checkHyperVGeneration(s string) interface{} { s, compute.PossibleHyperVGenerationValues()) } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { switch runtime.GOOS { case "linux", "freebsd": break diff --git a/builder/azure/chroot/packerui_test.go b/builder/azure/chroot/packerui_test.go index af7b250ec..fb2435a18 100644 --- a/builder/azure/chroot/packerui_test.go +++ b/builder/azure/chroot/packerui_test.go @@ -5,10 +5,11 @@ import ( "strings" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // testUI returns a test ui plus a function to retrieve the errors written to the ui -func testUI() (packer.Ui, func() string) { +func testUI() (packersdk.Ui, func() string) { errorBuffer := &strings.Builder{} ui := &packer.BasicUi{ Reader: strings.NewReader(""), diff --git a/builder/azure/chroot/step_attach_disk.go b/builder/azure/chroot/step_attach_disk.go index 53a0b16c3..1fe61051f 100644 --- a/builder/azure/chroot/step_attach_disk.go +++ b/builder/azure/chroot/step_attach_disk.go @@ -7,8 +7,8 @@ import ( "time" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var _ multistep.Step = &StepAttachDisk{} @@ -19,7 +19,7 @@ type StepAttachDisk struct { func (s *StepAttachDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) diskset := state.Get(stateBagKey_Diskset).(Diskset) diskResourceID := diskset.OS().String() @@ -57,7 +57,7 @@ func (s *StepAttachDisk) Run(ctx context.Context, state multistep.StateBag) mult } func (s *StepAttachDisk) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } @@ -67,7 +67,7 @@ func (s *StepAttachDisk) CleanupFunc(state multistep.StateBag) error { if s.attached { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) diskset := state.Get(stateBagKey_Diskset).(Diskset) diskResourceID := diskset.OS().String() diff --git a/builder/azure/chroot/step_create_image.go b/builder/azure/chroot/step_create_image.go index 952374f7d..d52dee3ee 100644 --- a/builder/azure/chroot/step_create_image.go +++ b/builder/azure/chroot/step_create_image.go @@ -10,8 +10,8 @@ import ( "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var _ multistep.Step = &StepCreateImage{} @@ -28,7 +28,7 @@ type StepCreateImage struct { func (s *StepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) diskset := state.Get(stateBagKey_Diskset).(Diskset) diskResourceID := diskset.OS().String() diff --git a/builder/azure/chroot/step_create_new_diskset.go b/builder/azure/chroot/step_create_new_diskset.go index ad690ecad..9749bd31a 100644 --- a/builder/azure/chroot/step_create_new_diskset.go +++ b/builder/azure/chroot/step_create_new_diskset.go @@ -8,8 +8,8 @@ import ( "time" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" @@ -44,7 +44,7 @@ type StepCreateNewDiskset struct { func (s *StepCreateNewDiskset) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) s.disks = make(Diskset) @@ -214,7 +214,7 @@ func (s StepCreateNewDiskset) getDatadiskDefinitionFromImage(lun int32) compute. func (s *StepCreateNewDiskset) Cleanup(state multistep.StateBag) { if !s.SkipCleanup { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) for _, d := range s.disks { diff --git a/builder/azure/chroot/step_create_shared_image_version.go b/builder/azure/chroot/step_create_shared_image_version.go index d32da7e92..68db7fb9f 100644 --- a/builder/azure/chroot/step_create_shared_image_version.go +++ b/builder/azure/chroot/step_create_shared_image_version.go @@ -10,8 +10,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateSharedImageVersion struct { @@ -23,7 +23,7 @@ type StepCreateSharedImageVersion struct { func (s *StepCreateSharedImageVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) snapshotset := state.Get(stateBagKey_Snapshotset).(Diskset) ui.Say(fmt.Sprintf("Creating image version %s\n using %q for os disk.", diff --git a/builder/azure/chroot/step_create_snapshotset.go b/builder/azure/chroot/step_create_snapshotset.go index 6af98710a..f742e9dbe 100644 --- a/builder/azure/chroot/step_create_snapshotset.go +++ b/builder/azure/chroot/step_create_snapshotset.go @@ -8,8 +8,8 @@ import ( "time" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" @@ -29,7 +29,7 @@ type StepCreateSnapshotset struct { func (s *StepCreateSnapshotset) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) diskset := state.Get(stateBagKey_Diskset).(Diskset) s.snapshots = make(Diskset) @@ -92,7 +92,7 @@ func (s *StepCreateSnapshotset) Run(ctx context.Context, state multistep.StateBa func (s *StepCreateSnapshotset) Cleanup(state multistep.StateBag) { if !s.SkipCleanup { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) for _, resource := range s.snapshots { diff --git a/builder/azure/chroot/step_mount_device.go b/builder/azure/chroot/step_mount_device.go index 315b61d5b..9c535bd22 100644 --- a/builder/azure/chroot/step_mount_device.go +++ b/builder/azure/chroot/step_mount_device.go @@ -12,9 +12,9 @@ import ( "runtime" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -29,7 +29,7 @@ type StepMountDevice struct { } func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := state.Get("device").(string) config := state.Get("config").(*Config) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) @@ -110,7 +110,7 @@ func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) mul } func (s *StepMountDevice) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } @@ -121,7 +121,7 @@ func (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error { return nil } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) ui.Say("Unmounting the root device...") diff --git a/builder/azure/chroot/step_resolve_plaform_image_version.go b/builder/azure/chroot/step_resolve_plaform_image_version.go index d0f4a9ed2..cf5b3363b 100644 --- a/builder/azure/chroot/step_resolve_plaform_image_version.go +++ b/builder/azure/chroot/step_resolve_plaform_image_version.go @@ -8,8 +8,8 @@ import ( "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepResolvePlatformImageVersion resolves the exact PIR version when the version is 'latest' @@ -20,7 +20,7 @@ type StepResolvePlatformImageVersion struct { // Run retrieves all available versions of a PIR image and stores the latest in the PlatformImage func (pi *StepResolvePlatformImageVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if strings.EqualFold(pi.Version, "latest") { azcli := state.Get("azureclient").(client.AzureClientSet) diff --git a/builder/azure/chroot/step_verify_shared_image_destination.go b/builder/azure/chroot/step_verify_shared_image_destination.go index 156e8413f..ac2da44ca 100644 --- a/builder/azure/chroot/step_verify_shared_image_destination.go +++ b/builder/azure/chroot/step_verify_shared_image_destination.go @@ -9,8 +9,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var _ multistep.Step = &StepVerifySharedImageDestination{} @@ -25,7 +25,7 @@ type StepVerifySharedImageDestination struct { // Run retrieves the image metadata from Azure and compares the location to Location. Verifies the OS Type. func (s *StepVerifySharedImageDestination) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMessage := func(message string, parameters ...interface{}) multistep.StepAction { err := fmt.Errorf(message, parameters...) diff --git a/builder/azure/chroot/step_verify_shared_image_source.go b/builder/azure/chroot/step_verify_shared_image_source.go index 5f6d243c6..3c29aa177 100644 --- a/builder/azure/chroot/step_verify_shared_image_source.go +++ b/builder/azure/chroot/step_verify_shared_image_source.go @@ -9,8 +9,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var _ multistep.Step = &StepVerifySharedImageSource{} @@ -26,7 +26,7 @@ type StepVerifySharedImageSource struct { // Run retrieves the image metadata from Azure and compares the location to Location. Verifies the OS Type. func (s *StepVerifySharedImageSource) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMessage := func(message string, parameters ...interface{}) multistep.StepAction { err := fmt.Errorf(message, parameters...) diff --git a/builder/azure/chroot/step_verify_source_disk.go b/builder/azure/chroot/step_verify_source_disk.go index 1bf65a436..2aa19dc68 100644 --- a/builder/azure/chroot/step_verify_source_disk.go +++ b/builder/azure/chroot/step_verify_source_disk.go @@ -10,8 +10,8 @@ import ( "github.com/Azure/go-autorest/autorest/to" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepVerifySourceDisk struct { @@ -21,7 +21,7 @@ type StepVerifySourceDisk struct { func (s StepVerifySourceDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { azcli := state.Get("azureclient").(client.AzureClientSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Checking source disk location") resource, err := azure.ParseResourceID(s.SourceDiskResourceID) diff --git a/builder/azure/chroot/step_verify_source_disk_test.go b/builder/azure/chroot/step_verify_source_disk_test.go index d0149a439..6f6084d93 100644 --- a/builder/azure/chroot/step_verify_source_disk_test.go +++ b/builder/azure/chroot/step_verify_source_disk_test.go @@ -12,8 +12,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func Test_StepVerifySourceDisk_Run(t *testing.T) { @@ -152,6 +152,6 @@ func Test_StepVerifySourceDisk_Run(t *testing.T) { } type uiThatRemebersErrors struct { - packer.Ui + packersdk.Ui LastError string } diff --git a/builder/azure/dtl/builder.go b/builder/azure/dtl/builder.go index ad32a4d83..4d1eb516a 100644 --- a/builder/azure/dtl/builder.go +++ b/builder/azure/dtl/builder.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Builder struct { @@ -51,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, errs } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { ui.Say("Running builder ...") @@ -261,7 +262,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack return &Artifact{}, nil } -func (b *Builder) writeSSHPrivateKey(ui packer.Ui, debugKeyPath string) { +func (b *Builder) writeSSHPrivateKey(ui packersdk.Ui, debugKeyPath string) { f, err := os.Create(debugKeyPath) if err != nil { ui.Say(fmt.Sprintf("Error saving debug key: %s", err)) @@ -323,7 +324,7 @@ func (b *Builder) getServicePrincipalToken(say func(string)) (*adal.ServicePrinc return b.config.ClientConfig.GetServicePrincipalToken(say, b.config.ClientConfig.CloudEnvironment().ResourceManagerEndpoint) } -func (b *Builder) getSubnetInformation(ctx context.Context, ui packer.Ui, azClient AzureClient) (*string, *string, error) { +func (b *Builder) getSubnetInformation(ctx context.Context, ui packersdk.Ui, azClient AzureClient) (*string, *string, error) { num := int32(10) virtualNetworkPage, err := azClient.DtlVirtualNetworksClient.List(ctx, b.config.LabResourceGroupName, b.config.LabName, "", "", &num, "") @@ -346,7 +347,7 @@ func (b *Builder) getSubnetInformation(ctx context.Context, ui packer.Ui, azClie return nil, nil, fmt.Errorf("No available Subnet with available space in resource group %s", b.config.LabResourceGroupName) } -func getObjectIdFromToken(ui packer.Ui, token *adal.ServicePrincipalToken) string { +func getObjectIdFromToken(ui packersdk.Ui, token *adal.ServicePrincipalToken) string { claims := jwt.MapClaims{} var p jwt.Parser diff --git a/builder/azure/dtl/step_capture_image.go b/builder/azure/dtl/step_capture_image.go index 6e0f84fb3..da01d2f3e 100644 --- a/builder/azure/dtl/step_capture_image.go +++ b/builder/azure/dtl/step_capture_image.go @@ -7,8 +7,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCaptureImage struct { @@ -20,7 +20,7 @@ type StepCaptureImage struct { error func(e error) } -func NewStepCaptureImage(client *AzureClient, ui packer.Ui, config *Config) *StepCaptureImage { +func NewStepCaptureImage(client *AzureClient, ui packersdk.Ui, config *Config) *StepCaptureImage { var step = &StepCaptureImage{ client: client, get: func(client *AzureClient) *CaptureTemplate { diff --git a/builder/azure/dtl/step_delete_virtual_machine.go b/builder/azure/dtl/step_delete_virtual_machine.go index d85d18407..d0d6f3a66 100644 --- a/builder/azure/dtl/step_delete_virtual_machine.go +++ b/builder/azure/dtl/step_delete_virtual_machine.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDeleteVirtualMachine struct { @@ -17,7 +17,7 @@ type StepDeleteVirtualMachine struct { error func(e error) } -func NewStepDeleteVirtualMachine(client *AzureClient, ui packer.Ui, config *Config) *StepDeleteVirtualMachine { +func NewStepDeleteVirtualMachine(client *AzureClient, ui packersdk.Ui, config *Config) *StepDeleteVirtualMachine { var step = &StepDeleteVirtualMachine{ client: client, config: config, diff --git a/builder/azure/dtl/step_deploy_template.go b/builder/azure/dtl/step_deploy_template.go index cae494bd6..9c1b3ae58 100644 --- a/builder/azure/dtl/step_deploy_template.go +++ b/builder/azure/dtl/step_deploy_template.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDeployTemplate struct { @@ -25,7 +25,7 @@ type StepDeployTemplate struct { name string } -func NewStepDeployTemplate(client *AzureClient, ui packer.Ui, config *Config, deploymentName string, factory templateFactoryFuncDtl) *StepDeployTemplate { +func NewStepDeployTemplate(client *AzureClient, ui packersdk.Ui, config *Config, deploymentName string, factory templateFactoryFuncDtl) *StepDeployTemplate { var step = &StepDeployTemplate{ client: client, say: func(message string) { ui.Say(message) }, diff --git a/builder/azure/dtl/step_power_off_compute.go b/builder/azure/dtl/step_power_off_compute.go index 2bc224c34..3504149f2 100644 --- a/builder/azure/dtl/step_power_off_compute.go +++ b/builder/azure/dtl/step_power_off_compute.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepPowerOffCompute struct { @@ -17,7 +17,7 @@ type StepPowerOffCompute struct { error func(e error) } -func NewStepPowerOffCompute(client *AzureClient, ui packer.Ui, config *Config) *StepPowerOffCompute { +func NewStepPowerOffCompute(client *AzureClient, ui packersdk.Ui, config *Config) *StepPowerOffCompute { var step = &StepPowerOffCompute{ client: client, diff --git a/builder/azure/dtl/step_publish_to_shared_image_gallery.go b/builder/azure/dtl/step_publish_to_shared_image_gallery.go index e4c6d8231..3fa62523d 100644 --- a/builder/azure/dtl/step_publish_to_shared_image_gallery.go +++ b/builder/azure/dtl/step_publish_to_shared_image_gallery.go @@ -6,8 +6,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute" "github.com/hashicorp/packer/builder/azure/common/constants" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepPublishToSharedImageGallery struct { @@ -18,7 +18,7 @@ type StepPublishToSharedImageGallery struct { toSIG func() bool } -func NewStepPublishToSharedImageGallery(client *AzureClient, ui packer.Ui, config *Config) *StepPublishToSharedImageGallery { +func NewStepPublishToSharedImageGallery(client *AzureClient, ui packersdk.Ui, config *Config) *StepPublishToSharedImageGallery { var step = &StepPublishToSharedImageGallery{ client: client, say: func(message string) { diff --git a/builder/cloudstack/builder.go b/builder/cloudstack/builder.go index 9dde567e3..302323da3 100644 --- a/builder/cloudstack/builder.go +++ b/builder/cloudstack/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -18,7 +19,7 @@ const BuilderId = "packer.cloudstack" type Builder struct { config Config runner multistep.Runner - ui packer.Ui + ui packersdk.Ui } func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } @@ -33,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { } // Run implements the packer.Builder interface. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { b.ui = ui // Create a CloudStack API client. diff --git a/builder/cloudstack/step_configure_networking.go b/builder/cloudstack/step_configure_networking.go index 7de5a0a35..44ea28bdf 100644 --- a/builder/cloudstack/step_configure_networking.go +++ b/builder/cloudstack/step_configure_networking.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -20,7 +20,7 @@ type stepSetupNetworking struct { func (s *stepSetupNetworking) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Setup networking...") @@ -188,7 +188,7 @@ func (s *stepSetupNetworking) Run(ctx context.Context, state multistep.StateBag) // Cleanup any resources that may have been created during the Run phase. func (s *stepSetupNetworking) Cleanup(state multistep.StateBag) { client := state.Get("client").(*cloudstack.CloudStackClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cleanup networking...") diff --git a/builder/cloudstack/step_create_instance.go b/builder/cloudstack/step_create_instance.go index 682f0659b..0636b5723 100644 --- a/builder/cloudstack/step_create_instance.go +++ b/builder/cloudstack/step_create_instance.go @@ -8,8 +8,8 @@ import ( "net" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -30,7 +30,7 @@ type stepCreateInstance struct { func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating instance...") @@ -169,7 +169,7 @@ func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) func (s *stepCreateInstance) Cleanup(state multistep.StateBag) { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceID, ok := state.Get("instance_id").(string) if !ok || instanceID == "" { diff --git a/builder/cloudstack/step_create_security_group.go b/builder/cloudstack/step_create_security_group.go index e479d0558..25772e178 100644 --- a/builder/cloudstack/step_create_security_group.go +++ b/builder/cloudstack/step_create_security_group.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -17,7 +17,7 @@ type stepCreateSecurityGroup struct { func (s *stepCreateSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(config.SecurityGroups) > 0 { state.Put("security_groups", config.SecurityGroups) @@ -75,7 +75,7 @@ func (s *stepCreateSecurityGroup) Run(ctx context.Context, state multistep.State func (s *stepCreateSecurityGroup) Cleanup(state multistep.StateBag) { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.tempSG == "" { return diff --git a/builder/cloudstack/step_create_template.go b/builder/cloudstack/step_create_template.go index f3f0ad03f..1ed8e7420 100644 --- a/builder/cloudstack/step_create_template.go +++ b/builder/cloudstack/step_create_template.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -15,7 +15,7 @@ type stepCreateTemplate struct{} func (s *stepCreateTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Creating template: %s", config.TemplateName)) diff --git a/builder/cloudstack/step_detach_iso.go b/builder/cloudstack/step_detach_iso.go index 9e0a17d7c..2e6028ba4 100644 --- a/builder/cloudstack/step_detach_iso.go +++ b/builder/cloudstack/step_detach_iso.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -14,7 +14,7 @@ type stepDetachIso struct{} // Detaches currently ISO file attached to a virtual machine if any. func (s *stepDetachIso) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) // Check if state uses iso file and has need to eject it diff --git a/builder/cloudstack/step_keypair.go b/builder/cloudstack/step_keypair.go index 41761c976..6e0935416 100644 --- a/builder/cloudstack/step_keypair.go +++ b/builder/cloudstack/step_keypair.go @@ -7,8 +7,8 @@ import ( "runtime" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -19,7 +19,7 @@ type stepKeypair struct { } func (s *stepKeypair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") @@ -119,7 +119,7 @@ func (s *stepKeypair) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*cloudstack.CloudStackClient) cfg := state.Get("config").(*Config) diff --git a/builder/cloudstack/step_prepare_config.go b/builder/cloudstack/step_prepare_config.go index f7cbcd637..5b40e7bb7 100644 --- a/builder/cloudstack/step_prepare_config.go +++ b/builder/cloudstack/step_prepare_config.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -16,7 +17,7 @@ type stepPrepareConfig struct{} func (s *stepPrepareConfig) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Preparing config...") diff --git a/builder/cloudstack/step_shutdown_instance.go b/builder/cloudstack/step_shutdown_instance.go index c14a41f82..c96b51bf2 100644 --- a/builder/cloudstack/step_shutdown_instance.go +++ b/builder/cloudstack/step_shutdown_instance.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/xanzy/go-cloudstack/cloudstack" ) @@ -14,7 +14,7 @@ type stepShutdownInstance struct{} func (s *stepShutdownInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*cloudstack.CloudStackClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Shutting down instance...") diff --git a/builder/digitalocean/builder.go b/builder/digitalocean/builder.go index 76cf9fbc3..f812ca39b 100644 --- a/builder/digitalocean/builder.go +++ b/builder/digitalocean/builder.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/oauth2" ) @@ -37,7 +38,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { client := godo.NewClient(oauth2.NewClient(context.TODO(), &apiTokenSource{ AccessToken: b.config.APIToken, })) diff --git a/builder/digitalocean/step_create_droplet.go b/builder/digitalocean/step_create_droplet.go index e24a4de46..8a83caaeb 100644 --- a/builder/digitalocean/step_create_droplet.go +++ b/builder/digitalocean/step_create_droplet.go @@ -9,8 +9,8 @@ import ( "io/ioutil" "github.com/digitalocean/godo" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateDroplet struct { @@ -19,7 +19,7 @@ type stepCreateDroplet struct { func (s *stepCreateDroplet) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) sshKeyId := state.Get("ssh_key_id").(int) @@ -84,7 +84,7 @@ func (s *stepCreateDroplet) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*godo.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Destroy the droplet we just created ui.Say("Destroying droplet...") diff --git a/builder/digitalocean/step_create_ssh_key.go b/builder/digitalocean/step_create_ssh_key.go index 36eaf0ed3..911d28484 100644 --- a/builder/digitalocean/step_create_ssh_key.go +++ b/builder/digitalocean/step_create_ssh_key.go @@ -12,8 +12,8 @@ import ( "runtime" "github.com/digitalocean/godo" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" "golang.org/x/crypto/ssh" ) @@ -27,7 +27,7 @@ type stepCreateSSHKey struct { func (s *stepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) ui.Say("Creating temporary ssh key for droplet...") @@ -114,7 +114,7 @@ func (s *stepCreateSSHKey) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*godo.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting temporary ssh key...") _, err := client.Keys.DeleteByID(context.TODO(), s.keyId) diff --git a/builder/digitalocean/step_droplet_info.go b/builder/digitalocean/step_droplet_info.go index 44e5f5e4e..9ca1fd65b 100644 --- a/builder/digitalocean/step_droplet_info.go +++ b/builder/digitalocean/step_droplet_info.go @@ -5,15 +5,15 @@ import ( "fmt" "github.com/digitalocean/godo" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepDropletInfo struct{} func (s *stepDropletInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) dropletID := state.Get("droplet_id").(int) diff --git a/builder/digitalocean/step_power_off.go b/builder/digitalocean/step_power_off.go index f75fe898b..d72ba4bda 100644 --- a/builder/digitalocean/step_power_off.go +++ b/builder/digitalocean/step_power_off.go @@ -6,8 +6,8 @@ import ( "log" "github.com/digitalocean/godo" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepPowerOff struct{} @@ -15,7 +15,7 @@ type stepPowerOff struct{} func (s *stepPowerOff) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) dropletId := state.Get("droplet_id").(int) droplet, _, err := client.Droplets.Get(context.TODO(), dropletId) diff --git a/builder/digitalocean/step_shutdown.go b/builder/digitalocean/step_shutdown.go index 8076ad539..a49524eed 100644 --- a/builder/digitalocean/step_shutdown.go +++ b/builder/digitalocean/step_shutdown.go @@ -7,8 +7,8 @@ import ( "time" "github.com/digitalocean/godo" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepShutdown struct{} @@ -16,7 +16,7 @@ type stepShutdown struct{} func (s *stepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) dropletId := state.Get("droplet_id").(int) // Gracefully power off the droplet. We have to retry this a number diff --git a/builder/digitalocean/step_snapshot.go b/builder/digitalocean/step_snapshot.go index b28a5e38c..c87be05e5 100644 --- a/builder/digitalocean/step_snapshot.go +++ b/builder/digitalocean/step_snapshot.go @@ -8,8 +8,8 @@ import ( "time" "github.com/digitalocean/godo" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepSnapshot struct { @@ -18,7 +18,7 @@ type stepSnapshot struct { func (s *stepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*godo.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) dropletId := state.Get("droplet_id").(int) var snapshotRegions []string diff --git a/builder/docker/builder.go b/builder/docker/builder.go index 87b29680e..d4f8569c2 100644 --- a/builder/docker/builder.go +++ b/builder/docker/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" ) @@ -35,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { }, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { driver := &DockerDriver{Ctx: &b.config.ctx, Ui: ui} if err := driver.Verify(); err != nil { return nil, err diff --git a/builder/docker/driver_docker.go b/builder/docker/driver_docker.go index 81058a754..3d1cb7d11 100644 --- a/builder/docker/driver_docker.go +++ b/builder/docker/driver_docker.go @@ -12,12 +12,12 @@ import ( "sync" "github.com/hashicorp/go-version" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) type DockerDriver struct { - Ui packer.Ui + Ui packersdk.Ui Ctx *interpolate.Context l sync.Mutex diff --git a/builder/docker/exec.go b/builder/docker/exec.go index 309fdcc5d..1b5375c12 100644 --- a/builder/docker/exec.go +++ b/builder/docker/exec.go @@ -3,11 +3,11 @@ package docker import ( "os/exec" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/shell-local/localexec" ) -func runAndStream(cmd *exec.Cmd, ui packer.Ui) error { +func runAndStream(cmd *exec.Cmd, ui packersdk.Ui) error { args := make([]string, len(cmd.Args)-1) copy(args, cmd.Args[1:]) diff --git a/builder/docker/step_commit.go b/builder/docker/step_commit.go index ca5948336..8ef4012b6 100644 --- a/builder/docker/step_commit.go +++ b/builder/docker/step_commit.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCommit commits the container to a image. @@ -14,7 +14,7 @@ type StepCommit struct { } func (s *StepCommit) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config, ok := state.Get("config").(*Config) if !ok { err := fmt.Errorf("error encountered obtaining docker config") diff --git a/builder/docker/step_export.go b/builder/docker/step_export.go index 107761ce8..9bdbe1ba3 100644 --- a/builder/docker/step_export.go +++ b/builder/docker/step_export.go @@ -6,15 +6,15 @@ import ( "os" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepExport exports the container to a flat tar file. type StepExport struct{} func (s *StepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config, ok := state.Get("config").(*Config) if !ok { err := fmt.Errorf("error encountered obtaining docker config") diff --git a/builder/docker/step_pull.go b/builder/docker/step_pull.go index b18d01444..b13e94489 100644 --- a/builder/docker/step_pull.go +++ b/builder/docker/step_pull.go @@ -5,14 +5,14 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepPull struct{} func (s *StepPull) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config, ok := state.Get("config").(*Config) if !ok { err := fmt.Errorf("error encountered obtaining docker config") diff --git a/builder/docker/step_run.go b/builder/docker/step_run.go index ce9c46a40..00bfd212f 100644 --- a/builder/docker/step_run.go +++ b/builder/docker/step_run.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRun struct { @@ -13,7 +13,7 @@ type StepRun struct { } func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config, ok := state.Get("config").(*Config) if !ok { err := fmt.Errorf("error encountered obtaining docker config") @@ -66,7 +66,7 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Kill the container. We don't handle errors because errors usually // just mean that the container doesn't exist anymore, which isn't a diff --git a/builder/docker/step_temp_dir.go b/builder/docker/step_temp_dir.go index 9879939d7..3f7e44739 100644 --- a/builder/docker/step_temp_dir.go +++ b/builder/docker/step_temp_dir.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepTempDir creates a temporary directory that we use in order to @@ -55,7 +56,7 @@ func ConfigTmpDir() (string, error) { } func (s *StepTempDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating a temporary directory for sharing data...") diff --git a/builder/file/builder.go b/builder/file/builder.go index f2a8d2969..5b096ce0a 100644 --- a/builder/file/builder.go +++ b/builder/file/builder.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const BuilderId = "packer.file" @@ -37,7 +38,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { } // Run is where the actual build should take place. It takes a Build and a Ui. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { artifact := new(FileArtifact) // Create all directories leading to target diff --git a/builder/googlecompute/builder.go b/builder/googlecompute/builder.go index f3b73d0ef..e1fe4184c 100644 --- a/builder/googlecompute/builder.go +++ b/builder/googlecompute/builder.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // The unique ID for this builder. @@ -35,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a googlecompute Packer build and returns a packer.Artifact // representing a GCE machine image. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { cfg := GCEDriverConfig{ Ui: ui, ProjectId: b.config.ProjectId, diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index 5ade084c2..a00f4fe77 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/builder/googlecompute/version" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/useragent" vaultapi "github.com/hashicorp/vault/api" @@ -33,11 +34,11 @@ type driverGCE struct { projectId string service *compute.Service osLoginService *oslogin.Service - ui packer.Ui + ui packersdk.Ui } type GCEDriverConfig struct { - Ui packer.Ui + Ui packersdk.Ui ProjectId string Account *ServiceAccount ImpersonateServiceAccountName string diff --git a/builder/googlecompute/step_check_existing_image.go b/builder/googlecompute/step_check_existing_image.go index faabae456..a57461dda 100644 --- a/builder/googlecompute/step_check_existing_image.go +++ b/builder/googlecompute/step_check_existing_image.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCheckExistingImage represents a Packer build step that checks if the @@ -16,7 +16,7 @@ type StepCheckExistingImage int func (s *StepCheckExistingImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) d := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Checking image does not exist...") c.imageAlreadyExists = d.ImageExists(c.ImageName) diff --git a/builder/googlecompute/step_create_image.go b/builder/googlecompute/step_create_image.go index 0c37d6acf..2c28c3a50 100644 --- a/builder/googlecompute/step_create_image.go +++ b/builder/googlecompute/step_create_image.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCreateImage represents a Packer build step that creates GCE machine @@ -21,7 +21,7 @@ type StepCreateImage int func (s *StepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if config.SkipCreateImage { ui.Say("Skipping image creation...") diff --git a/builder/googlecompute/step_create_instance.go b/builder/googlecompute/step_create_instance.go index 371fee64a..cc71687bc 100644 --- a/builder/googlecompute/step_create_instance.go +++ b/builder/googlecompute/step_create_instance.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCreateInstance represents a Packer build step that creates GCE instances. @@ -104,7 +105,7 @@ func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag) c := state.Get("config").(*Config) d := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) sourceImage, err := getImage(c, d) if err != nil { @@ -215,7 +216,7 @@ func (s *StepCreateInstance) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting instance...") errCh, err := driver.DeleteInstance(config.Zone, name) diff --git a/builder/googlecompute/step_create_windows_password.go b/builder/googlecompute/step_create_windows_password.go index d86116091..54d6f75e5 100644 --- a/builder/googlecompute/step_create_windows_password.go +++ b/builder/googlecompute/step_create_windows_password.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCreateWindowsPassword represents a Packer build step that sets the windows password on a Windows GCE instance. @@ -25,7 +26,7 @@ type StepCreateWindowsPassword struct { // Run executes the Packer build step that sets the windows password on a Windows GCE instance. func (s *StepCreateWindowsPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) d := state.Get("driver").(Driver) c := state.Get("config").(*Config) name := state.Get("instance_name").(string) diff --git a/builder/googlecompute/step_import_os_login_ssh_key.go b/builder/googlecompute/step_import_os_login_ssh_key.go index 833e73fb0..576aab376 100644 --- a/builder/googlecompute/step_import_os_login_ssh_key.go +++ b/builder/googlecompute/step_import_os_login_ssh_key.go @@ -6,8 +6,8 @@ import ( "encoding/hex" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "google.golang.org/api/oauth2/v2" ) @@ -23,7 +23,7 @@ type StepImportOSLoginSSHKey struct { func (s *StepImportOSLoginSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !config.UseOSLogin { return multistep.ActionContinue @@ -100,7 +100,7 @@ func (s *StepImportOSLoginSSHKey) Run(ctx context.Context, state multistep.State func (s *StepImportOSLoginSSHKey) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !config.UseOSLogin { return diff --git a/builder/googlecompute/step_instance_info.go b/builder/googlecompute/step_instance_info.go index cd388df9f..471c37274 100644 --- a/builder/googlecompute/step_instance_info.go +++ b/builder/googlecompute/step_instance_info.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepInstanceInfo represents a Packer build step that gathers GCE instance info. @@ -20,7 +20,7 @@ type StepInstanceInfo struct { func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceName := state.Get("instance_name").(string) diff --git a/builder/googlecompute/step_start_tunnel.go b/builder/googlecompute/step_start_tunnel.go index bda9e8d32..2c6d02ddd 100644 --- a/builder/googlecompute/step_start_tunnel.go +++ b/builder/googlecompute/step_start_tunnel.go @@ -19,9 +19,9 @@ import ( "time" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -257,7 +257,7 @@ func (s *StepStartTunnel) Run(ctx context.Context, state multistep.StateBag) mul } // shell out to create the tunnel. - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceName := state.Get("instance_name").(string) c := state.Get("config").(*Config) diff --git a/builder/googlecompute/step_teardown_instance.go b/builder/googlecompute/step_teardown_instance.go index b545634f4..93b0e3aff 100644 --- a/builder/googlecompute/step_teardown_instance.go +++ b/builder/googlecompute/step_teardown_instance.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepTeardownInstance represents a Packer build step that tears down GCE @@ -20,7 +20,7 @@ type StepTeardownInstance struct { func (s *StepTeardownInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.InstanceName if name == "" { @@ -57,7 +57,7 @@ func (s *StepTeardownInstance) Run(ctx context.Context, state multistep.StateBag func (s *StepTeardownInstance) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting disk...") errCh, err := driver.DeleteDisk(config.Zone, config.DiskName) diff --git a/builder/googlecompute/step_wait_startup_script.go b/builder/googlecompute/step_wait_startup_script.go index 25c64988b..8723f0690 100644 --- a/builder/googlecompute/step_wait_startup_script.go +++ b/builder/googlecompute/step_wait_startup_script.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -18,7 +18,7 @@ type StepWaitStartupScript int func (s *StepWaitStartupScript) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceName := state.Get("instance_name").(string) if config.WrapStartupScriptFile.False() { diff --git a/builder/hcloud/builder.go b/builder/hcloud/builder.go index f46b62c33..daf135e57 100644 --- a/builder/hcloud/builder.go +++ b/builder/hcloud/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hetznercloud/hcloud-go/hcloud" ) @@ -34,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { opts := []hcloud.ClientOption{ hcloud.WithToken(b.config.HCloudToken), hcloud.WithEndpoint(b.config.Endpoint), diff --git a/builder/hcloud/step_create_server.go b/builder/hcloud/step_create_server.go index 05d84407a..c5936ed78 100644 --- a/builder/hcloud/step_create_server.go +++ b/builder/hcloud/step_create_server.go @@ -7,8 +7,8 @@ import ( "sort" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hetznercloud/hcloud-go/hcloud" ) @@ -18,7 +18,7 @@ type stepCreateServer struct { func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("hcloudClient").(*hcloud.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) sshKeyId := state.Get("ssh_key_id").(int) @@ -144,7 +144,7 @@ func (s *stepCreateServer) Cleanup(state multistep.StateBag) { } client := state.Get("hcloudClient").(*hcloud.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Destroy the server we just created ui.Say("Destroying server...") diff --git a/builder/hcloud/step_create_snapshot.go b/builder/hcloud/step_create_snapshot.go index 26550d66e..9764b76d8 100644 --- a/builder/hcloud/step_create_snapshot.go +++ b/builder/hcloud/step_create_snapshot.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hetznercloud/hcloud-go/hcloud" ) @@ -13,7 +13,7 @@ type stepCreateSnapshot struct{} func (s *stepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("hcloudClient").(*hcloud.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) serverID := state.Get("server_id").(int) diff --git a/builder/hcloud/step_create_sshkey.go b/builder/hcloud/step_create_sshkey.go index fa6a05e68..9f2a666a8 100644 --- a/builder/hcloud/step_create_sshkey.go +++ b/builder/hcloud/step_create_sshkey.go @@ -11,8 +11,8 @@ import ( "os" "runtime" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" "github.com/hetznercloud/hcloud-go/hcloud" "golang.org/x/crypto/ssh" @@ -27,7 +27,7 @@ type stepCreateSSHKey struct { func (s *stepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("hcloudClient").(*hcloud.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) ui.Say("Creating temporary ssh key for server...") @@ -115,7 +115,7 @@ func (s *stepCreateSSHKey) Cleanup(state multistep.StateBag) { } client := state.Get("hcloudClient").(*hcloud.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting temporary ssh key...") _, err := client.SSHKey.Delete(context.TODO(), &hcloud.SSHKey{ID: s.keyId}) diff --git a/builder/hcloud/step_shutdown_server.go b/builder/hcloud/step_shutdown_server.go index 25cba2de8..20a390e4a 100644 --- a/builder/hcloud/step_shutdown_server.go +++ b/builder/hcloud/step_shutdown_server.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hetznercloud/hcloud-go/hcloud" ) @@ -13,7 +13,7 @@ type stepShutdownServer struct{} func (s *stepShutdownServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("hcloudClient").(*hcloud.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) serverID := state.Get("server_id").(int) ui.Say("Shutting down server...") diff --git a/builder/hyperone/builder.go b/builder/hyperone/builder.go index d1cb42047..cb1653138 100644 --- a/builder/hyperone/builder.go +++ b/builder/hyperone/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" openapi "github.com/hyperonecom/h1-client-go" ) @@ -51,7 +52,7 @@ type wrappedCommandTemplate struct { Command string } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { wrappedCommand := func(command string) (string, error) { ictx := b.config.ctx ictx.Data = &wrappedCommandTemplate{Command: command} diff --git a/builder/hyperone/step_copy_files.go b/builder/hyperone/step_copy_files.go index 7eade9313..5d952c1b3 100644 --- a/builder/hyperone/step_copy_files.go +++ b/builder/hyperone/step_copy_files.go @@ -6,15 +6,15 @@ import ( "log" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCopyFiles struct{} func (s *stepCopyFiles) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(config.ChrootCopyFiles) == 0 { return multistep.ActionContinue diff --git a/builder/hyperone/step_create_image.go b/builder/hyperone/step_create_image.go index 9b12e3a53..06599085e 100644 --- a/builder/hyperone/step_create_image.go +++ b/builder/hyperone/step_create_image.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" openapi "github.com/hyperonecom/h1-client-go" ) @@ -15,7 +15,7 @@ type stepCreateImage struct { func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*openapi.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) vmID := state.Get("vm_id").(string) @@ -55,7 +55,7 @@ func (s *stepCreateImage) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*openapi.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, err := client.ImageApi.ImageDelete(context.TODO(), s.imageID) if err != nil { diff --git a/builder/hyperone/step_create_ssh_key.go b/builder/hyperone/step_create_ssh_key.go index 1180ae61f..fb0f629c5 100644 --- a/builder/hyperone/step_create_ssh_key.go +++ b/builder/hyperone/step_create_ssh_key.go @@ -10,8 +10,8 @@ import ( "os" "runtime" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -21,7 +21,7 @@ type stepCreateSSHKey struct { } func (s *stepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) ui.Say("Creating a temporary ssh key for the VM...") diff --git a/builder/hyperone/step_create_vm.go b/builder/hyperone/step_create_vm.go index 05b4b340b..daa61b90e 100644 --- a/builder/hyperone/step_create_vm.go +++ b/builder/hyperone/step_create_vm.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" openapi "github.com/hyperonecom/h1-client-go" ) @@ -20,7 +20,7 @@ const ( func (s *stepCreateVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*openapi.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) sshKey := state.Get("ssh_public_key").(string) @@ -173,7 +173,7 @@ func (s *stepCreateVM) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Deleting VM %s...", s.vmID)) err := deleteVMWithDisks(s.vmID, state) diff --git a/builder/hyperone/step_create_vm_from_disk.go b/builder/hyperone/step_create_vm_from_disk.go index 39969e780..f0775e3b7 100644 --- a/builder/hyperone/step_create_vm_from_disk.go +++ b/builder/hyperone/step_create_vm_from_disk.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" openapi "github.com/hyperonecom/h1-client-go" ) @@ -15,7 +15,7 @@ type stepCreateVMFromDisk struct { func (s *stepCreateVMFromDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*openapi.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) sshKey := state.Get("ssh_public_key").(string) chrootDiskID := state.Get("chroot_disk_id").(string) @@ -53,7 +53,7 @@ func (s *stepCreateVMFromDisk) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Deleting VM %s (from chroot disk)...", s.vmID)) err := deleteVMWithDisks(s.vmID, state) diff --git a/builder/hyperone/step_detach_disk.go b/builder/hyperone/step_detach_disk.go index d258cabb2..63c6cb2d2 100644 --- a/builder/hyperone/step_detach_disk.go +++ b/builder/hyperone/step_detach_disk.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" openapi "github.com/hyperonecom/h1-client-go" ) @@ -15,7 +15,7 @@ type stepDetachDisk struct { func (s *stepDetachDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*openapi.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmID := state.Get("vm_id").(string) chrootDiskID := state.Get("chroot_disk_id").(string) diff --git a/builder/hyperone/step_mount_chroot.go b/builder/hyperone/step_mount_chroot.go index c4b5dd0d6..e2647c1de 100644 --- a/builder/hyperone/step_mount_chroot.go +++ b/builder/hyperone/step_mount_chroot.go @@ -6,15 +6,15 @@ import ( "log" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepMountChroot struct{} func (s *stepMountChroot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := state.Get("device").(string) log.Printf("Mount path: %s", config.ChrootMountPath) diff --git a/builder/hyperone/step_mount_extra.go b/builder/hyperone/step_mount_extra.go index 318803746..5d51904d5 100644 --- a/builder/hyperone/step_mount_extra.go +++ b/builder/hyperone/step_mount_extra.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepMountExtra struct{} @@ -13,7 +13,7 @@ type stepMountExtra struct{} func (s *stepMountExtra) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Mounting additional paths within the chroot...") for _, mountInfo := range config.ChrootMounts { diff --git a/builder/hyperone/step_post_mount_commands.go b/builder/hyperone/step_post_mount_commands.go index 7d943f34a..2ab56f186 100644 --- a/builder/hyperone/step_post_mount_commands.go +++ b/builder/hyperone/step_post_mount_commands.go @@ -3,8 +3,8 @@ package hyperone import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type postMountCommandsData struct { @@ -16,7 +16,7 @@ type stepPostMountCommands struct{} func (s *stepPostMountCommands) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := state.Get("device").(string) ictx := config.ctx diff --git a/builder/hyperone/step_pre_mount_commands.go b/builder/hyperone/step_pre_mount_commands.go index b96551af2..fbbb0db4e 100644 --- a/builder/hyperone/step_pre_mount_commands.go +++ b/builder/hyperone/step_pre_mount_commands.go @@ -3,8 +3,8 @@ package hyperone import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type preMountCommandsData struct { @@ -16,7 +16,7 @@ type stepPreMountCommands struct{} func (s *stepPreMountCommands) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := state.Get("device").(string) ictx := config.ctx diff --git a/builder/hyperone/step_prepare_device.go b/builder/hyperone/step_prepare_device.go index a4474fe3a..a8b1a052e 100644 --- a/builder/hyperone/step_prepare_device.go +++ b/builder/hyperone/step_prepare_device.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const ( @@ -16,7 +16,7 @@ const ( type stepPrepareDevice struct{} func (s *stepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.ChrootDevice != "" { diff --git a/builder/hyperone/step_stop_vm.go b/builder/hyperone/step_stop_vm.go index 4189cf15b..a736356f1 100644 --- a/builder/hyperone/step_stop_vm.go +++ b/builder/hyperone/step_stop_vm.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" openapi "github.com/hyperonecom/h1-client-go" ) @@ -13,7 +13,7 @@ type stepStopVM struct{} func (s *stepStopVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*openapi.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmID := state.Get("vm_id").(string) ui.Say("Stopping VM...") diff --git a/builder/hyperone/utils.go b/builder/hyperone/utils.go index 8d83d26c0..a2526e1cd 100644 --- a/builder/hyperone/utils.go +++ b/builder/hyperone/utils.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" openapi "github.com/hyperonecom/h1-client-go" ) @@ -24,7 +25,7 @@ func formatOpenAPIError(err error) string { func runCommands(commands []string, ictx interpolate.Context, state multistep.StateBag) error { ctx := context.TODO() - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) comm := state.Get("communicator").(packer.Communicator) diff --git a/builder/hyperv/common/step_clone_vm.go b/builder/hyperv/common/step_clone_vm.go index a6a101e4f..397f075b5 100644 --- a/builder/hyperv/common/step_clone_vm.go +++ b/builder/hyperv/common/step_clone_vm.go @@ -7,8 +7,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step clones an existing virtual machine. @@ -38,7 +38,7 @@ type StepCloneVM struct { func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cloning virtual machine...") path := state.Get("build_dir").(string) @@ -167,7 +167,7 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.KeepRegistered { ui.Say("keep_registered set. Skipping unregister/deletion of VM.") diff --git a/builder/hyperv/common/step_collate_artifacts.go b/builder/hyperv/common/step_collate_artifacts.go index 7f0561e90..597d26c4f 100644 --- a/builder/hyperv/common/step_collate_artifacts.go +++ b/builder/hyperv/common/step_collate_artifacts.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCollateArtifacts struct { @@ -17,7 +17,7 @@ type StepCollateArtifacts struct { // specified output directory func (s *StepCollateArtifacts) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Collating build artifacts...") diff --git a/builder/hyperv/common/step_compact_disk.go b/builder/hyperv/common/step_compact_disk.go index 75f174d22..d374f102f 100644 --- a/builder/hyperv/common/step_compact_disk.go +++ b/builder/hyperv/common/step_compact_disk.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCompactDisk struct { @@ -15,7 +15,7 @@ type StepCompactDisk struct { // Run runs a compaction/optimisation process on attached VHD/VHDX disks func (s *StepCompactDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.SkipCompaction { ui.Say("Skipping disk compaction...") diff --git a/builder/hyperv/common/step_configure_ip.go b/builder/hyperv/common/step_configure_ip.go index 70682a6df..617c20587 100644 --- a/builder/hyperv/common/step_configure_ip.go +++ b/builder/hyperv/common/step_configure_ip.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepConfigureIp struct { @@ -16,7 +16,7 @@ type StepConfigureIp struct { func (s *StepConfigureIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error configuring ip address: %s" vmName := state.Get("vmName").(string) diff --git a/builder/hyperv/common/step_configure_vlan.go b/builder/hyperv/common/step_configure_vlan.go index 810c200c2..146df7f23 100644 --- a/builder/hyperv/common/step_configure_vlan.go +++ b/builder/hyperv/common/step_configure_vlan.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepConfigureVlan struct { @@ -15,7 +15,7 @@ type StepConfigureVlan struct { func (s *StepConfigureVlan) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error configuring vlan: %s" vmName := state.Get("vmName").(string) diff --git a/builder/hyperv/common/step_create_build_dir.go b/builder/hyperv/common/step_create_build_dir.go index d66257bac..707db2124 100644 --- a/builder/hyperv/common/step_create_build_dir.go +++ b/builder/hyperv/common/step_create_build_dir.go @@ -7,8 +7,8 @@ import ( "log" "os" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -26,7 +26,7 @@ type StepCreateBuildDir struct { // Creates the main directory used to house the VMs files and folders // during the build func (s *StepCreateBuildDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating build directory...") @@ -58,7 +58,7 @@ func (s *StepCreateBuildDir) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting build directory...") err := os.RemoveAll(s.buildDir) diff --git a/builder/hyperv/common/step_create_external_switch.go b/builder/hyperv/common/step_create_external_switch.go index ec8d41339..a372238ff 100644 --- a/builder/hyperv/common/step_create_external_switch.go +++ b/builder/hyperv/common/step_create_external_switch.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -23,7 +23,7 @@ type StepCreateExternalSwitch struct { // build VM to connect to the outside world. func (s *StepCreateExternalSwitch) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) errorMsg := "Error creating external switch: %s" @@ -79,7 +79,7 @@ func (s *StepCreateExternalSwitch) Cleanup(state multistep.StateBag) { return } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Unregistering and deleting external switch...") diff --git a/builder/hyperv/common/step_create_switch.go b/builder/hyperv/common/step_create_switch.go index 2e46036cd..48d420498 100644 --- a/builder/hyperv/common/step_create_switch.go +++ b/builder/hyperv/common/step_create_switch.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const ( @@ -35,7 +35,7 @@ type StepCreateSwitch struct { func (s *StepCreateSwitch) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.SwitchType) == 0 { s.SwitchType = DefaultSwitchType @@ -70,7 +70,7 @@ func (s *StepCreateSwitch) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Unregistering and deleting switch...") err := driver.DeleteVirtualSwitch(s.SwitchName) diff --git a/builder/hyperv/common/step_create_vm.go b/builder/hyperv/common/step_create_vm.go index 1b5e22c73..7b9375aa2 100644 --- a/builder/hyperv/common/step_create_vm.go +++ b/builder/hyperv/common/step_create_vm.go @@ -7,8 +7,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates the actual virtual machine. @@ -40,7 +40,7 @@ type StepCreateVM struct { func (s *StepCreateVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating virtual machine...") var path string @@ -179,7 +179,7 @@ func (s *StepCreateVM) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.KeepRegistered { ui.Say("keep_registered set. Skipping unregister/deletion of VM.") diff --git a/builder/hyperv/common/step_disable_vlan.go b/builder/hyperv/common/step_disable_vlan.go index f2caf89a4..b73922caa 100644 --- a/builder/hyperv/common/step_disable_vlan.go +++ b/builder/hyperv/common/step_disable_vlan.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDisableVlan struct { @@ -13,7 +13,7 @@ type StepDisableVlan struct { func (s *StepDisableVlan) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error disabling vlan: %s" vmName := state.Get("vmName").(string) diff --git a/builder/hyperv/common/step_enable_integration_service.go b/builder/hyperv/common/step_enable_integration_service.go index 4a1a3a7d5..15420c704 100644 --- a/builder/hyperv/common/step_enable_integration_service.go +++ b/builder/hyperv/common/step_enable_integration_service.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepEnableIntegrationService struct { @@ -14,7 +14,7 @@ type StepEnableIntegrationService struct { func (s *StepEnableIntegrationService) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Enabling Integration Service...") vmName := state.Get("vmName").(string) diff --git a/builder/hyperv/common/step_export_vm.go b/builder/hyperv/common/step_export_vm.go index f94d4f7e1..0bf3fce48 100644 --- a/builder/hyperv/common/step_export_vm.go +++ b/builder/hyperv/common/step_export_vm.go @@ -5,8 +5,8 @@ import ( "fmt" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepExportVm struct { @@ -16,7 +16,7 @@ type StepExportVm struct { func (s *StepExportVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.SkipExport { ui.Say("Skipping export of virtual machine...") diff --git a/builder/hyperv/common/step_mount_dvddrive.go b/builder/hyperv/common/step_mount_dvddrive.go index 37b10bf8e..95113c2f7 100644 --- a/builder/hyperv/common/step_mount_dvddrive.go +++ b/builder/hyperv/common/step_mount_dvddrive.go @@ -7,8 +7,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepMountDvdDrive struct { @@ -18,7 +18,7 @@ type StepMountDvdDrive struct { func (s *StepMountDvdDrive) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error mounting dvd drive: %s" vmName := state.Get("vmName").(string) @@ -100,7 +100,7 @@ func (s *StepMountDvdDrive) Cleanup(state multistep.StateBag) { dvdController := dvdControllerState.(DvdControllerProperties) driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error unmounting os dvd drive: %s" ui.Say("Clean up os dvd drive...") diff --git a/builder/hyperv/common/step_mount_floppydrive.go b/builder/hyperv/common/step_mount_floppydrive.go index e2cb9e1b1..f26ce933c 100644 --- a/builder/hyperv/common/step_mount_floppydrive.go +++ b/builder/hyperv/common/step_mount_floppydrive.go @@ -8,8 +8,8 @@ import ( "os" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -47,7 +47,7 @@ func (s *StepMountFloppydrive) Run(ctx context.Context, state multistep.StateBag return multistep.ActionHalt } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Mounting floppy drive...") @@ -76,7 +76,7 @@ func (s *StepMountFloppydrive) Cleanup(state multistep.StateBag) { errorMsg := "Error unmounting floppy drive: %s" vmName := state.Get("vmName").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cleanup floppy drive...") diff --git a/builder/hyperv/common/step_mount_guest_additions.go b/builder/hyperv/common/step_mount_guest_additions.go index 4f215220d..2e8ab92c1 100644 --- a/builder/hyperv/common/step_mount_guest_additions.go +++ b/builder/hyperv/common/step_mount_guest_additions.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepMountGuestAdditions struct { @@ -16,7 +16,7 @@ type StepMountGuestAdditions struct { } func (s *StepMountGuestAdditions) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.GuestAdditionsMode != "attach" { ui.Say("Skipping mounting Integration Services Setup Disk...") @@ -74,7 +74,7 @@ func (s *StepMountGuestAdditions) Cleanup(state multistep.StateBag) { } dvdController := dvdControllerState.(DvdControllerProperties) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) errorMsg := "Error unmounting Integration Services dvd drive: %s" diff --git a/builder/hyperv/common/step_mount_secondary_dvd_images.go b/builder/hyperv/common/step_mount_secondary_dvd_images.go index fe1921ff8..a52845c25 100644 --- a/builder/hyperv/common/step_mount_secondary_dvd_images.go +++ b/builder/hyperv/common/step_mount_secondary_dvd_images.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepMountSecondaryDvdImages struct { @@ -22,7 +22,7 @@ type DvdControllerProperties struct { func (s *StepMountSecondaryDvdImages) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Mounting secondary DVD images...") vmName := state.Get("vmName").(string) @@ -84,7 +84,7 @@ func (s *StepMountSecondaryDvdImages) Cleanup(state multistep.StateBag) { dvdControllers := dvdControllersState.([]DvdControllerProperties) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) errorMsg := "Error unmounting secondary dvd drive: %s" diff --git a/builder/hyperv/common/step_polling_installation.go b/builder/hyperv/common/step_polling_installation.go index a2db5f9cb..2d15ad424 100644 --- a/builder/hyperv/common/step_polling_installation.go +++ b/builder/hyperv/common/step_polling_installation.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const port string = "13000" @@ -19,7 +19,7 @@ type StepPollingInstallation struct { } func (s *StepPollingInstallation) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error polling VM: %s" vmIp := state.Get("ip").(string) diff --git a/builder/hyperv/common/step_reboot_vm.go b/builder/hyperv/common/step_reboot_vm.go index 335f66c1f..85cb697b1 100644 --- a/builder/hyperv/common/step_reboot_vm.go +++ b/builder/hyperv/common/step_reboot_vm.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRebootVm struct { @@ -14,7 +14,7 @@ type StepRebootVm struct { func (s *StepRebootVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) errorMsg := "Error rebooting vm: %s" vmName := state.Get("vmName").(string) diff --git a/builder/hyperv/common/step_run.go b/builder/hyperv/common/step_run.go index 035aa35bf..b176be2af 100644 --- a/builder/hyperv/common/step_run.go +++ b/builder/hyperv/common/step_run.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRun struct { @@ -18,7 +18,7 @@ type StepRun struct { func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Determine Host IP for HyperV machine...") @@ -62,7 +62,7 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !s.Headless && s.GuiCancelFunc != nil { ui.Say("Disconnecting from vmconnect...") diff --git a/builder/hyperv/common/step_set_boot_order.go b/builder/hyperv/common/step_set_boot_order.go index 7e4b9d3d1..b5b72fb63 100644 --- a/builder/hyperv/common/step_set_boot_order.go +++ b/builder/hyperv/common/step_set_boot_order.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSetBootOrder struct { @@ -14,7 +14,7 @@ type StepSetBootOrder struct { func (s *StepSetBootOrder) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.BootOrder != nil { diff --git a/builder/hyperv/common/step_set_first_boot_device.go b/builder/hyperv/common/step_set_first_boot_device.go index cf3c60fa4..20dbb676f 100644 --- a/builder/hyperv/common/step_set_first_boot_device.go +++ b/builder/hyperv/common/step_set_first_boot_device.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSetFirstBootDevice struct { @@ -103,7 +103,7 @@ func ParseBootDeviceIdentifier(deviceIdentifier string, generation uint) (string func (s *StepSetFirstBootDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.FirstBootDevice != "" { diff --git a/builder/hyperv/common/step_shutdown.go b/builder/hyperv/common/step_shutdown.go index 741c6d815..9a9dfef54 100644 --- a/builder/hyperv/common/step_shutdown.go +++ b/builder/hyperv/common/step_shutdown.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step shuts down the machine. It first attempts to do so gracefully, @@ -18,7 +19,7 @@ import ( // Uses: // communicator packer.Communicator // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -32,7 +33,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.Command != "" { diff --git a/builder/hyperv/common/step_sleep.go b/builder/hyperv/common/step_sleep.go index 5420c7f0d..a69f74c50 100644 --- a/builder/hyperv/common/step_sleep.go +++ b/builder/hyperv/common/step_sleep.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSleep struct { @@ -15,7 +15,7 @@ type StepSleep struct { } func (s *StepSleep) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.ActionName) > 0 { ui.Say(s.ActionName + "! Waiting for " + fmt.Sprintf("%v", uint(s.Minutes)) + diff --git a/builder/hyperv/common/step_type_boot_command.go b/builder/hyperv/common/step_type_boot_command.go index 3fbd0871f..c40fdb19b 100644 --- a/builder/hyperv/common/step_type_boot_command.go +++ b/builder/hyperv/common/step_type_boot_command.go @@ -6,9 +6,9 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -29,7 +29,7 @@ type StepTypeBootCommand struct { func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { httpPort := state.Get("http_port").(int) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) hostIp := state.Get("http_ip").(string) diff --git a/builder/hyperv/common/step_unmount_dvddrive.go b/builder/hyperv/common/step_unmount_dvddrive.go index bdd98e30f..b59bc5f20 100644 --- a/builder/hyperv/common/step_unmount_dvddrive.go +++ b/builder/hyperv/common/step_unmount_dvddrive.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepUnmountDvdDrive struct { @@ -14,7 +14,7 @@ type StepUnmountDvdDrive struct { func (s *StepUnmountDvdDrive) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Unmount/delete os dvd drive...") diff --git a/builder/hyperv/common/step_unmount_floppydrive.go b/builder/hyperv/common/step_unmount_floppydrive.go index eccfb5dc4..06bd7aaa5 100644 --- a/builder/hyperv/common/step_unmount_floppydrive.go +++ b/builder/hyperv/common/step_unmount_floppydrive.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepUnmountFloppyDrive struct { @@ -14,7 +14,7 @@ type StepUnmountFloppyDrive struct { func (s *StepUnmountFloppyDrive) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Generation > 1 { return multistep.ActionContinue diff --git a/builder/hyperv/common/step_unmount_guest_additions.go b/builder/hyperv/common/step_unmount_guest_additions.go index 663d64077..12451f2fc 100644 --- a/builder/hyperv/common/step_unmount_guest_additions.go +++ b/builder/hyperv/common/step_unmount_guest_additions.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepUnmountGuestAdditions struct { @@ -14,7 +14,7 @@ type StepUnmountGuestAdditions struct { func (s *StepUnmountGuestAdditions) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Unmount/delete Integration Services dvd drive...") diff --git a/builder/hyperv/common/step_unmount_secondary_dvd_images.go b/builder/hyperv/common/step_unmount_secondary_dvd_images.go index c33617fe0..8429de0c4 100644 --- a/builder/hyperv/common/step_unmount_secondary_dvd_images.go +++ b/builder/hyperv/common/step_unmount_secondary_dvd_images.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepUnmountSecondaryDvdImages struct { @@ -13,7 +13,7 @@ type StepUnmountSecondaryDvdImages struct { func (s *StepUnmountSecondaryDvdImages) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Unmount/delete secondary dvd drives...") diff --git a/builder/hyperv/common/step_wait_for_install_to_complete.go b/builder/hyperv/common/step_wait_for_install_to_complete.go index da4ac90ba..5c54eac1b 100644 --- a/builder/hyperv/common/step_wait_for_install_to_complete.go +++ b/builder/hyperv/common/step_wait_for_install_to_complete.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const ( @@ -18,7 +18,7 @@ type StepWaitForPowerOff struct { func (s *StepWaitForPowerOff) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Waiting for vm to be powered down...") @@ -52,7 +52,7 @@ type StepWaitForInstallToComplete struct { func (s *StepWaitForInstallToComplete) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if len(s.ActionName) > 0 { diff --git a/builder/hyperv/iso/builder.go b/builder/hyperv/iso/builder.go index b5df8e57c..fb8634df2 100644 --- a/builder/hyperv/iso/builder.go +++ b/builder/hyperv/iso/builder.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/shutdowncommand" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -176,7 +177,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a Hyperv appliance. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with Hyperv driver, err := hypervcommon.NewHypervPS4Driver() if err != nil { diff --git a/builder/hyperv/vmcx/builder.go b/builder/hyperv/vmcx/builder.go index ad91ec126..74eec6810 100644 --- a/builder/hyperv/vmcx/builder.go +++ b/builder/hyperv/vmcx/builder.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/shutdowncommand" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -216,7 +217,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a Hyperv appliance. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with Hyperv driver, err := hypervcommon.NewHypervPS4Driver() if err != nil { diff --git a/builder/jdcloud/builder.go b/builder/jdcloud/builder.go index 8dc291b6f..a19c81049 100644 --- a/builder/jdcloud/builder.go +++ b/builder/jdcloud/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -42,7 +43,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("hook", hook) diff --git a/builder/jdcloud/step_config_credentials.go b/builder/jdcloud/step_config_credentials.go index 848f44874..9f036486a 100644 --- a/builder/jdcloud/step_config_credentials.go +++ b/builder/jdcloud/step_config_credentials.go @@ -5,19 +5,19 @@ import ( "fmt" "io/ioutil" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" ) type stepConfigCredentials struct { InstanceSpecConfig *JDCloudInstanceSpecConfig - ui packer.Ui + ui packersdk.Ui } func (s *stepConfigCredentials) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - s.ui = state.Get("ui").(packer.Ui) + s.ui = state.Get("ui").(packersdk.Ui) password := s.InstanceSpecConfig.Comm.SSHPassword privateKeyPath := s.InstanceSpecConfig.Comm.SSHPrivateKeyFile privateKeyName := s.InstanceSpecConfig.Comm.SSHKeyPairName diff --git a/builder/jdcloud/step_create_image.go b/builder/jdcloud/step_create_image.go index 4e1fde048..315d8f169 100644 --- a/builder/jdcloud/step_create_image.go +++ b/builder/jdcloud/step_create_image.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" ) @@ -16,7 +16,7 @@ type stepCreateJDCloudImage struct { func (s *stepCreateJDCloudImage) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating images") req := apis.NewCreateImageRequest(Region, s.InstanceSpecConfig.InstanceId, s.InstanceSpecConfig.ImageName, "") diff --git a/builder/jdcloud/step_create_instance.go b/builder/jdcloud/step_create_instance.go index 745b98085..266b55914 100644 --- a/builder/jdcloud/step_create_instance.go +++ b/builder/jdcloud/step_create_instance.go @@ -6,8 +6,8 @@ import ( "regexp" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/jdcloud-api/jdcloud-sdk-go/core" "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models" @@ -19,7 +19,7 @@ import ( type stepCreateJDCloudInstance struct { InstanceSpecConfig *JDCloudInstanceSpecConfig CredentialConfig *JDCloudCredentialConfig - ui packer.Ui + ui packersdk.Ui } func (s *stepCreateJDCloudInstance) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { @@ -27,7 +27,7 @@ func (s *stepCreateJDCloudInstance) Run(_ context.Context, state multistep.State privateKey := s.InstanceSpecConfig.Comm.SSHPrivateKey keyName := s.InstanceSpecConfig.Comm.SSHKeyPairName password := s.InstanceSpecConfig.Comm.SSHPassword - s.ui = state.Get("ui").(packer.Ui) + s.ui = state.Get("ui").(packersdk.Ui) s.ui.Say("Creating instances") instanceSpec := vm.InstanceSpec{ diff --git a/builder/jdcloud/step_stop_instance.go b/builder/jdcloud/step_stop_instance.go index a167b0fc6..99465ff07 100644 --- a/builder/jdcloud/step_stop_instance.go +++ b/builder/jdcloud/step_stop_instance.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" ) @@ -15,7 +15,7 @@ type stepStopJDCloudInstance struct { func (s *stepStopJDCloudInstance) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Stopping this instance") req := apis.NewStopInstanceRequest(Region, s.InstanceSpecConfig.InstanceId) diff --git a/builder/jdcloud/step_validate_parameters.go b/builder/jdcloud/step_validate_parameters.go index 708617957..b31fcfbde 100644 --- a/builder/jdcloud/step_validate_parameters.go +++ b/builder/jdcloud/step_validate_parameters.go @@ -4,21 +4,21 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/apis" vpc "github.com/jdcloud-api/jdcloud-sdk-go/services/vpc/apis" ) type stepValidateParameters struct { InstanceSpecConfig *JDCloudInstanceSpecConfig - ui packer.Ui + ui packersdk.Ui state multistep.StateBag } func (s *stepValidateParameters) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - s.ui = state.Get("ui").(packer.Ui) + s.ui = state.Get("ui").(packersdk.Ui) s.state = state s.ui.Say("Validating parameters...") diff --git a/builder/linode/builder.go b/builder/linode/builder.go index 670cc2d35..c1890dff5 100644 --- a/builder/linode/builder.go +++ b/builder/linode/builder.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // The unique ID for this builder. @@ -36,7 +37,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (ret packer.Artifact, err error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (ret packer.Artifact, err error) { ui.Say("Running builder ...") client := newLinodeClient(b.config.PersonalAccessToken) diff --git a/builder/linode/step_create_image.go b/builder/linode/step_create_image.go index 58da16e73..c9839fe38 100644 --- a/builder/linode/step_create_image.go +++ b/builder/linode/step_create_image.go @@ -4,8 +4,8 @@ import ( "context" "errors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/linode/linodego" ) @@ -15,7 +15,7 @@ type stepCreateImage struct { func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) disk := state.Get("disk").(*linodego.InstanceDisk) instance := state.Get("instance").(*linodego.Instance) diff --git a/builder/linode/step_create_linode.go b/builder/linode/step_create_linode.go index 50db58696..ab67db698 100644 --- a/builder/linode/step_create_linode.go +++ b/builder/linode/step_create_linode.go @@ -5,8 +5,8 @@ import ( "errors" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/linode/linodego" ) @@ -16,7 +16,7 @@ type stepCreateLinode struct { func (s *stepCreateLinode) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating Linode...") @@ -89,7 +89,7 @@ func (s *stepCreateLinode) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.client.DeleteInstance(context.Background(), instance.(*linodego.Instance).ID); err != nil { ui.Error("Error cleaning up Linode: " + err.Error()) diff --git a/builder/linode/step_create_ssh_key.go b/builder/linode/step_create_ssh_key.go index c5f7ad4cb..9c0dde950 100644 --- a/builder/linode/step_create_ssh_key.go +++ b/builder/linode/step_create_ssh_key.go @@ -10,8 +10,8 @@ import ( "io/ioutil" "os" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -24,7 +24,7 @@ type StepCreateSSHKey struct { // Run executes the Packer build step that generates SSH key pairs. // The key pairs are added to the ssh config func (s *StepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.Comm.SSHPrivateKeyFile != "" { diff --git a/builder/linode/step_shutdown_linode.go b/builder/linode/step_shutdown_linode.go index 82069e19c..0f63f9157 100644 --- a/builder/linode/step_shutdown_linode.go +++ b/builder/linode/step_shutdown_linode.go @@ -4,8 +4,8 @@ import ( "context" "errors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/linode/linodego" ) @@ -15,7 +15,7 @@ type stepShutdownLinode struct { func (s *stepShutdownLinode) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance := state.Get("instance").(*linodego.Instance) ui.Say("Shutting down Linode...") diff --git a/builder/lxc/builder.go b/builder/lxc/builder.go index 53195c764..64ccfd1f7 100644 --- a/builder/lxc/builder.go +++ b/builder/lxc/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -35,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { wrappedCommand := func(command string) (string, error) { b.config.ctx.Data = &wrappedCommandTemplate{Command: command} return interpolate.Render(b.config.CommandWrapper, &b.config.ctx) diff --git a/builder/lxc/step_export.go b/builder/lxc/step_export.go index f017f551a..470222e3f 100644 --- a/builder/lxc/step_export.go +++ b/builder/lxc/step_export.go @@ -9,15 +9,15 @@ import ( "os/user" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepExport struct{} func (s *stepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.ContainerName diff --git a/builder/lxc/step_lxc_create.go b/builder/lxc/step_lxc_create.go index afcc2da79..aa0a07e3a 100644 --- a/builder/lxc/step_lxc_create.go +++ b/builder/lxc/step_lxc_create.go @@ -7,15 +7,15 @@ import ( "os/user" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepLxcCreate struct{} func (s *stepLxcCreate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.ContainerName @@ -65,7 +65,7 @@ func (s *stepLxcCreate) Run(ctx context.Context, state multistep.StateBag) multi func (s *stepLxcCreate) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) command := []string{ "lxc-destroy", "-f", "-n", config.ContainerName, diff --git a/builder/lxc/step_prepare_output_dir.go b/builder/lxc/step_prepare_output_dir.go index 65e7b40b0..2c89b5e3f 100644 --- a/builder/lxc/step_prepare_output_dir.go +++ b/builder/lxc/step_prepare_output_dir.go @@ -6,15 +6,15 @@ import ( "os" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepPrepareOutputDir struct{} func (stepPrepareOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if _, err := os.Stat(config.OutputDir); err == nil && config.PackerForce { ui.Say("Deleting previous output directory...") @@ -35,7 +35,7 @@ func (stepPrepareOutputDir) Cleanup(state multistep.StateBag) { if cancelled || halted { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting output directory...") for i := 0; i < 5; i++ { diff --git a/builder/lxc/step_provision.go b/builder/lxc/step_provision.go index 5d8beae4c..c9ca5c812 100644 --- a/builder/lxc/step_provision.go +++ b/builder/lxc/step_provision.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepProvision provisions the instance within a chroot. @@ -16,7 +17,7 @@ func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multi hook := state.Get("hook").(packer.Hook) config := state.Get("config").(*Config) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) // Create our communicator diff --git a/builder/lxc/step_wait_init.go b/builder/lxc/step_wait_init.go index c4e733edc..7d47aa712 100644 --- a/builder/lxc/step_wait_init.go +++ b/builder/lxc/step_wait_init.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepWaitInit struct { @@ -17,7 +17,7 @@ type StepWaitInit struct { } func (s *StepWaitInit) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) var err error diff --git a/builder/lxd/builder.go b/builder/lxd/builder.go index 34be34e62..cbc52fcff 100644 --- a/builder/lxd/builder.go +++ b/builder/lxd/builder.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -33,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { wrappedCommand := func(command string) (string, error) { b.config.ctx.Data = &wrappedCommandTemplate{Command: command} return interpolate.Render(b.config.CommandWrapper, &b.config.ctx) diff --git a/builder/lxd/step_lxd_launch.go b/builder/lxd/step_lxd_launch.go index 420c6564a..468463040 100644 --- a/builder/lxd/step_lxd_launch.go +++ b/builder/lxd/step_lxd_launch.go @@ -7,15 +7,15 @@ import ( "strconv" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepLxdLaunch struct{} func (s *stepLxdLaunch) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.ContainerName image := config.Image @@ -55,7 +55,7 @@ func (s *stepLxdLaunch) Run(ctx context.Context, state multistep.StateBag) multi func (s *stepLxdLaunch) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cleanup_args := []string{ "delete", "--force", config.ContainerName, diff --git a/builder/lxd/step_provision.go b/builder/lxd/step_provision.go index 1fa1b47c0..5670dfbaf 100644 --- a/builder/lxd/step_provision.go +++ b/builder/lxd/step_provision.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepProvision provisions the container @@ -15,7 +16,7 @@ type StepProvision struct{} func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { hook := state.Get("hook").(packer.Hook) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) // Create our communicator diff --git a/builder/lxd/step_publish.go b/builder/lxd/step_publish.go index 7f7d838b1..4e9c2ca56 100644 --- a/builder/lxd/step_publish.go +++ b/builder/lxd/step_publish.go @@ -5,15 +5,15 @@ import ( "fmt" "regexp" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepPublish struct{} func (s *stepPublish) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.ContainerName stop_args := []string{ diff --git a/builder/ncloud/builder.go b/builder/ncloud/builder.go index 284a881d3..84fc4130c 100644 --- a/builder/ncloud/builder.go +++ b/builder/ncloud/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Builder assume this implements packer.Builder @@ -31,7 +32,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { ui.Message("Creating Naver Cloud Platform Connection ...") config := Config{ AccessKey: b.config.AccessKey, diff --git a/builder/ncloud/step_create_block_storage_instance.go b/builder/ncloud/step_create_block_storage_instance.go index d0f584507..767484243 100644 --- a/builder/ncloud/step_create_block_storage_instance.go +++ b/builder/ncloud/step_create_block_storage_instance.go @@ -9,8 +9,8 @@ import ( "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCreateBlockStorageInstance struct is for making extra block storage @@ -23,7 +23,7 @@ type StepCreateBlockStorageInstance struct { } // NewStepCreateBlockStorageInstance make StepCreateBlockStorage struct to make extra block storage -func NewStepCreateBlockStorageInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreateBlockStorageInstance { +func NewStepCreateBlockStorageInstance(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepCreateBlockStorageInstance { var step = &StepCreateBlockStorageInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_create_login_key.go b/builder/ncloud/step_create_login_key.go index 7cf7ae505..5189c97db 100644 --- a/builder/ncloud/step_create_login_key.go +++ b/builder/ncloud/step_create_login_key.go @@ -6,8 +6,8 @@ import ( "time" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type LoginKey struct { @@ -22,7 +22,7 @@ type StepCreateLoginKey struct { Error func(e error) } -func NewStepCreateLoginKey(conn *NcloudAPIClient, ui packer.Ui) *StepCreateLoginKey { +func NewStepCreateLoginKey(conn *NcloudAPIClient, ui packersdk.Ui) *StepCreateLoginKey { var step = &StepCreateLoginKey{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_create_public_ip_instance.go b/builder/ncloud/step_create_public_ip_instance.go index 17820c241..1fcfce714 100644 --- a/builder/ncloud/step_create_public_ip_instance.go +++ b/builder/ncloud/step_create_public_ip_instance.go @@ -8,8 +8,8 @@ import ( "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreatePublicIPInstance struct { @@ -21,7 +21,7 @@ type StepCreatePublicIPInstance struct { Config *Config } -func NewStepCreatePublicIPInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreatePublicIPInstance { +func NewStepCreatePublicIPInstance(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepCreatePublicIPInstance { var step = &StepCreatePublicIPInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_create_server_image.go b/builder/ncloud/step_create_server_image.go index 9b36b3ffc..3e665721e 100644 --- a/builder/ncloud/step_create_server_image.go +++ b/builder/ncloud/step_create_server_image.go @@ -7,8 +7,8 @@ import ( "time" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateServerImage struct { @@ -19,7 +19,7 @@ type StepCreateServerImage struct { Config *Config } -func NewStepCreateServerImage(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreateServerImage { +func NewStepCreateServerImage(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepCreateServerImage { var step = &StepCreateServerImage{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_create_server_instance.go b/builder/ncloud/step_create_server_instance.go index 48b1b11ef..4d8a80891 100644 --- a/builder/ncloud/step_create_server_instance.go +++ b/builder/ncloud/step_create_server_instance.go @@ -10,8 +10,8 @@ import ( "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateServerInstance struct { @@ -24,7 +24,7 @@ type StepCreateServerInstance struct { serverInstanceNo string } -func NewStepCreateServerInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreateServerInstance { +func NewStepCreateServerInstance(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepCreateServerInstance { var step = &StepCreateServerInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_delete_block_storage_instance.go b/builder/ncloud/step_delete_block_storage_instance.go index a3cdc70a5..72cf85b17 100644 --- a/builder/ncloud/step_delete_block_storage_instance.go +++ b/builder/ncloud/step_delete_block_storage_instance.go @@ -8,8 +8,8 @@ import ( "time" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDeleteBlockStorageInstance struct { @@ -20,7 +20,7 @@ type StepDeleteBlockStorageInstance struct { Config *Config } -func NewStepDeleteBlockStorageInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepDeleteBlockStorageInstance { +func NewStepDeleteBlockStorageInstance(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepDeleteBlockStorageInstance { var step = &StepDeleteBlockStorageInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_get_rootpassword.go b/builder/ncloud/step_get_rootpassword.go index 94daf1382..6c724a34d 100644 --- a/builder/ncloud/step_get_rootpassword.go +++ b/builder/ncloud/step_get_rootpassword.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepGetRootPassword struct { @@ -17,7 +17,7 @@ type StepGetRootPassword struct { Config *Config } -func NewStepGetRootPassword(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepGetRootPassword { +func NewStepGetRootPassword(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepGetRootPassword { var step = &StepGetRootPassword{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_stop_server_instance.go b/builder/ncloud/step_stop_server_instance.go index b95dca774..e0ed00dd3 100644 --- a/builder/ncloud/step_stop_server_instance.go +++ b/builder/ncloud/step_stop_server_instance.go @@ -7,8 +7,8 @@ import ( "time" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepStopServerInstance struct { @@ -18,7 +18,7 @@ type StepStopServerInstance struct { Error func(e error) } -func NewStepStopServerInstance(conn *NcloudAPIClient, ui packer.Ui) *StepStopServerInstance { +func NewStepStopServerInstance(conn *NcloudAPIClient, ui packersdk.Ui) *StepStopServerInstance { var step = &StepStopServerInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_terminate_server_instance.go b/builder/ncloud/step_terminate_server_instance.go index b8de7b79f..706220f81 100644 --- a/builder/ncloud/step_terminate_server_instance.go +++ b/builder/ncloud/step_terminate_server_instance.go @@ -6,8 +6,8 @@ import ( "time" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepTerminateServerInstance struct { @@ -17,7 +17,7 @@ type StepTerminateServerInstance struct { Error func(e error) } -func NewStepTerminateServerInstance(conn *NcloudAPIClient, ui packer.Ui) *StepTerminateServerInstance { +func NewStepTerminateServerInstance(conn *NcloudAPIClient, ui packersdk.Ui) *StepTerminateServerInstance { var step = &StepTerminateServerInstance{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/ncloud/step_validate_template.go b/builder/ncloud/step_validate_template.go index 52866e5ee..36ca61c49 100644 --- a/builder/ncloud/step_validate_template.go +++ b/builder/ncloud/step_validate_template.go @@ -9,8 +9,8 @@ import ( "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud" "github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/olekukonko/tablewriter" ) @@ -27,7 +27,7 @@ type StepValidateTemplate struct { } // NewStepValidateTemplate : function for Validation a template -func NewStepValidateTemplate(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepValidateTemplate { +func NewStepValidateTemplate(conn *NcloudAPIClient, ui packersdk.Ui, config *Config) *StepValidateTemplate { var step = &StepValidateTemplate{ Conn: conn, Say: func(message string) { ui.Say(message) }, diff --git a/builder/null/builder.go b/builder/null/builder.go index a48da95fb..1397e5fcc 100644 --- a/builder/null/builder.go +++ b/builder/null/builder.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const BuilderId = "fnoeding.null" @@ -28,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { steps := []multistep.Step{} steps = append(steps, diff --git a/builder/oneandone/builder.go b/builder/oneandone/builder.go index 915d1c470..b6cee6d01 100644 --- a/builder/oneandone/builder.go +++ b/builder/oneandone/builder.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const BuilderId = "packer.oneandone" @@ -30,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) diff --git a/builder/oneandone/step_create_server.go b/builder/oneandone/step_create_server.go index 3cd1e7de7..18293e86b 100644 --- a/builder/oneandone/step_create_server.go +++ b/builder/oneandone/step_create_server.go @@ -7,14 +7,14 @@ import ( "time" "github.com/1and1/oneandone-cloudserver-sdk-go" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateServer struct{} func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) token := oneandone.SetToken(c.Token) @@ -105,7 +105,7 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu func (s *stepCreateServer) Cleanup(state multistep.StateBag) { c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Removing Server...") diff --git a/builder/oneandone/step_create_sshkey.go b/builder/oneandone/step_create_sshkey.go index 2da8f5839..64dd5f667 100644 --- a/builder/oneandone/step_create_sshkey.go +++ b/builder/oneandone/step_create_sshkey.go @@ -7,8 +7,8 @@ import ( "fmt" "io/ioutil" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -18,7 +18,7 @@ type StepCreateSSHKey struct { } func (s *StepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) if c.Comm.SSHPrivateKeyFile != "" { diff --git a/builder/oneandone/step_take_snapshot.go b/builder/oneandone/step_take_snapshot.go index c5b128ef5..2c8571f79 100644 --- a/builder/oneandone/step_take_snapshot.go +++ b/builder/oneandone/step_take_snapshot.go @@ -4,14 +4,14 @@ import ( "context" "github.com/1and1/oneandone-cloudserver-sdk-go" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepTakeSnapshot struct{} func (s *stepTakeSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) ui.Say("Creating Snapshot...") diff --git a/builder/openstack/access_config.go b/builder/openstack/access_config.go index fafcdae65..8c18beed0 100644 --- a/builder/openstack/access_config.go +++ b/builder/openstack/access_config.go @@ -16,7 +16,7 @@ import ( "github.com/gophercloud/gophercloud/openstack" "github.com/gophercloud/utils/openstack/clientconfig" "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -240,7 +240,7 @@ func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { return nil } -func (c *AccessConfig) enableDebug(ui packer.Ui) { +func (c *AccessConfig) enableDebug(ui packersdk.Ui) { c.osClient.HTTPClient = http.Client{ Transport: &DebugRoundTripper{ ui: ui, @@ -288,7 +288,7 @@ func (c *AccessConfig) getEndpointType() gophercloud.Availability { } type DebugRoundTripper struct { - ui packer.Ui + ui packersdk.Ui rt http.RoundTripper numReauthAttempts int } diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index a61b1d547..b4a9fb80e 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -72,7 +73,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { if b.config.PackerDebug { b.config.enableDebug(ui) } diff --git a/builder/openstack/step_add_image_members.go b/builder/openstack/step_add_image_members.go index cbbb9f5e6..d612d8510 100644 --- a/builder/openstack/step_add_image_members.go +++ b/builder/openstack/step_add_image_members.go @@ -5,15 +5,15 @@ import ( "fmt" "github.com/gophercloud/gophercloud/openstack/imageservice/v2/members" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepAddImageMembers struct{} func (s *stepAddImageMembers) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { imageId := state.Get("image").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if len(config.ImageMembers) == 0 { diff --git a/builder/openstack/step_allocate_ip.go b/builder/openstack/step_allocate_ip.go index 6ba8c0262..c113d3385 100644 --- a/builder/openstack/step_allocate_ip.go +++ b/builder/openstack/step_allocate_ip.go @@ -6,8 +6,8 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/floatingips" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepAllocateIp struct { @@ -18,7 +18,7 @@ type StepAllocateIp struct { } func (s *StepAllocateIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) server := state.Get("server").(*servers.Server) @@ -145,7 +145,7 @@ func (s *StepAllocateIp) Run(ctx context.Context, state multistep.StateBag) mult func (s *StepAllocateIp) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceIP := state.Get("access_ip").(*floatingips.FloatingIP) // Don't clean up if unless required diff --git a/builder/openstack/step_create_image.go b/builder/openstack/step_create_image.go index b2f792d0d..f6d241dc0 100644 --- a/builder/openstack/step_create_image.go +++ b/builder/openstack/step_create_image.go @@ -11,8 +11,8 @@ import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateImage struct { @@ -22,7 +22,7 @@ type stepCreateImage struct { func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) server := state.Get("server").(*servers.Server) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // We need the v2 compute client computeClient, err := config.computeV2Client() diff --git a/builder/openstack/step_create_volume.go b/builder/openstack/step_create_volume.go index 687d92a54..3c820580a 100644 --- a/builder/openstack/step_create_volume.go +++ b/builder/openstack/step_create_volume.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateVolume struct { @@ -25,7 +25,7 @@ func (s *StepCreateVolume) Run(ctx context.Context, state multistep.StateBag) mu } config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) sourceImage := state.Get("source_image").(string) // We will need Block Storage and Image services clients. @@ -99,7 +99,7 @@ func (s *StepCreateVolume) Cleanup(state multistep.StateBag) { } config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) blockStorageClient, err := config.blockStorageV3Client() if err != nil { diff --git a/builder/openstack/step_detach_volume.go b/builder/openstack/step_detach_volume.go index d711e87a2..05553d587 100644 --- a/builder/openstack/step_detach_volume.go +++ b/builder/openstack/step_detach_volume.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDetachVolume struct { @@ -20,7 +20,7 @@ func (s *StepDetachVolume) Run(ctx context.Context, state multistep.StateBag) mu } config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) blockStorageClient, err := config.blockStorageV3Client() if err != nil { diff --git a/builder/openstack/step_discover_network.go b/builder/openstack/step_discover_network.go index 811c98a55..210272497 100644 --- a/builder/openstack/step_discover_network.go +++ b/builder/openstack/step_discover_network.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDiscoverNetwork struct { @@ -17,7 +17,7 @@ type StepDiscoverNetwork struct { func (s *StepDiscoverNetwork) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) networkClient, err := config.networkV2Client() if err != nil { diff --git a/builder/openstack/step_get_password.go b/builder/openstack/step_get_password.go index f039198fb..6d77bbb71 100644 --- a/builder/openstack/step_get_password.go +++ b/builder/openstack/step_get_password.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -24,7 +25,7 @@ type StepGetPassword struct { func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip if we're not using winrm if s.Comm.Type != "winrm" { diff --git a/builder/openstack/step_key_pair.go b/builder/openstack/step_key_pair.go index 1faa67787..77da85df0 100644 --- a/builder/openstack/step_key_pair.go +++ b/builder/openstack/step_key_pair.go @@ -11,8 +11,8 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" "golang.org/x/crypto/ssh" ) @@ -26,7 +26,7 @@ type StepKeyPair struct { } func (s *StepKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") @@ -123,7 +123,7 @@ func (s *StepKeyPair) Run(ctx context.Context, state multistep.StateBag) multist } // Work around for https://github.com/hashicorp/packer/issues/2526 -func berToDer(ber []byte, ui packer.Ui) []byte { +func berToDer(ber []byte, ui packersdk.Ui) []byte { // Check if x/crypto/ssh can parse the key _, err := ssh.ParsePrivateKey(ber) if err == nil { @@ -171,7 +171,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) { } config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // We need the v2 compute client computeClient, err := config.computeV2Client() diff --git a/builder/openstack/step_load_flavor.go b/builder/openstack/step_load_flavor.go index 7e7176640..a865a4374 100644 --- a/builder/openstack/step_load_flavor.go +++ b/builder/openstack/step_load_flavor.go @@ -7,8 +7,8 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/flavors" flavors_utils "github.com/gophercloud/utils/openstack/compute/v2/flavors" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepLoadFlavor gets the FlavorRef from a Flavor. It first assumes @@ -20,7 +20,7 @@ type StepLoadFlavor struct { func (s *StepLoadFlavor) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // We need the v2 compute client client, err := config.computeV2Client() diff --git a/builder/openstack/step_run_source_server.go b/builder/openstack/step_run_source_server.go index 007023de8..1524a76f8 100644 --- a/builder/openstack/step_run_source_server.go +++ b/builder/openstack/step_run_source_server.go @@ -9,8 +9,8 @@ import ( "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume" "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRunSourceServer struct { @@ -31,7 +31,7 @@ func (s *StepRunSourceServer) Run(ctx context.Context, state multistep.StateBag) flavor := state.Get("flavor_id").(string) sourceImage := state.Get("source_image").(string) networks := state.Get("networks").([]servers.Network) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // We need the v2 compute client computeClient, err := config.computeV2Client() @@ -141,7 +141,7 @@ func (s *StepRunSourceServer) Cleanup(state multistep.StateBag) { } config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // We need the v2 compute client computeClient, err := config.computeV2Client() diff --git a/builder/openstack/step_source_image_info.go b/builder/openstack/step_source_image_info.go index 3b7c5b798..915c16bd7 100644 --- a/builder/openstack/step_source_image_info.go +++ b/builder/openstack/step_source_image_info.go @@ -9,8 +9,8 @@ import ( "github.com/gophercloud/gophercloud/openstack/imageservice/v2/imageimport" "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" "github.com/gophercloud/gophercloud/pagination" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSourceImageInfo struct { @@ -35,7 +35,7 @@ func PropertiesSatisfied(image *images.Image, props *map[string]string) bool { func (s *StepSourceImageInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client, err := config.imageV2Client() if err != nil { @@ -181,7 +181,7 @@ func (s *StepSourceImageInfo) Run(ctx context.Context, state multistep.StateBag) func (s *StepSourceImageInfo) Cleanup(state multistep.StateBag) { if s.ExternalSourceImageURL != "" { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client, err := config.imageV2Client() if err != nil { diff --git a/builder/openstack/step_stop_server.go b/builder/openstack/step_stop_server.go index f4e00e25e..6a7baa5d8 100644 --- a/builder/openstack/step_stop_server.go +++ b/builder/openstack/step_stop_server.go @@ -8,14 +8,14 @@ import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/startstop" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepStopServer struct{} func (s *StepStopServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) server := state.Get("server").(*servers.Server) diff --git a/builder/openstack/step_update_image_mindisk.go b/builder/openstack/step_update_image_mindisk.go index 15412f29b..fcaf55468 100644 --- a/builder/openstack/step_update_image_mindisk.go +++ b/builder/openstack/step_update_image_mindisk.go @@ -5,15 +5,15 @@ import ( "fmt" "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepUpdateImageMinDisk struct{} func (s *stepUpdateImageMinDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { imageId := state.Get("image").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.ImageMinDisk == 0 { diff --git a/builder/openstack/step_update_image_tags.go b/builder/openstack/step_update_image_tags.go index 8f0adf582..34fdc674d 100644 --- a/builder/openstack/step_update_image_tags.go +++ b/builder/openstack/step_update_image_tags.go @@ -6,15 +6,15 @@ import ( "strings" imageservice "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepUpdateImageTags struct{} func (s *stepUpdateImageTags) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { imageId := state.Get("image").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if len(config.ImageTags) == 0 { diff --git a/builder/openstack/step_update_image_visibility.go b/builder/openstack/step_update_image_visibility.go index fb2ab9fd1..e7da67d7c 100644 --- a/builder/openstack/step_update_image_visibility.go +++ b/builder/openstack/step_update_image_visibility.go @@ -5,15 +5,15 @@ import ( "fmt" imageservice "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepUpdateImageVisibility struct{} func (s *stepUpdateImageVisibility) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { imageId := state.Get("image").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.ImageVisibility == "" { diff --git a/builder/openstack/step_wait_for_rackconnect.go b/builder/openstack/step_wait_for_rackconnect.go index 3386642f5..d97da15f4 100644 --- a/builder/openstack/step_wait_for_rackconnect.go +++ b/builder/openstack/step_wait_for_rackconnect.go @@ -6,8 +6,8 @@ import ( "time" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepWaitForRackConnect struct { @@ -21,7 +21,7 @@ func (s *StepWaitForRackConnect) Run(ctx context.Context, state multistep.StateB config := state.Get("config").(*Config) server := state.Get("server").(*servers.Server) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // We need the v2 compute client computeClient, err := config.computeV2Client() diff --git a/builder/oracle/classic/builder.go b/builder/oracle/classic/builder.go index fc97066f1..8e672881f 100644 --- a/builder/oracle/classic/builder.go +++ b/builder/oracle/classic/builder.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // BuilderId uniquely identifies the builder @@ -45,7 +46,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { loggingEnabled := os.Getenv("PACKER_OCI_CLASSIC_LOGGING") != "" httpClient := cleanhttp.DefaultClient() config := &opc.Config{ diff --git a/builder/oracle/classic/step_add_keys.go b/builder/oracle/classic/step_add_keys.go index 60a448560..bf1598d85 100644 --- a/builder/oracle/classic/step_add_keys.go +++ b/builder/oracle/classic/step_add_keys.go @@ -6,8 +6,8 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepAddKeysToAPI struct { @@ -17,7 +17,7 @@ type stepAddKeysToAPI struct { func (s *stepAddKeysToAPI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // get variables from state - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) client := state.Get("client").(*compute.Client) @@ -62,7 +62,7 @@ func (s *stepAddKeysToAPI) Cleanup(state multistep.StateBag) { // No keys were generated; none need to be cleaned up. return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting SSH keys...") deleteInput := compute.DeleteSSHKeyInput{Name: config.Comm.SSHKeyPairName} client := state.Get("client").(*compute.Client) diff --git a/builder/oracle/classic/step_attach_volume.go b/builder/oracle/classic/step_attach_volume.go index e0882f35b..686c01a2b 100644 --- a/builder/oracle/classic/step_attach_volume.go +++ b/builder/oracle/classic/step_attach_volume.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepAttachVolume struct { @@ -17,7 +17,7 @@ type stepAttachVolume struct { func (s *stepAttachVolume) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*compute.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceInfo := state.Get(s.InstanceInfoKey).(*compute.InstanceInfo) saClient := client.StorageAttachments() @@ -47,7 +47,7 @@ func (s *stepAttachVolume) Cleanup(state multistep.StateBag) { return } client := state.Get("client").(*compute.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) saClient := client.StorageAttachments() saI := &compute.DeleteStorageAttachmentInput{ diff --git a/builder/oracle/classic/step_create_image.go b/builder/oracle/classic/step_create_image.go index 481d03406..7eae037d1 100644 --- a/builder/oracle/classic/step_create_image.go +++ b/builder/oracle/classic/step_create_image.go @@ -6,15 +6,15 @@ import ( "log" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateImage struct { } func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*compute.Client) config := state.Get("config").(*Config) imageFile := state.Get("image_file").(string) @@ -55,7 +55,7 @@ func (s *stepCreateImage) Cleanup(state multistep.StateBag) { client := state.Get("client").(*compute.Client) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cleaning up Image...") machineImageClient := client.MachineImages() diff --git a/builder/oracle/classic/step_create_instance.go b/builder/oracle/classic/step_create_instance.go index 35fd4e9b6..86ea5d74f 100644 --- a/builder/oracle/classic/step_create_instance.go +++ b/builder/oracle/classic/step_create_instance.go @@ -5,15 +5,15 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateInstance struct{} func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // get variables from state - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating Instance...") config := state.Get("config").(*Config) @@ -63,7 +63,7 @@ func (s *stepCreateInstance) Cleanup(state multistep.StateBag) { } // terminate instance - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*compute.Client) config := state.Get("config").(*Config) diff --git a/builder/oracle/classic/step_create_ip_reservation.go b/builder/oracle/classic/step_create_ip_reservation.go index 367ba9221..24948c68a 100644 --- a/builder/oracle/classic/step_create_ip_reservation.go +++ b/builder/oracle/classic/step_create_ip_reservation.go @@ -5,15 +5,15 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) type stepCreateIPReservation struct{} func (s *stepCreateIPReservation) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) client := state.Get("client").(*compute.Client) @@ -47,7 +47,7 @@ func (s *stepCreateIPReservation) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cleaning up IP reservations...") client := state.Get("client").(*compute.Client) diff --git a/builder/oracle/classic/step_create_persistent_volume.go b/builder/oracle/classic/step_create_persistent_volume.go index 349fc0b8b..268354c62 100644 --- a/builder/oracle/classic/step_create_persistent_volume.go +++ b/builder/oracle/classic/step_create_persistent_volume.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreatePersistentVolume struct { @@ -20,7 +20,7 @@ type stepCreatePersistentVolume struct { func (s *stepCreatePersistentVolume) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*compute.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating Volume...") c := &compute.CreateStorageVolumeInput{ @@ -49,7 +49,7 @@ func (s *stepCreatePersistentVolume) Run(ctx context.Context, state multistep.St func (s *stepCreatePersistentVolume) Cleanup(state multistep.StateBag) { client := state.Get("client").(*compute.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cleaning up Volume...") c := &compute.DeleteStorageVolumeInput{ diff --git a/builder/oracle/classic/step_create_pv_builder.go b/builder/oracle/classic/step_create_pv_builder.go index a544c9615..c10849a8b 100644 --- a/builder/oracle/classic/step_create_pv_builder.go +++ b/builder/oracle/classic/step_create_pv_builder.go @@ -6,8 +6,8 @@ import ( "log" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreatePVBuilder struct { @@ -18,7 +18,7 @@ type stepCreatePVBuilder struct { func (s *stepCreatePVBuilder) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // get variables from state - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating builder instance...") config := state.Get("config").(*Config) @@ -73,7 +73,7 @@ func (s *stepCreatePVBuilder) Cleanup(state multistep.StateBag) { } // terminate instance - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*compute.Client) ui.Say("Terminating builder instance...") diff --git a/builder/oracle/classic/step_create_pv_master.go b/builder/oracle/classic/step_create_pv_master.go index 28e85fe6d..bb4843ddc 100644 --- a/builder/oracle/classic/step_create_pv_master.go +++ b/builder/oracle/classic/step_create_pv_master.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreatePVMaster struct { @@ -16,7 +16,7 @@ type stepCreatePVMaster struct { } func (s *stepCreatePVMaster) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating master instance...") config := state.Get("config").(*Config) @@ -75,7 +75,7 @@ func (s *stepCreatePVMaster) Cleanup(state multistep.StateBag) { } // terminate instance - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*compute.Client) ui.Say("Terminating builder instance...") diff --git a/builder/oracle/classic/step_list_images.go b/builder/oracle/classic/step_list_images.go index 8b30d2cbb..b7aea6e56 100644 --- a/builder/oracle/classic/step_list_images.go +++ b/builder/oracle/classic/step_list_images.go @@ -5,15 +5,15 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepListImages struct{} func (s *stepListImages) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // get variables from state - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) client := state.Get("client").(*compute.Client) ui.Say("Adding image to image list...") diff --git a/builder/oracle/classic/step_security.go b/builder/oracle/classic/step_security.go index d6ad9252c..b290e41a4 100644 --- a/builder/oracle/classic/step_security.go +++ b/builder/oracle/classic/step_security.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepSecurity struct { @@ -19,7 +19,7 @@ type stepSecurity struct { } func (s *stepSecurity) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) runID := state.Get("run_id").(string) client := state.Get("client").(*compute.Client) @@ -115,7 +115,7 @@ func (s *stepSecurity) Cleanup(state multistep.StateBag) { } client := state.Get("client").(*compute.Client) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say("Deleting temporary rules and lists...") diff --git a/builder/oracle/classic/step_snapshot.go b/builder/oracle/classic/step_snapshot.go index 993bc2835..6120df025 100644 --- a/builder/oracle/classic/step_snapshot.go +++ b/builder/oracle/classic/step_snapshot.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepSnapshot struct { @@ -15,7 +15,7 @@ type stepSnapshot struct { func (s *stepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // get variables from state - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating Snapshot...") config := state.Get("config").(*Config) client := state.Get("client").(*compute.Client) @@ -53,7 +53,7 @@ func (s *stepSnapshot) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting Snapshot...") client := state.Get("client").(*compute.Client) snapClient := client.Snapshots() diff --git a/builder/oracle/classic/step_terminate_pv_master.go b/builder/oracle/classic/step_terminate_pv_master.go index 0d4d2a013..87820ff48 100644 --- a/builder/oracle/classic/step_terminate_pv_master.go +++ b/builder/oracle/classic/step_terminate_pv_master.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/go-oracle-terraform/compute" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepTerminatePVMaster struct { @@ -14,7 +14,7 @@ type stepTerminatePVMaster struct { func (s *stepTerminatePVMaster) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // get variables from state - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting master Instance...") client := state.Get("client").(*compute.Client) diff --git a/builder/oracle/classic/step_upload_image.go b/builder/oracle/classic/step_upload_image.go index 04fd1e896..a8519462a 100644 --- a/builder/oracle/classic/step_upload_image.go +++ b/builder/oracle/classic/step_upload_image.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -25,7 +26,7 @@ type uploadCmdData struct { } func (s *stepUploadImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) comm := state.Get("communicator").(packer.Communicator) config := state.Get("config").(*Config) runID := state.Get("run_id").(string) diff --git a/builder/oracle/common/step_ssh_key_pair.go b/builder/oracle/common/step_ssh_key_pair.go index 3a87a824a..4ea4f5a9c 100644 --- a/builder/oracle/common/step_ssh_key_pair.go +++ b/builder/oracle/common/step_ssh_key_pair.go @@ -11,8 +11,8 @@ import ( "runtime" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -23,7 +23,7 @@ type StepKeyPair struct { } func (s *StepKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") diff --git a/builder/oracle/oci/builder.go b/builder/oracle/oci/builder.go index 0368ac678..bc385e7f7 100644 --- a/builder/oracle/oci/builder.go +++ b/builder/oracle/oci/builder.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/oracle/oci-go-sdk/core" ) @@ -38,7 +39,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { driver, err := NewDriverOCI(&b.config) if err != nil { return nil, err diff --git a/builder/oracle/oci/step_create_instance.go b/builder/oracle/oci/step_create_instance.go index 0ebe41eab..bc4a0a067 100644 --- a/builder/oracle/oci/step_create_instance.go +++ b/builder/oracle/oci/step_create_instance.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCreateInstance struct{} @@ -13,7 +13,7 @@ type stepCreateInstance struct{} func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { var ( driver = state.Get("driver").(Driver) - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) config = state.Get("config").(*Config) ) @@ -47,7 +47,7 @@ func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) func (s *stepCreateInstance) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) idRaw, ok := state.GetOk("instance_id") if !ok { diff --git a/builder/oracle/oci/step_get_default_credentials.go b/builder/oracle/oci/step_get_default_credentials.go index 602565050..902f8c050 100644 --- a/builder/oracle/oci/step_get_default_credentials.go +++ b/builder/oracle/oci/step_get_default_credentials.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepGetDefaultCredentials struct { @@ -19,7 +20,7 @@ type stepGetDefaultCredentials struct { func (s *stepGetDefaultCredentials) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { var ( driver = state.Get("driver").(*driverOCI) - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) id = state.Get("instance_id").(string) ) diff --git a/builder/oracle/oci/step_image.go b/builder/oracle/oci/step_image.go index 460aa9c91..69b0550b9 100644 --- a/builder/oracle/oci/step_image.go +++ b/builder/oracle/oci/step_image.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepImage struct{} @@ -13,7 +13,7 @@ type stepImage struct{} func (s *stepImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { var ( driver = state.Get("driver").(Driver) - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) instanceID = state.Get("instance_id").(string) ) diff --git a/builder/oracle/oci/step_instance_info.go b/builder/oracle/oci/step_instance_info.go index e1052b5ed..11edc3f1d 100644 --- a/builder/oracle/oci/step_instance_info.go +++ b/builder/oracle/oci/step_instance_info.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepInstanceInfo struct{} @@ -13,7 +13,7 @@ type stepInstanceInfo struct{} func (s *stepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { var ( driver = state.Get("driver").(Driver) - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) id = state.Get("instance_id").(string) ) diff --git a/builder/osc/bsu/builder.go b/builder/osc/bsu/builder.go index 0f05b93ad..c36ae8346 100644 --- a/builder/osc/bsu/builder.go +++ b/builder/osc/bsu/builder.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -84,7 +85,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { oscConn := b.config.NewOSCClient() // Setup the state bag and initial state for the steps diff --git a/builder/osc/bsu/step_create_omi.go b/builder/osc/bsu/step_create_omi.go index 0b7935173..63199f344 100644 --- a/builder/osc/bsu/step_create_omi.go +++ b/builder/osc/bsu/step_create_omi.go @@ -7,8 +7,8 @@ import ( "github.com/antihax/optional" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -21,7 +21,7 @@ func (s *stepCreateOMI) Run(ctx context.Context, state multistep.StateBag) multi config := state.Get("config").(*Config) oscconn := state.Get("osc").(*osc.APIClient) vm := state.Get("vm").(osc.Vm) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Create the image omiName := config.OMIName @@ -113,7 +113,7 @@ func (s *stepCreateOMI) Cleanup(state multistep.StateBag) { } oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deregistering the OMI because cancellation or error...") DeleteOpts := osc.DeleteImageRequest{ImageId: s.image.ImageId} diff --git a/builder/osc/bsusurrogate/builder.go b/builder/osc/bsusurrogate/builder.go index b4e2f2db2..18d4802ca 100644 --- a/builder/osc/bsusurrogate/builder.go +++ b/builder/osc/bsusurrogate/builder.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -102,7 +103,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { oscConn := b.config.NewOSCClient() // Setup the state bag and initial state for the steps diff --git a/builder/osc/bsusurrogate/step_register_omi.go b/builder/osc/bsusurrogate/step_register_omi.go index f63a87135..eea7beb76 100644 --- a/builder/osc/bsusurrogate/step_register_omi.go +++ b/builder/osc/bsusurrogate/step_register_omi.go @@ -6,8 +6,8 @@ import ( "github.com/antihax/optional" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -24,7 +24,7 @@ func (s *StepRegisterOMI) Run(ctx context.Context, state multistep.StateBag) mul config := state.Get("config").(*Config) oscconn := state.Get("osc").(*osc.APIClient) snapshotIds := state.Get("snapshot_ids").(map[string]string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Registering the OMI...") @@ -100,7 +100,7 @@ func (s *StepRegisterOMI) Cleanup(state multistep.StateBag) { } oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deregistering the OMI because cancellation or error...") deregisterOpts := osc.DeleteImageRequest{ImageId: s.image.ImageId} diff --git a/builder/osc/bsusurrogate/step_snapshop_volumes.go b/builder/osc/bsusurrogate/step_snapshop_volumes.go index 2f1d027dd..29abadd13 100644 --- a/builder/osc/bsusurrogate/step_snapshop_volumes.go +++ b/builder/osc/bsusurrogate/step_snapshop_volumes.go @@ -9,8 +9,8 @@ import ( "github.com/antihax/optional" multierror "github.com/hashicorp/go-multierror" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -25,7 +25,7 @@ type StepSnapshotVolumes struct { func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName string, state multistep.StateBag) error { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(osc.Vm) var volumeId string @@ -60,7 +60,7 @@ func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName str } func (s *StepSnapshotVolumes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) s.snapshotIds = map[string]string{} @@ -98,7 +98,7 @@ func (s *StepSnapshotVolumes) Cleanup(state multistep.StateBag) { if cancelled || halted { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Removing snapshots since we cancelled or halted...") for _, snapshotID := range s.snapshotIds { _, _, err := oscconn.SnapshotApi.DeleteSnapshot(context.Background(), &osc.DeleteSnapshotOpts{ diff --git a/builder/osc/bsuvolume/builder.go b/builder/osc/bsuvolume/builder.go index 05a2f9c43..57f4454e1 100644 --- a/builder/osc/bsuvolume/builder.go +++ b/builder/osc/bsuvolume/builder.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -87,7 +88,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // clientConfig, err := b.config.Config() // if err != nil { // return nil, err diff --git a/builder/osc/bsuvolume/step_tag_bsu_volumes.go b/builder/osc/bsuvolume/step_tag_bsu_volumes.go index 4d313ffd3..53b515fdb 100644 --- a/builder/osc/bsuvolume/step_tag_bsu_volumes.go +++ b/builder/osc/bsuvolume/step_tag_bsu_volumes.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/outscale/osc-sdk-go/osc" ) @@ -20,7 +20,7 @@ type stepTagBSUVolumes struct { func (s *stepTagBSUVolumes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) vm := state.Get("vm").(osc.Vm) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) volumes := make(BsuVolumes) for _, instanceBlockDevices := range vm.BlockDeviceMappings { diff --git a/builder/osc/chroot/builder.go b/builder/osc/chroot/builder.go index 7740bc357..b05463b1c 100644 --- a/builder/osc/chroot/builder.go +++ b/builder/osc/chroot/builder.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -187,7 +188,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warns, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { if runtime.GOOS != "linux" { return nil, errors.New("The outscale-chroot builder only works on Linux environments.") } diff --git a/builder/osc/chroot/run_local_commands.go b/builder/osc/chroot/run_local_commands.go index 175a2afa6..0220db88d 100644 --- a/builder/osc/chroot/run_local_commands.go +++ b/builder/osc/chroot/run_local_commands.go @@ -5,11 +5,12 @@ import ( "fmt" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" sl "github.com/hashicorp/packer/packer-plugin-sdk/shell-local" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) -func RunLocalCommands(commands []string, wrappedCommand CommandWrapper, ictx interpolate.Context, ui packer.Ui) error { +func RunLocalCommands(commands []string, wrappedCommand CommandWrapper, ictx interpolate.Context, ui packersdk.Ui) error { ctx := context.TODO() for _, rawCmd := range commands { intCmd, err := interpolate.Render(rawCmd, &ictx) diff --git a/builder/osc/chroot/step_check_root_device.go b/builder/osc/chroot/step_check_root_device.go index 418fd3909..97566e8d3 100644 --- a/builder/osc/chroot/step_check_root_device.go +++ b/builder/osc/chroot/step_check_root_device.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -14,7 +14,7 @@ type StepCheckRootDevice struct{} func (s *StepCheckRootDevice) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { image := state.Get("source_image").(osc.Image) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Checking the root device on source OMI...") diff --git a/builder/osc/chroot/step_chroot_provision.go b/builder/osc/chroot/step_chroot_provision.go index ef659c41b..607c68306 100644 --- a/builder/osc/chroot/step_chroot_provision.go +++ b/builder/osc/chroot/step_chroot_provision.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepChrootProvision provisions the instance within a chroot. @@ -16,7 +17,7 @@ type StepChrootProvision struct { func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { hook := state.Get("hook").(packer.Hook) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) // Create our communicator diff --git a/builder/osc/chroot/step_copy_files.go b/builder/osc/chroot/step_copy_files.go index a7c7adbcb..6be919506 100644 --- a/builder/osc/chroot/step_copy_files.go +++ b/builder/osc/chroot/step_copy_files.go @@ -7,8 +7,8 @@ import ( "log" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCopyFiles copies some files from the host into the chroot environment. @@ -23,7 +23,7 @@ type StepCopyFiles struct { func (s *StepCopyFiles) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) stderr := new(bytes.Buffer) @@ -63,7 +63,7 @@ func (s *StepCopyFiles) Run(ctx context.Context, state multistep.StateBag) multi } func (s *StepCopyFiles) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } diff --git a/builder/osc/chroot/step_create_omi.go b/builder/osc/chroot/step_create_omi.go index cfd43fdb4..051ca7740 100644 --- a/builder/osc/chroot/step_create_omi.go +++ b/builder/osc/chroot/step_create_omi.go @@ -6,8 +6,8 @@ import ( "github.com/antihax/optional" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -21,7 +21,7 @@ func (s *StepCreateOMI) Run(ctx context.Context, state multistep.StateBag) multi config := state.Get("config").(*Config) osconn := state.Get("osc").(*osc.APIClient) snapshotId := state.Get("snapshot_id").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating the OMI...") diff --git a/builder/osc/chroot/step_create_volume.go b/builder/osc/chroot/step_create_volume.go index f2fdc7ab3..447c7f652 100644 --- a/builder/osc/chroot/step_create_volume.go +++ b/builder/osc/chroot/step_create_volume.go @@ -8,8 +8,8 @@ import ( "github.com/antihax/optional" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/outscale/osc-sdk-go/osc" ) @@ -32,7 +32,7 @@ func (s *StepCreateVolume) Run(ctx context.Context, state multistep.StateBag) mu config := state.Get("config").(*Config) oscconn := state.Get("osc").(*osc.APIClient) vm := state.Get("vm").(osc.Vm) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) var err error @@ -127,7 +127,7 @@ func (s *StepCreateVolume) Cleanup(state multistep.StateBag) { } oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting the created BSU volume...") _, _, err := oscconn.VolumeApi.DeleteVolume(context.Background(), &osc.DeleteVolumeOpts{ diff --git a/builder/osc/chroot/step_early_cleanup.go b/builder/osc/chroot/step_early_cleanup.go index e84ac77e2..e8cf9593f 100644 --- a/builder/osc/chroot/step_early_cleanup.go +++ b/builder/osc/chroot/step_early_cleanup.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepEarlyCleanup performs some of the cleanup steps early in order to @@ -14,7 +14,7 @@ import ( type StepEarlyCleanup struct{} func (s *StepEarlyCleanup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cleanupKeys := []string{ "copy_files_cleanup", "mount_extra_cleanup", diff --git a/builder/osc/chroot/step_early_unflock.go b/builder/osc/chroot/step_early_unflock.go index 3a39fb7fe..fa3828315 100644 --- a/builder/osc/chroot/step_early_unflock.go +++ b/builder/osc/chroot/step_early_unflock.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepEarlyUnflock unlocks the flock. @@ -14,7 +14,7 @@ type StepEarlyUnflock struct{} func (s *StepEarlyUnflock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { cleanup := state.Get("flock_cleanup").(Cleanup) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) log.Println("Unlocking file lock...") if err := cleanup.CleanupFunc(state); err != nil { diff --git a/builder/osc/chroot/step_flock.go b/builder/osc/chroot/step_flock.go index 5465a72fe..c8d92f5a3 100644 --- a/builder/osc/chroot/step_flock.go +++ b/builder/osc/chroot/step_flock.go @@ -7,8 +7,8 @@ import ( "os" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepFlock provisions the instance within a chroot. @@ -20,7 +20,7 @@ type StepFlock struct { } func (s *StepFlock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) lockfile := "/var/lock/packer-chroot/lock" if err := os.MkdirAll(filepath.Dir(lockfile), 0755); err != nil { diff --git a/builder/osc/chroot/step_link_volume.go b/builder/osc/chroot/step_link_volume.go index 6940e64c4..e14244dc1 100644 --- a/builder/osc/chroot/step_link_volume.go +++ b/builder/osc/chroot/step_link_volume.go @@ -6,8 +6,8 @@ import ( "github.com/antihax/optional" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -26,7 +26,7 @@ func (s *StepLinkVolume) Run(ctx context.Context, state multistep.StateBag) mult oscconn := state.Get("osc").(*osc.APIClient) device := state.Get("device").(string) vm := state.Get("vm").(osc.Vm) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) volumeId := state.Get("volume_id").(string) // For the API call, it expects "sd" prefixed devices. @@ -67,7 +67,7 @@ func (s *StepLinkVolume) Run(ctx context.Context, state multistep.StateBag) mult } func (s *StepLinkVolume) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } @@ -79,7 +79,7 @@ func (s *StepLinkVolume) CleanupFunc(state multistep.StateBag) error { } oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Detaching BSU volume...") _, _, err := oscconn.VolumeApi.UnlinkVolume(context.Background(), &osc.UnlinkVolumeOpts{ diff --git a/builder/osc/chroot/step_mount_device.go b/builder/osc/chroot/step_mount_device.go index 936425ac0..11bbebfe9 100644 --- a/builder/osc/chroot/step_mount_device.go +++ b/builder/osc/chroot/step_mount_device.go @@ -9,8 +9,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -32,7 +32,7 @@ type StepMountDevice struct { func (s *StepMountDevice) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := state.Get("device").(string) if config.NVMEDevicePath != "" { // customizable device path for mounting NVME block devices on c5 and m5 HVM @@ -153,7 +153,7 @@ func (s *StepMountDevice) Run(_ context.Context, state multistep.StateBag) multi } func (s *StepMountDevice) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } @@ -164,7 +164,7 @@ func (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error { return nil } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) ui.Say("Unmounting the root device...") diff --git a/builder/osc/chroot/step_mount_extra.go b/builder/osc/chroot/step_mount_extra.go index f9b70dc4f..87706081f 100644 --- a/builder/osc/chroot/step_mount_extra.go +++ b/builder/osc/chroot/step_mount_extra.go @@ -8,8 +8,8 @@ import ( "os/exec" "syscall" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepMountExtra mounts the attached device. @@ -23,7 +23,7 @@ type StepMountExtra struct { func (s *StepMountExtra) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) s.mounts = make([]string, 0, len(config.ChrootMounts)) @@ -76,7 +76,7 @@ func (s *StepMountExtra) Run(ctx context.Context, state multistep.StateBag) mult } func (s *StepMountExtra) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) diff --git a/builder/osc/chroot/step_post_mount_commands.go b/builder/osc/chroot/step_post_mount_commands.go index 303ddeee5..cbfb8e176 100644 --- a/builder/osc/chroot/step_post_mount_commands.go +++ b/builder/osc/chroot/step_post_mount_commands.go @@ -3,8 +3,8 @@ package chroot import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type postMountCommandsData struct { @@ -22,7 +22,7 @@ func (s *StepPostMountCommands) Run(ctx context.Context, state multistep.StateBa config := state.Get("config").(*Config) device := state.Get("device").(string) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) if len(s.Commands) == 0 { diff --git a/builder/osc/chroot/step_pre_mount_commands.go b/builder/osc/chroot/step_pre_mount_commands.go index 26e93adf3..4ddb5523a 100644 --- a/builder/osc/chroot/step_pre_mount_commands.go +++ b/builder/osc/chroot/step_pre_mount_commands.go @@ -3,8 +3,8 @@ package chroot import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type preMountCommandsData struct { @@ -19,7 +19,7 @@ type StepPreMountCommands struct { func (s *StepPreMountCommands) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) device := state.Get("device").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(CommandWrapper) if len(s.Commands) == 0 { diff --git a/builder/osc/chroot/step_prepare_device.go b/builder/osc/chroot/step_prepare_device.go index 65af71acf..79e5ee9a8 100644 --- a/builder/osc/chroot/step_prepare_device.go +++ b/builder/osc/chroot/step_prepare_device.go @@ -6,8 +6,8 @@ import ( "log" "os" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepPrepareDevice finds an available device and sets it. @@ -16,7 +16,7 @@ type StepPrepareDevice struct { func (s *StepPrepareDevice) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) device := config.DevicePath if device == "" { diff --git a/builder/osc/chroot/step_snapshot.go b/builder/osc/chroot/step_snapshot.go index 04e036462..ba518ce72 100644 --- a/builder/osc/chroot/step_snapshot.go +++ b/builder/osc/chroot/step_snapshot.go @@ -7,8 +7,8 @@ import ( "github.com/antihax/optional" osccommon "github.com/hashicorp/packer/builder/osc/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -23,7 +23,7 @@ type StepSnapshot struct { func (s *StepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) volumeId := state.Get("volume_id").(string) ui.Say("Creating snapshot...") @@ -75,7 +75,7 @@ func (s *StepSnapshot) Cleanup(state multistep.StateBag) { if cancelled || halted { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Removing snapshot since we cancelled or halted...") _, _, err := oscconn.SnapshotApi.DeleteSnapshot(context.Background(), &osc.DeleteSnapshotOpts{ DeleteSnapshotRequest: optional.NewInterface(osc.DeleteSnapshotRequest{SnapshotId: s.snapshotId}), diff --git a/builder/osc/chroot/step_vm_info.go b/builder/osc/chroot/step_vm_info.go index fa9d6079e..6ae4c8b9b 100644 --- a/builder/osc/chroot/step_vm_info.go +++ b/builder/osc/chroot/step_vm_info.go @@ -6,8 +6,8 @@ import ( "log" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -17,7 +17,7 @@ type StepVmInfo struct{} func (s *StepVmInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) //session := state.Get("clientConfig").(*session.Session) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Get our own vm ID ui.Say("Gathering information about this Outscale vm...") diff --git a/builder/osc/common/step_cleanup_volumes.go b/builder/osc/common/step_cleanup_volumes.go index 171dfaa40..a71cc1fbb 100644 --- a/builder/osc/common/step_cleanup_volumes.go +++ b/builder/osc/common/step_cleanup_volumes.go @@ -6,8 +6,8 @@ import ( "reflect" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -32,7 +32,7 @@ func (s *StepCleanupVolumes) Cleanup(state multistep.StateBag) { if vmRaw != nil { vm = vmRaw.(osc.Vm) } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if vm.VmId == "" { ui.Say("No volumes to clean up, skipping") return diff --git a/builder/osc/common/step_create_tags.go b/builder/osc/common/step_create_tags.go index db06dec96..902ce1c5a 100644 --- a/builder/osc/common/step_create_tags.go +++ b/builder/osc/common/step_create_tags.go @@ -7,8 +7,8 @@ import ( "github.com/antihax/optional" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/hashicorp/packer/builder/osc/common/retry" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/outscale/osc-sdk-go/osc" ) @@ -21,7 +21,7 @@ type StepCreateTags struct { func (s *StepCreateTags) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("accessConfig").(*AccessConfig) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) omis := state.Get("omis").(map[string]string) if !s.Tags.IsSet() && !s.SnapshotTags.IsSet() { diff --git a/builder/osc/common/step_deregister_omi.go b/builder/osc/common/step_deregister_omi.go index f080d3d3c..e7d538659 100644 --- a/builder/osc/common/step_deregister_omi.go +++ b/builder/osc/common/step_deregister_omi.go @@ -8,8 +8,8 @@ import ( "github.com/antihax/optional" "github.com/outscale/osc-sdk-go/osc" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepDeregisterOMI struct { @@ -26,7 +26,7 @@ func (s *StepDeregisterOMI) Run(_ context.Context, state multistep.StateBag) mul return multistep.ActionContinue } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) s.Regions = append(s.Regions, s.AccessConfig.GetRegion()) diff --git a/builder/osc/common/step_get_password.go b/builder/osc/common/step_get_password.go index ccef02481..c68570601 100644 --- a/builder/osc/common/step_get_password.go +++ b/builder/osc/common/step_get_password.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -28,7 +29,7 @@ type StepGetPassword struct { } func (s *StepGetPassword) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip if we're not using winrm if s.Comm.Type != "winrm" { diff --git a/builder/osc/common/step_key_pair.go b/builder/osc/common/step_key_pair.go index 6589c4831..be3d5f1cf 100644 --- a/builder/osc/common/step_key_pair.go +++ b/builder/osc/common/step_key_pair.go @@ -8,8 +8,8 @@ import ( "github.com/antihax/optional" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -22,7 +22,7 @@ type StepKeyPair struct { } func (s *StepKeyPair) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") @@ -110,7 +110,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) { var ( conn = state.Get("osc").(*osc.APIClient) - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) ) // Remove the keypair diff --git a/builder/osc/common/step_network_info.go b/builder/osc/common/step_network_info.go index e1fdb8bfe..e3ed82abc 100644 --- a/builder/osc/common/step_network_info.go +++ b/builder/osc/common/step_network_info.go @@ -8,8 +8,8 @@ import ( "sort" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -48,7 +48,7 @@ func mostFreeOscSubnet(subnets []osc.Subnet) osc.Subnet { //Run ... func (s *StepNetworkInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // NET if s.NetId == "" && !s.NetFilter.Empty() { diff --git a/builder/osc/common/step_pre_validate.go b/builder/osc/common/step_pre_validate.go index 7c3151505..3ac8d3622 100644 --- a/builder/osc/common/step_pre_validate.go +++ b/builder/osc/common/step_pre_validate.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -20,7 +20,7 @@ type StepPreValidate struct { } func (s *StepPreValidate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.ForceDeregister { ui.Say("Force Deregister flag found, skipping prevalidating OMI Name") return multistep.ActionContinue diff --git a/builder/osc/common/step_public_ip.go b/builder/osc/common/step_public_ip.go index 51d4f2c8c..2074ba8b7 100644 --- a/builder/osc/common/step_public_ip.go +++ b/builder/osc/common/step_public_ip.go @@ -6,8 +6,8 @@ import ( "github.com/antihax/optional" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -22,7 +22,7 @@ type StepPublicIp struct { func (s *StepPublicIp) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { var ( - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) conn = state.Get("osc").(*osc.APIClient) ) @@ -61,7 +61,7 @@ func (s *StepPublicIp) Cleanup(state multistep.StateBag) { var ( conn = state.Get("osc").(*osc.APIClient) - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) ) // Remove the Public IP diff --git a/builder/osc/common/step_run_source_vm.go b/builder/osc/common/step_run_source_vm.go index 36188058a..d81f7396e 100644 --- a/builder/osc/common/step_run_source_vm.go +++ b/builder/osc/common/step_run_source_vm.go @@ -14,8 +14,8 @@ import ( "github.com/hashicorp/packer/builder/osc/common/retry" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -48,7 +48,7 @@ type StepRunSourceVm struct { func (s *StepRunSourceVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) securityGroupIds := state.Get("securityGroupIds").([]string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) userData := s.UserData if s.UserDataFile != "" { @@ -302,7 +302,7 @@ func (s *StepRunSourceVm) Run(ctx context.Context, state multistep.StateBag) mul func (s *StepRunSourceVm) Cleanup(state multistep.StateBag) { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Terminate the source vm if it exists if s.vmId != "" { diff --git a/builder/osc/common/step_security_group.go b/builder/osc/common/step_security_group.go index 789f101e7..79fb5192a 100644 --- a/builder/osc/common/step_security_group.go +++ b/builder/osc/common/step_security_group.go @@ -8,8 +8,8 @@ import ( "github.com/antihax/optional" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" "github.com/outscale/osc-sdk-go/osc" ) @@ -25,7 +25,7 @@ type StepSecurityGroup struct { func (s *StepSecurityGroup) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { var ( - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) conn = state.Get("osc").(*osc.APIClient) netID = state.Get("net_id").(string) ) @@ -153,7 +153,7 @@ func (s *StepSecurityGroup) Cleanup(state multistep.StateBag) { } var ( - ui = state.Get("ui").(packer.Ui) + ui = state.Get("ui").(packersdk.Ui) conn = state.Get("osc").(*osc.APIClient) ) diff --git a/builder/osc/common/step_source_omi_info.go b/builder/osc/common/step_source_omi_info.go index 64e1df704..18fc81877 100644 --- a/builder/osc/common/step_source_omi_info.go +++ b/builder/osc/common/step_source_omi_info.go @@ -8,8 +8,8 @@ import ( "time" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -43,7 +43,7 @@ func mostRecentOscOmi(images []osc.Image) osc.Image { func (s *StepSourceOMIInfo) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) params := osc.ReadImagesRequest{ Filters: osc.FiltersImage{}, diff --git a/builder/osc/common/step_stop_bsu_backed_vm.go b/builder/osc/common/step_stop_bsu_backed_vm.go index 5c45a126b..aad924cd7 100644 --- a/builder/osc/common/step_stop_bsu_backed_vm.go +++ b/builder/osc/common/step_stop_bsu_backed_vm.go @@ -7,8 +7,8 @@ import ( "github.com/antihax/optional" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/hashicorp/packer/builder/osc/common/retry" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/outscale/osc-sdk-go/osc" ) @@ -20,7 +20,7 @@ type StepStopBSUBackedVm struct { func (s *StepStopBSUBackedVm) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { oscconn := state.Get("osc").(*osc.APIClient) vm := state.Get("vm").(osc.Vm) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip when it is a spot vm if s.Skip { diff --git a/builder/osc/common/step_update_bsu_vm.go b/builder/osc/common/step_update_bsu_vm.go index 48cbbcd13..325b5db6a 100644 --- a/builder/osc/common/step_update_bsu_vm.go +++ b/builder/osc/common/step_update_bsu_vm.go @@ -14,7 +14,7 @@ type StepUpdateBSUBackedVm struct { func (s *StepUpdateBSUBackedVm) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { // oapiconn := state.Get("oapi").(*oapi.Client) // vm := state.Get("vm").(*oapi.Vm) - // ui := state.Get("ui").(packer.Ui) + // ui := state.Get("ui").(packersdk.Ui) // Set SriovNetSupport to "simple". See http://goo.gl/icuXh5 // As of February 2017, this applies to C3, C4, D2, I2, R3, and M4 (excluding m4.16xlarge) diff --git a/builder/osc/common/step_update_omi.go b/builder/osc/common/step_update_omi.go index d523426de..790e977d1 100644 --- a/builder/osc/common/step_update_omi.go +++ b/builder/osc/common/step_update_omi.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/outscale/osc-sdk-go/osc" ) @@ -20,7 +20,7 @@ type StepUpdateOMIAttributes struct { func (s *StepUpdateOMIAttributes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("accessConfig").(*AccessConfig) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) omis := state.Get("omis").(map[string]string) snapshots := state.Get("snapshots").(map[string][]string) diff --git a/builder/osc/common/tags.go b/builder/osc/common/tags.go index 446c191bb..dca8922a4 100644 --- a/builder/osc/common/tags.go +++ b/builder/osc/common/tags.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/antihax/optional" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/outscale/osc-sdk-go/osc" ) @@ -14,7 +14,7 @@ import ( type TagMap map[string]string type OSCTags []osc.ResourceTag -func (t OSCTags) Report(ui packer.Ui) { +func (t OSCTags) Report(ui packersdk.Ui) { for _, tag := range t { ui.Message(fmt.Sprintf("Adding tag: \"%s\": \"%s\"", tag.Key, tag.Value)) @@ -46,7 +46,7 @@ func (t TagMap) OSCTags(ctx interpolate.Context, region string, state multistep. return oscTags, nil } -func CreateOSCTags(conn *osc.APIClient, resourceID string, ui packer.Ui, tags OSCTags) error { +func CreateOSCTags(conn *osc.APIClient, resourceID string, ui packersdk.Ui, tags OSCTags) error { tags.Report(ui) _, _, err := conn.TagApi.CreateTags(context.Background(), &osc.CreateTagsOpts{ diff --git a/builder/parallels/common/step_attach_floppy.go b/builder/parallels/common/step_attach_floppy.go index 7d310ab75..854a9204c 100644 --- a/builder/parallels/common/step_attach_floppy.go +++ b/builder/parallels/common/step_attach_floppy.go @@ -5,15 +5,15 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepAttachFloppy is a step that attaches a floppy to the virtual machine. // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -34,7 +34,7 @@ func (s *StepAttachFloppy) Run(ctx context.Context, state multistep.StateBag) mu } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Deleting any current floppy disk...") diff --git a/builder/parallels/common/step_attach_parallels_tools.go b/builder/parallels/common/step_attach_parallels_tools.go index 638408115..f1a8a807a 100644 --- a/builder/parallels/common/step_attach_parallels_tools.go +++ b/builder/parallels/common/step_attach_parallels_tools.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepAttachParallelsTools is a step that attaches Parallels Tools ISO image @@ -15,7 +15,7 @@ import ( // Uses: // driver Driver // parallels_tools_path string -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -28,7 +28,7 @@ type StepAttachParallelsTools struct { // If ISO image is not specified, then this step will be skipped. func (s *StepAttachParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) // If we're not attaching the guest additions then just return @@ -65,7 +65,7 @@ func (s *StepAttachParallelsTools) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) log.Println("Detaching Parallels Tools ISO...") diff --git a/builder/parallels/common/step_compact_disk.go b/builder/parallels/common/step_compact_disk.go index e757336ef..26aea8479 100644 --- a/builder/parallels/common/step_compact_disk.go +++ b/builder/parallels/common/step_compact_disk.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCompactDisk is a step that removes all empty blocks from expanding @@ -14,7 +14,7 @@ import ( // Uses: // driver Driver // vmName string -// ui packer.Ui +// ui packersdk.Ui // // Produces: // @@ -26,7 +26,7 @@ type StepCompactDisk struct { func (s *StepCompactDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) vmName := state.Get("vmName").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Skip { ui.Say("Skipping disk compaction step...") diff --git a/builder/parallels/common/step_output_dir.go b/builder/parallels/common/step_output_dir.go index 97115d8e4..b0b7083b9 100644 --- a/builder/parallels/common/step_output_dir.go +++ b/builder/parallels/common/step_output_dir.go @@ -8,8 +8,8 @@ import ( "path/filepath" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepOutputDir sets up the output directory by creating it if it does @@ -23,7 +23,7 @@ type StepOutputDir struct { // Run sets up the output directory. func (s *StepOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if _, err := os.Stat(s.Path); err == nil && s.Force { ui.Say("Deleting previous output directory...") @@ -60,7 +60,7 @@ func (s *StepOutputDir) Cleanup(state multistep.StateBag) { } if cancelled || halted { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting output directory...") for i := 0; i < 5; i++ { diff --git a/builder/parallels/common/step_prlctl.go b/builder/parallels/common/step_prlctl.go index 5f31812b6..431b0a327 100644 --- a/builder/parallels/common/step_prlctl.go +++ b/builder/parallels/common/step_prlctl.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -19,7 +19,7 @@ type commandTemplate struct { // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -31,7 +31,7 @@ type StepPrlctl struct { // Run executes `prlctl` commands. func (s *StepPrlctl) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if len(s.Commands) > 0 { diff --git a/builder/parallels/common/step_run.go b/builder/parallels/common/step_run.go index a0772fdd0..a98ff9190 100644 --- a/builder/parallels/common/step_run.go +++ b/builder/parallels/common/step_run.go @@ -4,15 +4,15 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepRun is a step that starts the virtual machine. // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -23,7 +23,7 @@ type StepRun struct { // Run starts the VM. func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Starting the virtual machine...") @@ -50,7 +50,7 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if running, _ := driver.IsRunning(s.vmName); running { if err := driver.Stop(s.vmName); err != nil { diff --git a/builder/parallels/common/step_shutdown.go b/builder/parallels/common/step_shutdown.go index cd1f5a232..20c06a39a 100644 --- a/builder/parallels/common/step_shutdown.go +++ b/builder/parallels/common/step_shutdown.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepShutdown is a step that shuts down the machine. It first attempts to do @@ -18,7 +19,7 @@ import ( // Uses: // communicator packer.Communicator // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -32,7 +33,7 @@ type StepShutdown struct { func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.Command != "" { diff --git a/builder/parallels/common/step_type_boot_command.go b/builder/parallels/common/step_type_boot_command.go index 31f55e8f7..344e8aa4b 100644 --- a/builder/parallels/common/step_type_boot_command.go +++ b/builder/parallels/common/step_type_boot_command.go @@ -5,9 +5,9 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -32,7 +32,7 @@ type StepTypeBootCommand struct { func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { debug := state.Get("debug").(bool) httpPort := state.Get("http_port").(int) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) driver := state.Get("driver").(Driver) // Wait the for the vm to boot. diff --git a/builder/parallels/common/step_upload_parallels_tools.go b/builder/parallels/common/step_upload_parallels_tools.go index f70e7b60b..e50ca8923 100644 --- a/builder/parallels/common/step_upload_parallels_tools.go +++ b/builder/parallels/common/step_upload_parallels_tools.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -16,7 +17,7 @@ import ( // Uses: // communicator packer.Communicator // parallels_tools_path string -// ui packer.Ui +// ui packersdk.Ui // // Produces: type toolsPathTemplate struct { @@ -29,7 +30,7 @@ type toolsPathTemplate struct { // Uses: // communicator packer.Communicator // parallels_tools_path string -// ui packer.Ui +// ui packersdk.Ui type StepUploadParallelsTools struct { ParallelsToolsFlavor string ParallelsToolsGuestPath string @@ -40,7 +41,7 @@ type StepUploadParallelsTools struct { // Run uploads the Parallels Tools ISO to the VM. func (s *StepUploadParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // If we're attaching then don't do this, since we attached. if s.ParallelsToolsMode != ParallelsToolsModeUpload { diff --git a/builder/parallels/common/step_upload_version.go b/builder/parallels/common/step_upload_version.go index 072bece70..a42d6257d 100644 --- a/builder/parallels/common/step_upload_version.go +++ b/builder/parallels/common/step_upload_version.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepUploadVersion is a step that uploads a file containing the version of @@ -16,7 +17,7 @@ import ( // Uses: // communicator packer.Communicator // driver Driver -// ui packer.Ui +// ui packersdk.Ui type StepUploadVersion struct { Path string } @@ -25,7 +26,7 @@ type StepUploadVersion struct { func (s *StepUploadVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Path == "" { log.Println("ParallelsVersionFile is empty. Not uploading.") diff --git a/builder/parallels/iso/builder.go b/builder/parallels/iso/builder.go index 0fa823f0a..2788537bf 100644 --- a/builder/parallels/iso/builder.go +++ b/builder/parallels/iso/builder.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/shutdowncommand" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -180,7 +181,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with Parallels driver, err := parallelscommon.NewDriver() if err != nil { diff --git a/builder/parallels/iso/step_attach_iso.go b/builder/parallels/iso/step_attach_iso.go index ccaced1c0..c59c80c33 100644 --- a/builder/parallels/iso/step_attach_iso.go +++ b/builder/parallels/iso/step_attach_iso.go @@ -6,8 +6,8 @@ import ( "log" parallelscommon "github.com/hashicorp/packer/builder/parallels/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step attaches the ISO to the virtual machine. @@ -15,7 +15,7 @@ import ( // Uses: // driver Driver // iso_path string -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -25,7 +25,7 @@ type stepAttachISO struct{} func (s *stepAttachISO) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(parallelscommon.Driver) isoPath := state.Get("iso_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) // Attach the disk to the cdrom0 device. We couldn't use a separated device because it is failed to boot in PD9 [GH-1667] @@ -55,7 +55,7 @@ func (s *stepAttachISO) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) // Detach ISO by setting an empty string image. diff --git a/builder/parallels/iso/step_create_disk.go b/builder/parallels/iso/step_create_disk.go index dbe71e4b7..d70f6d749 100644 --- a/builder/parallels/iso/step_create_disk.go +++ b/builder/parallels/iso/step_create_disk.go @@ -6,8 +6,8 @@ import ( "strconv" parallelscommon "github.com/hashicorp/packer/builder/parallels/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates the virtual disk that will be used as the @@ -17,7 +17,7 @@ type stepCreateDisk struct{} func (s *stepCreateDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) command := []string{ diff --git a/builder/parallels/iso/step_create_vm.go b/builder/parallels/iso/step_create_vm.go index ad7a32f81..f92ce5ddf 100644 --- a/builder/parallels/iso/step_create_vm.go +++ b/builder/parallels/iso/step_create_vm.go @@ -6,8 +6,8 @@ import ( "strconv" parallelscommon "github.com/hashicorp/packer/builder/parallels/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates the actual virtual machine. @@ -22,7 +22,7 @@ func (s *stepCreateVM) Run(ctx context.Context, state multistep.StateBag) multis config := state.Get("config").(*Config) driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.VMName commands := make([][]string, 3) @@ -91,7 +91,7 @@ func (s *stepCreateVM) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Unregistering virtual machine...") if err := driver.Prlctl("unregister", s.vmName); err != nil { diff --git a/builder/parallels/iso/step_set_boot_order.go b/builder/parallels/iso/step_set_boot_order.go index 7d50251be..d8891dd81 100644 --- a/builder/parallels/iso/step_set_boot_order.go +++ b/builder/parallels/iso/step_set_boot_order.go @@ -5,15 +5,15 @@ import ( "fmt" parallelscommon "github.com/hashicorp/packer/builder/parallels/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step sets the device boot order for the virtual machine. // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -21,7 +21,7 @@ type stepSetBootOrder struct{} func (s *stepSetBootOrder) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) // Set new boot order diff --git a/builder/parallels/pvm/builder.go b/builder/parallels/pvm/builder.go index 532c37658..c535d55d4 100644 --- a/builder/parallels/pvm/builder.go +++ b/builder/parallels/pvm/builder.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Builder implements packer.Builder and builds the actual Parallels @@ -33,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a Parallels appliance. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with Parallels driver, err := parallelscommon.NewDriver() if err != nil { diff --git a/builder/parallels/pvm/step_import.go b/builder/parallels/pvm/step_import.go index 1530ee301..6ee096504 100644 --- a/builder/parallels/pvm/step_import.go +++ b/builder/parallels/pvm/step_import.go @@ -5,8 +5,8 @@ import ( "fmt" parallelscommon "github.com/hashicorp/packer/builder/parallels/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step imports an PVM VM into Parallels. @@ -18,7 +18,7 @@ type StepImport struct { func (s *StepImport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say(fmt.Sprintf("Importing VM: %s", s.SourcePath)) @@ -41,7 +41,7 @@ func (s *StepImport) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(parallelscommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Unregistering virtual machine...") if err := driver.Prlctl("unregister", s.vmName); err != nil { diff --git a/builder/profitbricks/builder.go b/builder/profitbricks/builder.go index 2261a96f5..c89c805ee 100644 --- a/builder/profitbricks/builder.go +++ b/builder/profitbricks/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const BuilderId = "packer.profitbricks" @@ -29,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("config", &b.config) diff --git a/builder/profitbricks/step_create_server.go b/builder/profitbricks/step_create_server.go index 21464c673..7bcd60986 100644 --- a/builder/profitbricks/step_create_server.go +++ b/builder/profitbricks/step_create_server.go @@ -9,15 +9,15 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/profitbricks/profitbricks-sdk-go" ) type stepCreateServer struct{} func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) profitbricks.SetAuth(c.PBUsername, c.PBPassword) @@ -158,7 +158,7 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu func (s *stepCreateServer) Cleanup(state multistep.StateBag) { c := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Removing Virtual Data Center...") @@ -240,7 +240,7 @@ func (d *stepCreateServer) getImageId(imageName string, c *Config) string { return "" } -func (d *stepCreateServer) getImageAlias(imageAlias string, location string, ui packer.Ui) string { +func (d *stepCreateServer) getImageAlias(imageAlias string, location string, ui packersdk.Ui) string { if imageAlias == "" { return "" } diff --git a/builder/profitbricks/step_create_ssh_key.go b/builder/profitbricks/step_create_ssh_key.go index 19d8a2044..aaa8fae48 100644 --- a/builder/profitbricks/step_create_ssh_key.go +++ b/builder/profitbricks/step_create_ssh_key.go @@ -6,8 +6,8 @@ import ( "encoding/pem" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -17,7 +17,7 @@ type StepCreateSSHKey struct { } func (s *StepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) if c.Comm.SSHPrivateKeyFile != "" { diff --git a/builder/profitbricks/step_take_snapshot.go b/builder/profitbricks/step_take_snapshot.go index c545f8521..58d3024e7 100644 --- a/builder/profitbricks/step_take_snapshot.go +++ b/builder/profitbricks/step_take_snapshot.go @@ -5,15 +5,15 @@ import ( "encoding/json" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/profitbricks/profitbricks-sdk-go" ) type stepTakeSnapshot struct{} func (s *stepTakeSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) ui.Say("Creating ProfitBricks snapshot...") diff --git a/builder/proxmox/clone/builder.go b/builder/proxmox/clone/builder.go index f84fb216e..b1cf07c4c 100644 --- a/builder/proxmox/clone/builder.go +++ b/builder/proxmox/clone/builder.go @@ -6,6 +6,7 @@ import ( proxmox "github.com/hashicorp/packer/builder/proxmox/common" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "context" "fmt" @@ -27,7 +28,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return b.config.Prepare(raws...) } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("clone-config", &b.config) diff --git a/builder/proxmox/clone/step_ssh_key_pair.go b/builder/proxmox/clone/step_ssh_key_pair.go index 3626f80c8..f2bbb5fa1 100644 --- a/builder/proxmox/clone/step_ssh_key_pair.go +++ b/builder/proxmox/clone/step_ssh_key_pair.go @@ -7,8 +7,8 @@ import ( common "github.com/hashicorp/packer/builder/proxmox/common" "github.com/hashicorp/packer/helper/communicator/ssh" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -20,7 +20,7 @@ type StepSshKeyPair struct { } func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*common.Config) if c.Comm.SSHPassword != "" { @@ -99,7 +99,7 @@ func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) mult func (s *StepSshKeyPair) Cleanup(state multistep.StateBag) { if s.Debug { if err := os.Remove(s.DebugKeyPath); err != nil { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Error(fmt.Sprintf( "Error removing debug key '%s': %s", s.DebugKeyPath, err)) } diff --git a/builder/proxmox/common/builder.go b/builder/proxmox/common/builder.go index b592a6fdb..981c62576 100644 --- a/builder/proxmox/common/builder.go +++ b/builder/proxmox/common/builder.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func NewSharedBuilder(id string, config Config, preSteps []multistep.Step, postSteps []multistep.Step, vmCreator ProxmoxVMCreator) *Builder { @@ -33,7 +34,7 @@ type Builder struct { vmCreator ProxmoxVMCreator } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook, state multistep.StateBag) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook, state multistep.StateBag) (packer.Artifact, error) { var err error tlsConfig := &tls.Config{ InsecureSkipVerify: b.config.SkipCertValidation, diff --git a/builder/proxmox/common/step_convert_to_template.go b/builder/proxmox/common/step_convert_to_template.go index 3d177bfc9..58d4dfe41 100644 --- a/builder/proxmox/common/step_convert_to_template.go +++ b/builder/proxmox/common/step_convert_to_template.go @@ -6,8 +6,8 @@ import ( "log" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepConvertToTemplate takes the running VM configured in earlier steps, stops it, and @@ -24,7 +24,7 @@ type templateConverter interface { var _ templateConverter = &proxmox.Client{} func (s *stepConvertToTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("proxmoxClient").(templateConverter) vmRef := state.Get("vmRef").(*proxmox.VmRef) diff --git a/builder/proxmox/common/step_finalize_template_config.go b/builder/proxmox/common/step_finalize_template_config.go index 901d30bff..d1bdea3d6 100644 --- a/builder/proxmox/common/step_finalize_template_config.go +++ b/builder/proxmox/common/step_finalize_template_config.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepFinalizeTemplateConfig does any required modifications to the configuration _after_ @@ -23,7 +23,7 @@ type templateFinalizer interface { var _ templateFinalizer = &proxmox.Client{} func (s *stepFinalizeTemplateConfig) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("proxmoxClient").(templateFinalizer) c := state.Get("config").(*Config) vmRef := state.Get("vmRef").(*proxmox.VmRef) diff --git a/builder/proxmox/common/step_start_vm.go b/builder/proxmox/common/step_start_vm.go index 09951660f..53b3c6754 100644 --- a/builder/proxmox/common/step_start_vm.go +++ b/builder/proxmox/common/step_start_vm.go @@ -7,8 +7,8 @@ import ( "strconv" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepStartVM takes the given configuration and starts a VM on the given Proxmox node. @@ -24,7 +24,7 @@ type ProxmoxVMCreator interface { } func (s *stepStartVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("proxmoxClient").(*proxmox.Client) c := state.Get("config").(*Config) @@ -180,7 +180,7 @@ func (s *stepStartVM) Cleanup(state multistep.StateBag) { } client := state.Get("proxmoxClient").(startedVMCleaner) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Destroy the server we just created ui.Say("Stopping VM") diff --git a/builder/proxmox/common/step_type_boot_command.go b/builder/proxmox/common/step_type_boot_command.go index 878d9b837..bcbe71e5a 100644 --- a/builder/proxmox/common/step_type_boot_command.go +++ b/builder/proxmox/common/step_type_boot_command.go @@ -9,9 +9,9 @@ import ( "time" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -34,7 +34,7 @@ type commandTyper interface { var _ commandTyper = &proxmox.Client{} func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) client := state.Get("proxmoxClient").(commandTyper) vmRef := state.Get("vmRef").(*proxmox.VmRef) diff --git a/builder/proxmox/iso/builder.go b/builder/proxmox/iso/builder.go index 8cc248aec..b6b59abcc 100644 --- a/builder/proxmox/iso/builder.go +++ b/builder/proxmox/iso/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // The unique id for the builder @@ -29,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { const downloadPathKey = "downloaded_iso_path" -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("iso-config", &b.config) diff --git a/builder/proxmox/iso/step_finalize_iso.go b/builder/proxmox/iso/step_finalize_iso.go index ee504c0e7..ef9388896 100644 --- a/builder/proxmox/iso/step_finalize_iso.go +++ b/builder/proxmox/iso/step_finalize_iso.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepFinalizeISOTemplate does any ISO-builder specific modifications after @@ -23,7 +23,7 @@ type templateFinalizer interface { var _ templateFinalizer = &proxmox.Client{} func (s *stepFinalizeISOTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("proxmoxClient").(templateFinalizer) c := state.Get("iso-config").(*Config) vmRef := state.Get("vmRef").(*proxmox.VmRef) diff --git a/builder/proxmox/iso/step_upload_additional_isos.go b/builder/proxmox/iso/step_upload_additional_isos.go index e2b7af894..8b2c87f3a 100644 --- a/builder/proxmox/iso/step_upload_additional_isos.go +++ b/builder/proxmox/iso/step_upload_additional_isos.go @@ -7,8 +7,8 @@ import ( "path/filepath" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepUploadAdditionalISOs uploads all additional ISO files that are mountet @@ -18,7 +18,7 @@ type stepUploadAdditionalISOs struct{} var _ uploader = &proxmox.Client{} func (s *stepUploadAdditionalISOs) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("proxmoxClient").(uploader) c := state.Get("iso-config").(*Config) diff --git a/builder/proxmox/iso/step_upload_iso.go b/builder/proxmox/iso/step_upload_iso.go index 3edef379a..4a54bc87e 100644 --- a/builder/proxmox/iso/step_upload_iso.go +++ b/builder/proxmox/iso/step_upload_iso.go @@ -8,8 +8,8 @@ import ( "path/filepath" "github.com/Telmate/proxmox-api-go/proxmox" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepUploadISO uploads an ISO file to Proxmox so we can boot from it @@ -22,7 +22,7 @@ type uploader interface { var _ uploader = &proxmox.Client{} func (s *stepUploadISO) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("proxmoxClient").(uploader) c := state.Get("iso-config").(*Config) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index fc24b592c..3522ed59f 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const BuilderId = "transcend.qemu" @@ -34,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with Qemu driver, err := b.newDriver(b.config.QemuBinary) if err != nil { diff --git a/builder/qemu/step_configure_qmp.go b/builder/qemu/step_configure_qmp.go index de87d99bf..a85ed092b 100644 --- a/builder/qemu/step_configure_qmp.go +++ b/builder/qemu/step_configure_qmp.go @@ -8,15 +8,15 @@ import ( "time" "github.com/digitalocean/go-qemu/qmp" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step configures the VM to enable the QMP listener. // // Uses: // config *config -// ui packer.Ui +// ui packersdk.Ui // // Produces: type stepConfigureQMP struct { @@ -26,7 +26,7 @@ type stepConfigureQMP struct { func (s *stepConfigureQMP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !config.QMPEnable { return multistep.ActionContinue diff --git a/builder/qemu/step_configure_vnc.go b/builder/qemu/step_configure_vnc.go index 87a095dc7..84da95bc9 100644 --- a/builder/qemu/step_configure_vnc.go +++ b/builder/qemu/step_configure_vnc.go @@ -6,16 +6,16 @@ import ( "log" "math/rand" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step configures the VM to enable the VNC server. // // Uses: // config *config -// ui packer.Ui +// ui packersdk.Ui // // Produces: // vnc_port int - The port that VNC is configured to listen on. @@ -40,7 +40,7 @@ func VNCPassword() string { func (s *stepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Find an open VNC port. Note that this can still fail later on // because we have to release the port at some point. But this does its diff --git a/builder/qemu/step_convert_disk.go b/builder/qemu/step_convert_disk.go index 1f7952248..09636b5b0 100644 --- a/builder/qemu/step_convert_disk.go +++ b/builder/qemu/step_convert_disk.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "os" @@ -28,7 +28,7 @@ type stepConvertDisk struct { func (s *stepConvertDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) diskName := s.VMName diff --git a/builder/qemu/step_copy_disk.go b/builder/qemu/step_copy_disk.go index c5600a31b..9a7cfd817 100644 --- a/builder/qemu/step_copy_disk.go +++ b/builder/qemu/step_copy_disk.go @@ -5,8 +5,8 @@ import ( "fmt" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step copies the virtual disk that will be used as the @@ -24,7 +24,7 @@ type stepCopyDisk struct { func (s *stepCopyDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) isoPath := state.Get("iso_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) path := filepath.Join(s.OutputDir, s.VMName) if !s.DiskImage || s.UseBackingFile { diff --git a/builder/qemu/step_create_disk.go b/builder/qemu/step_create_disk.go index 8a0c8eb51..c8bc29940 100644 --- a/builder/qemu/step_create_disk.go +++ b/builder/qemu/step_create_disk.go @@ -6,8 +6,8 @@ import ( "log" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates the virtual disk that will be used as the @@ -25,7 +25,7 @@ type stepCreateDisk struct { func (s *stepCreateDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := s.VMName if s.DiskImage && !s.UseBackingFile { diff --git a/builder/qemu/step_http_ip_discover.go b/builder/qemu/step_http_ip_discover.go index 416cdac56..3a87fd5a9 100644 --- a/builder/qemu/step_http_ip_discover.go +++ b/builder/qemu/step_http_ip_discover.go @@ -5,8 +5,8 @@ import ( "fmt" "net" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Step to discover the http ip @@ -16,7 +16,7 @@ type stepHTTPIPDiscover struct{} func (s *stepHTTPIPDiscover) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) hostIP := "" diff --git a/builder/qemu/step_port_forward.go b/builder/qemu/step_port_forward.go index 77dcc1248..279a913fc 100644 --- a/builder/qemu/step_port_forward.go +++ b/builder/qemu/step_port_forward.go @@ -5,9 +5,9 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step adds a NAT port forwarding definition so that SSH or WinRM is available @@ -21,7 +21,7 @@ type stepPortForward struct { func (s *stepPortForward) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.CommunicatorType == "none" { ui.Message("No communicator is set; skipping port forwarding setup.") diff --git a/builder/qemu/step_prepare_output_dir.go b/builder/qemu/step_prepare_output_dir.go index 75118fdf0..11370bd98 100644 --- a/builder/qemu/step_prepare_output_dir.go +++ b/builder/qemu/step_prepare_output_dir.go @@ -6,15 +6,15 @@ import ( "os" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepPrepareOutputDir struct{} func (stepPrepareOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if _, err := os.Stat(config.OutputDir); err == nil && config.PackerForce { ui.Say("Deleting previous output directory...") @@ -35,7 +35,7 @@ func (stepPrepareOutputDir) Cleanup(state multistep.StateBag) { if cancelled || halted { config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting output directory...") for i := 0; i < 5; i++ { diff --git a/builder/qemu/step_resize_disk.go b/builder/qemu/step_resize_disk.go index c2daf20cf..33288e3b8 100644 --- a/builder/qemu/step_resize_disk.go +++ b/builder/qemu/step_resize_disk.go @@ -5,8 +5,8 @@ import ( "fmt" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step resizes the virtual disk that will be used as the @@ -25,7 +25,7 @@ type stepResizeDisk struct { func (s *stepResizeDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) path := filepath.Join(s.OutputDir, s.VMName) command := s.buildResizeCommand(path) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 873b79256..16a7470a1 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/hashicorp/go-version" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -18,13 +18,13 @@ type stepRun struct { DiskImage bool atLeastVersion2 bool - ui packer.Ui + ui packersdk.Ui } func (s *stepRun) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - s.ui = state.Get("ui").(packer.Ui) + s.ui = state.Get("ui").(packersdk.Ui) // Figure out version of qemu; store on step for later use rawVersion, err := driver.Version() @@ -63,7 +63,7 @@ func (s *stepRun) Run(ctx context.Context, state multistep.StateBag) multistep.S func (s *stepRun) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := driver.Stop(); err != nil { ui.Error(fmt.Sprintf("Error shutting down VM: %s", err)) diff --git a/builder/qemu/step_set_iso.go b/builder/qemu/step_set_iso.go index 3f6263be7..3dec89501 100644 --- a/builder/qemu/step_set_iso.go +++ b/builder/qemu/step_set_iso.go @@ -5,9 +5,9 @@ import ( "fmt" "net/http" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step set iso_patch to available url @@ -17,7 +17,7 @@ type stepSetISO struct { } func (s *stepSetISO) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) iso_path := "" diff --git a/builder/qemu/step_shutdown.go b/builder/qemu/step_shutdown.go index 3dbe1743a..594c8b3ff 100644 --- a/builder/qemu/step_shutdown.go +++ b/builder/qemu/step_shutdown.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step shuts down the machine. It first attempts to do so gracefully, @@ -19,7 +20,7 @@ import ( // communicator packer.Communicator // config *config // driver Driver -// ui packer.Ui +// ui packersdk.Ui // // Produces: // @@ -31,7 +32,7 @@ type stepShutdown struct { func (s *stepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.Type == "none" { cancelCh := make(chan struct{}, 1) diff --git a/builder/qemu/step_type_boot_command.go b/builder/qemu/step_type_boot_command.go index 27a6f8e48..9167d914d 100644 --- a/builder/qemu/step_type_boot_command.go +++ b/builder/qemu/step_type_boot_command.go @@ -7,9 +7,9 @@ import ( "net" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/mitchellh/go-vnc" ) @@ -27,7 +27,7 @@ type bootCommandTemplateData struct { // Uses: // config *config // http_port int -// ui packer.Ui +// ui packersdk.Ui // vnc_port int // // Produces: @@ -38,7 +38,7 @@ func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) config := state.Get("config").(*Config) debug := state.Get("debug").(bool) httpPort := state.Get("http_port").(int) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vncPort := state.Get("vnc_port").(int) vncIP := config.VNCBindAddress vncPassword := state.Get("vnc_password") diff --git a/builder/qemu/step_wait_guest_address.go b/builder/qemu/step_wait_guest_address.go index 938083e5b..3acf42f33 100644 --- a/builder/qemu/step_wait_guest_address.go +++ b/builder/qemu/step_wait_guest_address.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/digitalocean/go-qemu/qmp" ) @@ -26,7 +26,7 @@ type stepWaitGuestAddress struct { } func (s *stepWaitGuestAddress) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.CommunicatorType == "none" { ui.Message("No communicator is configured -- skipping StepWaitGuestAddress") diff --git a/builder/scaleway/builder.go b/builder/scaleway/builder.go index 9db7423cd..bc78d5253 100644 --- a/builder/scaleway/builder.go +++ b/builder/scaleway/builder.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -35,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { scwZone, err := scw.ParseZone(b.config.Zone) if err != nil { ui.Error(err.Error()) diff --git a/builder/scaleway/step_create_image.go b/builder/scaleway/step_create_image.go index 556a029e2..67244ff74 100644 --- a/builder/scaleway/step_create_image.go +++ b/builder/scaleway/step_create_image.go @@ -6,8 +6,8 @@ import ( "log" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/api/marketplace/v1" "github.com/scaleway/scaleway-sdk-go/scw" @@ -17,7 +17,7 @@ type stepImage struct{} func (s *stepImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) snapshotID := state.Get("snapshot_id").(string) bootscriptID := "" diff --git a/builder/scaleway/step_create_server.go b/builder/scaleway/step_create_server.go index 08c4ec3c5..7ead2b1a7 100644 --- a/builder/scaleway/step_create_server.go +++ b/builder/scaleway/step_create_server.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -17,7 +17,7 @@ type stepCreateServer struct { func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) tags := []string{} var bootscript *string @@ -76,7 +76,7 @@ func (s *stepCreateServer) Cleanup(state multistep.StateBag) { } instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Destroying server...") diff --git a/builder/scaleway/step_create_ssh_key.go b/builder/scaleway/step_create_ssh_key.go index 5d746029f..f4f533371 100644 --- a/builder/scaleway/step_create_ssh_key.go +++ b/builder/scaleway/step_create_ssh_key.go @@ -11,8 +11,8 @@ import ( "os" "runtime" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -22,7 +22,7 @@ type stepCreateSSHKey struct { } func (s *stepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.Comm.SSHPrivateKeyFile != "" { diff --git a/builder/scaleway/step_pre_validate.go b/builder/scaleway/step_pre_validate.go index f991b787a..3d4afb6bc 100644 --- a/builder/scaleway/step_pre_validate.go +++ b/builder/scaleway/step_pre_validate.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -20,7 +20,7 @@ type stepPreValidate struct { } func (s *stepPreValidate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Force { ui.Say("Force flag found, skipping prevalidating image name") diff --git a/builder/scaleway/step_remove_volume.go b/builder/scaleway/step_remove_volume.go index 451047b3c..a9a3133a4 100644 --- a/builder/scaleway/step_remove_volume.go +++ b/builder/scaleway/step_remove_volume.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -25,7 +25,7 @@ func (s *stepRemoveVolume) Cleanup(state multistep.StateBag) { } instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) volumeID := state.Get("root_volume_id").(string) diff --git a/builder/scaleway/step_server_info.go b/builder/scaleway/step_server_info.go index 28dec4cd5..3cc88aab5 100644 --- a/builder/scaleway/step_server_info.go +++ b/builder/scaleway/step_server_info.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -14,7 +14,7 @@ type stepServerInfo struct{} func (s *stepServerInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) serverID := state.Get("server_id").(string) ui.Say("Waiting for server to become active...") diff --git a/builder/scaleway/step_shutdown.go b/builder/scaleway/step_shutdown.go index 8c8eb1471..b383f1765 100644 --- a/builder/scaleway/step_shutdown.go +++ b/builder/scaleway/step_shutdown.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -14,7 +14,7 @@ type stepShutdown struct{} func (s *stepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) serverID := state.Get("server_id").(string) ui.Say("Shutting down server...") diff --git a/builder/scaleway/step_snapshot.go b/builder/scaleway/step_snapshot.go index e7e01637a..785b8ae07 100644 --- a/builder/scaleway/step_snapshot.go +++ b/builder/scaleway/step_snapshot.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -15,7 +15,7 @@ type stepSnapshot struct{} func (s *stepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { instanceAPI := instance.NewAPI(state.Get("client").(*scw.Client)) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) volumeID := state.Get("root_volume_id").(string) diff --git a/builder/tencentcloud/cvm/builder.go b/builder/tencentcloud/cvm/builder.go index ecdfde864..1c1580d0c 100644 --- a/builder/tencentcloud/cvm/builder.go +++ b/builder/tencentcloud/cvm/builder.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -64,7 +65,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { cvmClient, vpcClient, err := b.config.Client() if err != nil { return nil, err diff --git a/builder/tencentcloud/cvm/common.go b/builder/tencentcloud/cvm/common.go index d3fd7c398..fe12e238d 100644 --- a/builder/tencentcloud/cvm/common.go +++ b/builder/tencentcloud/cvm/common.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" @@ -196,7 +196,7 @@ func Say(state multistep.StateBag, message, prefix string) { message += "..." } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(message) } @@ -206,7 +206,7 @@ func Message(state multistep.StateBag, message, prefix string) { message = fmt.Sprintf("%s: %s", prefix, message) } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Message(message) } @@ -216,7 +216,7 @@ func Error(state multistep.StateBag, err error, prefix string) { err = fmt.Errorf("%s: %s", prefix, err) } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Error(err.Error()) } diff --git a/builder/triton/builder.go b/builder/triton/builder.go index ca41cb270..8ec1e8c5f 100644 --- a/builder/triton/builder.go +++ b/builder/triton/builder.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -49,7 +50,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, errs.ErrorOrNil() } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { config := b.config driver, err := NewDriverTriton(ui, config) diff --git a/builder/triton/driver_triton.go b/builder/triton/driver_triton.go index 58d943216..30c856ba3 100644 --- a/builder/triton/driver_triton.go +++ b/builder/triton/driver_triton.go @@ -7,17 +7,17 @@ import ( "sort" "time" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/joyent/triton-go/compute" terrors "github.com/joyent/triton-go/errors" ) type driverTriton struct { client *Client - ui packer.Ui + ui packersdk.Ui } -func NewDriverTriton(ui packer.Ui, config Config) (Driver, error) { +func NewDriverTriton(ui packersdk.Ui, config Config) (Driver, error) { client, err := config.AccessConfig.CreateTritonClient() if err != nil { return nil, err diff --git a/builder/triton/step_create_image_from_machine.go b/builder/triton/step_create_image_from_machine.go index bb2d66255..c0401f3c6 100644 --- a/builder/triton/step_create_image_from_machine.go +++ b/builder/triton/step_create_image_from_machine.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCreateImageFromMachine creates an image with the specified attributes @@ -17,7 +17,7 @@ type StepCreateImageFromMachine struct{} func (s *StepCreateImageFromMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) machineId := state.Get("machine").(string) diff --git a/builder/triton/step_create_source_machine.go b/builder/triton/step_create_source_machine.go index 0da7f603e..1281d7eb4 100644 --- a/builder/triton/step_create_source_machine.go +++ b/builder/triton/step_create_source_machine.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCreateSourceMachine creates an machine with the specified attributes @@ -16,7 +16,7 @@ type StepCreateSourceMachine struct{} func (s *StepCreateSourceMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if !config.MachineImageFilters.Empty() { ui.Say("Selecting an image based on search criteria") @@ -51,7 +51,7 @@ func (s *StepCreateSourceMachine) Run(ctx context.Context, state multistep.State func (s *StepCreateSourceMachine) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) machineIdRaw, ok := state.GetOk("machine") if ok && machineIdRaw.(string) != "" { diff --git a/builder/triton/step_delete_machine.go b/builder/triton/step_delete_machine.go index d1d005c25..d663d4f26 100644 --- a/builder/triton/step_delete_machine.go +++ b/builder/triton/step_delete_machine.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepDeleteMachine deletes the machine with the ID specified in state["machine"] @@ -14,7 +14,7 @@ type StepDeleteMachine struct{} func (s *StepDeleteMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) machineId := state.Get("machine").(string) diff --git a/builder/triton/step_stop_machine.go b/builder/triton/step_stop_machine.go index f6b243a23..571e9ca34 100644 --- a/builder/triton/step_stop_machine.go +++ b/builder/triton/step_stop_machine.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepStopMachine stops the machine with the given Machine ID, and waits @@ -15,7 +15,7 @@ type StepStopMachine struct{} func (s *StepStopMachine) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) machineId := state.Get("machine").(string) diff --git a/builder/triton/step_wait_for_stop_to_not_fail.go b/builder/triton/step_wait_for_stop_to_not_fail.go index ce226c871..51cf80a93 100644 --- a/builder/triton/step_wait_for_stop_to_not_fail.go +++ b/builder/triton/step_wait_for_stop_to_not_fail.go @@ -4,8 +4,8 @@ import ( "context" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepWaitForStopNotToFail waits for 10 seconds before returning with continue @@ -14,7 +14,7 @@ import ( type StepWaitForStopNotToFail struct{} func (s *StepWaitForStopNotToFail) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Waiting 10 seconds to avoid potential SDC bug...") time.Sleep(10 * time.Second) return multistep.ActionContinue diff --git a/builder/ucloud/common/utils.go b/builder/ucloud/common/utils.go index 71d2bb04b..3df40a38e 100644 --- a/builder/ucloud/common/utils.go +++ b/builder/ucloud/common/utils.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ucloud/ucloud-sdk-go/services/uhost" ) @@ -63,7 +63,7 @@ func SSHHost(usePrivateIp bool) func(multistep.StateBag) (string, error) { } func Halt(state multistep.StateBag, err error, prefix string) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if prefix != "" { err = fmt.Errorf("%s: %s", prefix, err) diff --git a/builder/ucloud/uhost/builder.go b/builder/ucloud/uhost/builder.go index c2cd520f1..a4d652668 100644 --- a/builder/ucloud/uhost/builder.go +++ b/builder/ucloud/uhost/builder.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -67,7 +68,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { client, err := b.config.Client() if err != nil { diff --git a/builder/ucloud/uhost/step_check_source_image.go b/builder/ucloud/uhost/step_check_source_image.go index afeec3978..00b5593fd 100644 --- a/builder/ucloud/uhost/step_check_source_image.go +++ b/builder/ucloud/uhost/step_check_source_image.go @@ -5,8 +5,8 @@ import ( "fmt" ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepCheckSourceImageId struct { @@ -14,7 +14,7 @@ type stepCheckSourceImageId struct { } func (s *stepCheckSourceImageId) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*ucloudcommon.UCloudClient) ui.Say("Querying source image id...") diff --git a/builder/ucloud/uhost/step_config_security_group.go b/builder/ucloud/uhost/step_config_security_group.go index 297f7d002..1c8af55f7 100644 --- a/builder/ucloud/uhost/step_config_security_group.go +++ b/builder/ucloud/uhost/step_config_security_group.go @@ -5,8 +5,8 @@ import ( "fmt" ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ucloud/ucloud-sdk-go/ucloud" ) @@ -17,7 +17,7 @@ type stepConfigSecurityGroup struct { func (s *stepConfigSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UNetConn - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.SecurityGroupId) != 0 { ui.Say(fmt.Sprintf("Trying to use specified security group %q...", s.SecurityGroupId)) diff --git a/builder/ucloud/uhost/step_config_subnet.go b/builder/ucloud/uhost/step_config_subnet.go index 6170b3f95..24da1b116 100644 --- a/builder/ucloud/uhost/step_config_subnet.go +++ b/builder/ucloud/uhost/step_config_subnet.go @@ -5,8 +5,8 @@ import ( "fmt" ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepConfigSubnet struct { @@ -15,7 +15,7 @@ type stepConfigSubnet struct { func (s *stepConfigSubnet) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ucloudcommon.UCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.SubnetId) != 0 { ui.Say(fmt.Sprintf("Trying to use specified subnet %q...", s.SubnetId)) diff --git a/builder/ucloud/uhost/step_config_vpc.go b/builder/ucloud/uhost/step_config_vpc.go index dc54ddcf7..c35174c5a 100644 --- a/builder/ucloud/uhost/step_config_vpc.go +++ b/builder/ucloud/uhost/step_config_vpc.go @@ -6,8 +6,8 @@ import ( ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepConfigVPC struct { @@ -16,7 +16,7 @@ type stepConfigVPC struct { func (s *stepConfigVPC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ucloudcommon.UCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if len(s.VPCId) != 0 { ui.Say(fmt.Sprintf("Trying to use specified vpc %q...", s.VPCId)) diff --git a/builder/ucloud/uhost/step_copy_image.go b/builder/ucloud/uhost/step_copy_image.go index 4f8eec37e..0ebef1d1e 100644 --- a/builder/ucloud/uhost/step_copy_image.go +++ b/builder/ucloud/uhost/step_copy_image.go @@ -9,8 +9,8 @@ import ( ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" "github.com/hashicorp/packer/packer-plugin-sdk/retry" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ucloud/ucloud-sdk-go/ucloud" ) @@ -28,7 +28,7 @@ func (s *stepCopyUCloudImage) Run(ctx context.Context, state multistep.StateBag) client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UHostConn - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) srcImageId := state.Get("image_id").(string) artifactImages := state.Get("ucloud_images").(*ucloudcommon.ImageInfoSet) @@ -123,7 +123,7 @@ func (s *stepCopyUCloudImage) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UHostConn ui.Say(fmt.Sprintf("Deleting copied image because of cancellation or error...")) diff --git a/builder/ucloud/uhost/step_create_image.go b/builder/ucloud/uhost/step_create_image.go index 58e5da238..4837325fd 100644 --- a/builder/ucloud/uhost/step_create_image.go +++ b/builder/ucloud/uhost/step_create_image.go @@ -8,8 +8,8 @@ import ( ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" "github.com/hashicorp/packer/packer-plugin-sdk/retry" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ucloud/ucloud-sdk-go/services/uhost" "github.com/ucloud/ucloud-sdk-go/ucloud" ) @@ -22,7 +22,7 @@ func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) mul client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UHostConn instance := state.Get("instance").(*uhost.UHostInstanceSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say(fmt.Sprintf("Creating image %s...", config.ImageName)) @@ -93,7 +93,7 @@ func (s *stepCreateImage) Cleanup(state multistep.StateBag) { client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UHostConn - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting image because of cancellation or error...") req := conn.NewTerminateCustomImageRequest() diff --git a/builder/ucloud/uhost/step_create_instance.go b/builder/ucloud/uhost/step_create_instance.go index 03d863a40..783c27c2e 100644 --- a/builder/ucloud/uhost/step_create_instance.go +++ b/builder/ucloud/uhost/step_create_instance.go @@ -10,8 +10,8 @@ import ( "time" ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/ucloud/ucloud-sdk-go/services/uhost" "github.com/ucloud/ucloud-sdk-go/ucloud" @@ -38,7 +38,7 @@ type stepCreateInstance struct { func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UHostConn - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating Instance...") req, err := s.buildCreateInstanceRequest(state) @@ -136,7 +136,7 @@ func (s *stepCreateInstance) Cleanup(state multistep.StateBag) { _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ctx := context.TODO() if cancelled || halted { diff --git a/builder/ucloud/uhost/step_pre_validate.go b/builder/ucloud/uhost/step_pre_validate.go index 41b50e9a6..f945613fb 100644 --- a/builder/ucloud/uhost/step_pre_validate.go +++ b/builder/ucloud/uhost/step_pre_validate.go @@ -6,6 +6,7 @@ import ( ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepPreValidate struct { @@ -32,7 +33,7 @@ func (s *stepPreValidate) Run(ctx context.Context, state multistep.StateBag) mul } func (s *stepPreValidate) validateProjectIds(state multistep.StateBag) error { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say("Validating project_id and copied project_ids...") @@ -56,7 +57,7 @@ func (s *stepPreValidate) validateProjectIds(state multistep.StateBag) error { } func (s *stepPreValidate) validateRegions(state multistep.StateBag) error { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say("Validating region and copied regions...") @@ -79,7 +80,7 @@ func (s *stepPreValidate) validateRegions(state multistep.StateBag) error { } func (s *stepPreValidate) validateZones(state multistep.StateBag) error { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say("Validating availability_zone...") diff --git a/builder/ucloud/uhost/step_stop_instance.go b/builder/ucloud/uhost/step_stop_instance.go index 214d5e312..5d0c31b98 100644 --- a/builder/ucloud/uhost/step_stop_instance.go +++ b/builder/ucloud/uhost/step_stop_instance.go @@ -8,8 +8,8 @@ import ( ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" "github.com/hashicorp/packer/packer-plugin-sdk/retry" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ucloud/ucloud-sdk-go/services/uhost" "github.com/ucloud/ucloud-sdk-go/ucloud" ) @@ -21,7 +21,7 @@ func (s *stepStopInstance) Run(ctx context.Context, state multistep.StateBag) mu client := state.Get("client").(*ucloudcommon.UCloudClient) conn := client.UHostConn instance := state.Get("instance").(*uhost.UHostInstanceSet) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instance, err := client.DescribeUHostById(instance.UHostId) if err != nil { diff --git a/builder/vagrant/builder.go b/builder/vagrant/builder.go index 3dc56f179..6463bd8be 100644 --- a/builder/vagrant/builder.go +++ b/builder/vagrant/builder.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -273,7 +274,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a VirtualBox appliance. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with VirtualBox VagrantCWD, err := filepath.Abs(b.config.OutputDir) if err != nil { diff --git a/builder/vagrant/step_add_box.go b/builder/vagrant/step_add_box.go index 43693d184..38ff8c191 100644 --- a/builder/vagrant/step_add_box.go +++ b/builder/vagrant/step_add_box.go @@ -5,8 +5,8 @@ import ( "log" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepAddBox struct { @@ -70,7 +70,7 @@ func (s *StepAddBox) generateAddArgs() []string { func (s *StepAddBox) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(VagrantDriver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.SkipAdd { ui.Say("skip_add was set so we assume the box is already in Vagrant...") diff --git a/builder/vagrant/step_create_vagrantfile.go b/builder/vagrant/step_create_vagrantfile.go index b6ec461af..3fb1c8c09 100644 --- a/builder/vagrant/step_create_vagrantfile.go +++ b/builder/vagrant/step_create_vagrantfile.go @@ -8,8 +8,8 @@ import ( "path/filepath" "text/template" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateVagrantfile struct { @@ -87,7 +87,7 @@ func (s *StepCreateVagrantfile) createVagrantfile() (string, error) { } func (s *StepCreateVagrantfile) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Skip the initialize step if we're trying to launch from a global ID. if s.GlobalID != "" { diff --git a/builder/vagrant/step_package.go b/builder/vagrant/step_package.go index 8b2bd023f..77128150b 100644 --- a/builder/vagrant/step_package.go +++ b/builder/vagrant/step_package.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepPackage struct { @@ -17,7 +17,7 @@ type StepPackage struct { func (s *StepPackage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(VagrantDriver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.SkipPackage { ui.Say("skip_package flag set; not going to call Vagrant package on this box.") diff --git a/builder/vagrant/step_up.go b/builder/vagrant/step_up.go index d427de57a..7a8ebab5f 100644 --- a/builder/vagrant/step_up.go +++ b/builder/vagrant/step_up.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepUp struct { @@ -31,7 +31,7 @@ func (s *StepUp) generateArgs() []string { func (s *StepUp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(VagrantDriver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Calling Vagrant Up (this can take some time)...") @@ -51,7 +51,7 @@ func (s *StepUp) Run(ctx context.Context, state multistep.StateBag) multistep.St func (s *StepUp) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(VagrantDriver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("%sing Vagrant box...", s.TeardownMethod)) diff --git a/builder/virtualbox/common/step_attach_floppy.go b/builder/virtualbox/common/step_attach_floppy.go index c607fbe32..ae4bc1f2e 100644 --- a/builder/virtualbox/common/step_attach_floppy.go +++ b/builder/virtualbox/common/step_attach_floppy.go @@ -8,8 +8,8 @@ import ( "os" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -17,7 +17,7 @@ import ( // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -45,7 +45,7 @@ func (s *StepAttachFloppy) Run(ctx context.Context, state multistep.StateBag) mu } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Deleting any current floppy disk...") @@ -88,7 +88,7 @@ func (s *StepAttachFloppy) Run(ctx context.Context, state multistep.StateBag) mu } func (s *StepAttachFloppy) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Cleaning up floppy disk...") if s.floppyPath == "" { return diff --git a/builder/virtualbox/common/step_attach_isos.go b/builder/virtualbox/common/step_attach_isos.go index b72d9eccf..5a6bbd624 100644 --- a/builder/virtualbox/common/step_attach_isos.go +++ b/builder/virtualbox/common/step_attach_isos.go @@ -6,8 +6,8 @@ import ( "log" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step attaches the boot ISO, cd_files iso, and guest additions to the @@ -22,7 +22,7 @@ type StepAttachISOs struct { func (s *StepAttachISOs) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { // Check whether there is anything to attach - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Mounting ISOs...") diskMountMap := map[string]string{} diff --git a/builder/virtualbox/common/step_configure_vrdp.go b/builder/virtualbox/common/step_configure_vrdp.go index 77a6a7aca..9fd02cbeb 100644 --- a/builder/virtualbox/common/step_configure_vrdp.go +++ b/builder/virtualbox/common/step_configure_vrdp.go @@ -5,9 +5,9 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step configures the VM to enable the VRDP server @@ -15,7 +15,7 @@ import ( // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -30,7 +30,7 @@ type StepConfigureVRDP struct { func (s *StepConfigureVRDP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) log.Printf("Looking for available port between %d and %d on %s", s.VRDPPortMin, s.VRDPPortMax, s.VRDPBindAddress) diff --git a/builder/virtualbox/common/step_download_guest_additions.go b/builder/virtualbox/common/step_download_guest_additions.go index e812ab436..b98bbec51 100644 --- a/builder/virtualbox/common/step_download_guest_additions.go +++ b/builder/virtualbox/common/step_download_guest_additions.go @@ -9,9 +9,9 @@ import ( "os" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -40,7 +40,7 @@ type StepDownloadGuestAdditions struct { func (s *StepDownloadGuestAdditions) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { var action multistep.StepAction driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // If we've disabled guest additions, don't download if s.GuestAdditionsMode == GuestAdditionsModeDisable { diff --git a/builder/virtualbox/common/step_export.go b/builder/virtualbox/common/step_export.go index b1c5d6987..31dc8db64 100644 --- a/builder/virtualbox/common/step_export.go +++ b/builder/virtualbox/common/step_export.go @@ -6,8 +6,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step cleans up forwarded ports and exports the VM to an OVF. @@ -36,7 +36,7 @@ func (s *StepExport) Run(ctx context.Context, state multistep.StateBag) multiste } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.OutputFilename == "" { s.OutputFilename = vmName diff --git a/builder/virtualbox/common/step_port_forwarding.go b/builder/virtualbox/common/step_port_forwarding.go index 19b3a6689..41c4bb923 100644 --- a/builder/virtualbox/common/step_port_forwarding.go +++ b/builder/virtualbox/common/step_port_forwarding.go @@ -7,9 +7,9 @@ import ( "strings" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step adds a NAT port forwarding definition so that SSH or WinRM is available @@ -17,7 +17,7 @@ import ( // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -32,7 +32,7 @@ type StepPortForwarding struct { func (s *StepPortForwarding) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.CommConfig.Type == "none" { diff --git a/builder/virtualbox/common/step_remove_devices.go b/builder/virtualbox/common/step_remove_devices.go index fbbce66da..1a0c7f385 100644 --- a/builder/virtualbox/common/step_remove_devices.go +++ b/builder/virtualbox/common/step_remove_devices.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -16,7 +16,7 @@ import ( // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -26,7 +26,7 @@ type StepRemoveDevices struct { func (s *StepRemoveDevices) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) // Remove the attached floppy disk, if it exists diff --git a/builder/virtualbox/common/step_run.go b/builder/virtualbox/common/step_run.go index ca148a876..01144e4fa 100644 --- a/builder/virtualbox/common/step_run.go +++ b/builder/virtualbox/common/step_run.go @@ -4,15 +4,15 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step starts the virtual machine. // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -24,7 +24,7 @@ type StepRun struct { func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) ui.Say("Starting the virtual machine...") @@ -70,7 +70,7 @@ func (s *StepRun) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if running, _ := driver.IsRunning(s.vmName); running { if err := driver.VBoxManage("controlvm", s.vmName, "poweroff"); err != nil { diff --git a/builder/virtualbox/common/step_shutdown.go b/builder/virtualbox/common/step_shutdown.go index acc3c3513..ce980847f 100644 --- a/builder/virtualbox/common/step_shutdown.go +++ b/builder/virtualbox/common/step_shutdown.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step shuts down the machine. It first attempts to do so gracefully, @@ -17,7 +18,7 @@ import ( // Uses: // communicator packer.Communicator // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -33,7 +34,7 @@ type StepShutdown struct { func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if s.ACPIShutdown { diff --git a/builder/virtualbox/common/step_ssh_key_pair.go b/builder/virtualbox/common/step_ssh_key_pair.go index 7383ed93c..aa9dbf16b 100644 --- a/builder/virtualbox/common/step_ssh_key_pair.go +++ b/builder/virtualbox/common/step_ssh_key_pair.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator/ssh" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -25,7 +25,7 @@ func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) mult return multistep.ActionContinue } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key for the communicator...") @@ -99,7 +99,7 @@ func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) mult func (s *StepSshKeyPair) Cleanup(state multistep.StateBag) { if s.Debug { if err := os.Remove(s.DebugKeyPath); err != nil { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Error(fmt.Sprintf( "Error removing debug key '%s': %s", s.DebugKeyPath, err)) } diff --git a/builder/virtualbox/common/step_suppress_messages.go b/builder/virtualbox/common/step_suppress_messages.go index 52d69d5f9..ddfc2b852 100644 --- a/builder/virtualbox/common/step_suppress_messages.go +++ b/builder/virtualbox/common/step_suppress_messages.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step sets some variables in VirtualBox so that annoying @@ -15,7 +15,7 @@ type StepSuppressMessages struct{} func (StepSuppressMessages) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) log.Println("Suppressing annoying messages in VirtualBox") if err := driver.SuppressMessages(); err != nil { diff --git a/builder/virtualbox/common/step_type_boot_command.go b/builder/virtualbox/common/step_type_boot_command.go index 4e7587eae..8a728a858 100644 --- a/builder/virtualbox/common/step_type_boot_command.go +++ b/builder/virtualbox/common/step_type_boot_command.go @@ -6,9 +6,9 @@ import ( "time" "github.com/hashicorp/packer/helper/communicator" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -43,7 +43,7 @@ func (s *StepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) debug := state.Get("debug").(bool) driver := state.Get("driver").(Driver) httpPort := state.Get("http_port").(int) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) // Wait the for the vm to boot. diff --git a/builder/virtualbox/common/step_upload_guest_additions.go b/builder/virtualbox/common/step_upload_guest_additions.go index 272ac5f1f..ea7b6ef37 100644 --- a/builder/virtualbox/common/step_upload_guest_additions.go +++ b/builder/virtualbox/common/step_upload_guest_additions.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -25,7 +26,7 @@ type StepUploadGuestAdditions struct { func (s *StepUploadGuestAdditions) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // If we're attaching then don't do this, since we attached. if s.GuestAdditionsMode != GuestAdditionsModeUpload { diff --git a/builder/virtualbox/common/step_upload_version.go b/builder/virtualbox/common/step_upload_version.go index 638aa1dac..46da0e6f1 100644 --- a/builder/virtualbox/common/step_upload_version.go +++ b/builder/virtualbox/common/step_upload_version.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step uploads a file containing the VirtualBox version, which @@ -19,7 +20,7 @@ type StepUploadVersion struct { func (s *StepUploadVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { comm := state.Get("communicator").(packer.Communicator) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.Path == "" { log.Println("VBoxVersionFile is empty. Not uploading.") diff --git a/builder/virtualbox/common/step_vboxmanage.go b/builder/virtualbox/common/step_vboxmanage.go index 6950fcb4f..0e2e9cbf1 100644 --- a/builder/virtualbox/common/step_vboxmanage.go +++ b/builder/virtualbox/common/step_vboxmanage.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -25,7 +25,7 @@ type commandTemplate struct { // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmName string // // Produces: @@ -36,7 +36,7 @@ type StepVBoxManage struct { func (s *StepVBoxManage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) if len(s.Commands) > 0 { diff --git a/builder/virtualbox/iso/builder.go b/builder/virtualbox/iso/builder.go index 810451f95..13d5151de 100644 --- a/builder/virtualbox/iso/builder.go +++ b/builder/virtualbox/iso/builder.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -230,7 +231,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with VirtualBox driver, err := vboxcommon.NewDriver() if err != nil { diff --git a/builder/virtualbox/iso/step_create_disk.go b/builder/virtualbox/iso/step_create_disk.go index 14869ce71..efeccd1c0 100644 --- a/builder/virtualbox/iso/step_create_disk.go +++ b/builder/virtualbox/iso/step_create_disk.go @@ -5,8 +5,8 @@ import ( "fmt" vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "path/filepath" "strconv" @@ -20,7 +20,7 @@ type stepCreateDisk struct{} func (s *stepCreateDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmName := state.Get("vmName").(string) format := "VDI" diff --git a/builder/virtualbox/iso/step_create_vm.go b/builder/virtualbox/iso/step_create_vm.go index 2a6597b18..628cfacc2 100644 --- a/builder/virtualbox/iso/step_create_vm.go +++ b/builder/virtualbox/iso/step_create_vm.go @@ -7,8 +7,8 @@ import ( "strings" vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates the actual virtual machine. @@ -22,7 +22,7 @@ type stepCreateVM struct { func (s *stepCreateVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) name := config.VMName @@ -73,7 +73,7 @@ func (s *stepCreateVM) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) _, cancelled := state.GetOk(multistep.StateCancelled) diff --git a/builder/virtualbox/ovf/builder.go b/builder/virtualbox/ovf/builder.go index e15dd870b..c07152f18 100644 --- a/builder/virtualbox/ovf/builder.go +++ b/builder/virtualbox/ovf/builder.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Builder implements packer.Builder and builds the actual VirtualBox @@ -33,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a VirtualBox appliance. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with VirtualBox driver, err := vboxcommon.NewDriver() if err != nil { diff --git a/builder/virtualbox/ovf/step_import.go b/builder/virtualbox/ovf/step_import.go index fcb081a9c..67a8659fe 100644 --- a/builder/virtualbox/ovf/step_import.go +++ b/builder/virtualbox/ovf/step_import.go @@ -5,8 +5,8 @@ import ( "fmt" vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step imports an OVF VM into VirtualBox. @@ -20,7 +20,7 @@ type StepImport struct { func (s *StepImport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmPath := state.Get("vm_path").(string) ui.Say(fmt.Sprintf("Importing VM: %s", vmPath)) @@ -42,7 +42,7 @@ func (s *StepImport) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) diff --git a/builder/virtualbox/vm/builder.go b/builder/virtualbox/vm/builder.go index 4118d8827..9732e7c0f 100644 --- a/builder/virtualbox/vm/builder.go +++ b/builder/virtualbox/vm/builder.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Builder implements packer.Builder and builds the actual VirtualBox @@ -33,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a VirtualBox appliance. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { // Create the driver that we'll use to communicate with VirtualBox driver, err := vboxcommon.NewDriver() if err != nil { diff --git a/builder/virtualbox/vm/step_create_snapshot.go b/builder/virtualbox/vm/step_create_snapshot.go index 05a10177a..12bb0868b 100644 --- a/builder/virtualbox/vm/step_create_snapshot.go +++ b/builder/virtualbox/vm/step_create_snapshot.go @@ -6,8 +6,8 @@ import ( "log" vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateSnapshot struct { @@ -17,7 +17,7 @@ type StepCreateSnapshot struct { func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.TargetSnapshot != "" { running, err := driver.IsRunning(s.Name) if err != nil { diff --git a/builder/virtualbox/vm/step_set_snapshot.go b/builder/virtualbox/vm/step_set_snapshot.go index 2158a5187..d594a4296 100644 --- a/builder/virtualbox/vm/step_set_snapshot.go +++ b/builder/virtualbox/vm/step_set_snapshot.go @@ -5,8 +5,8 @@ import ( "fmt" vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepSetSnapshot struct { @@ -18,7 +18,7 @@ type StepSetSnapshot struct { func (s *StepSetSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(vboxcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) snapshotTree, err := driver.LoadSnapshots(s.Name) if err != nil { err := fmt.Errorf("Error loading snapshots for VM: %s", err) @@ -64,7 +64,7 @@ func (s *StepSetSnapshot) Run(_ context.Context, state multistep.StateBag) multi func (s *StepSetSnapshot) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(vboxcommon.Driver) if s.revertToSnapshot != "" { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.KeepRegistered { ui.Say("Keeping virtual machine state (keep_registered = true)") return diff --git a/builder/vmware/common/driver_esx5.go b/builder/vmware/common/driver_esx5.go index 73ca6b7e3..448698987 100644 --- a/builder/vmware/common/driver_esx5.go +++ b/builder/vmware/common/driver_esx5.go @@ -32,6 +32,7 @@ import ( helperssh "github.com/hashicorp/packer/helper/communicator/ssh" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/ssh" gossh "golang.org/x/crypto/ssh" ) @@ -249,7 +250,7 @@ func (d *ESX5Driver) IsDestroyed() (bool, error) { return true, err } -func (d *ESX5Driver) UploadISO(localPath string, checksum string, ui packer.Ui) (string, error) { +func (d *ESX5Driver) UploadISO(localPath string, checksum string, ui packersdk.Ui) (string, error) { finalPath := d.CachePath(localPath) if err := d.mkdir(filepath.ToSlash(filepath.Dir(finalPath))); err != nil { return "", err @@ -793,7 +794,7 @@ func (d *ESX5Driver) mkdir(path string) error { return d.sh("mkdir", "-p", strconv.Quote(path)) } -func (d *ESX5Driver) upload(dst, src string, ui packer.Ui) error { +func (d *ESX5Driver) upload(dst, src string, ui packersdk.Ui) error { // Get size so we can set up progress tracker info, err := os.Stat(src) if err != nil { diff --git a/builder/vmware/common/remote_driver.go b/builder/vmware/common/remote_driver.go index f2c16cf12..2f35f4cd4 100644 --- a/builder/vmware/common/remote_driver.go +++ b/builder/vmware/common/remote_driver.go @@ -1,7 +1,7 @@ package common import ( - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type RemoteDriver interface { @@ -10,7 +10,7 @@ type RemoteDriver interface { // UploadISO uploads a local ISO to the remote side and returns the // new path that should be used in the VMX along with an error if it // exists. - UploadISO(path string, checksum string, ui packer.Ui) (string, error) + UploadISO(path string, checksum string, ui packersdk.Ui) (string, error) // RemoveCache deletes localPath from the remote cache. RemoveCache(localPath string) error @@ -28,7 +28,7 @@ type RemoteDriver interface { IsDestroyed() (bool, error) // Uploads a local file to remote side. - upload(dst, src string, ui packer.Ui) error + upload(dst, src string, ui packersdk.Ui) error // Download a remote file to a local file. Download(src, dst string) error diff --git a/builder/vmware/common/remote_driver_mock.go b/builder/vmware/common/remote_driver_mock.go index f20e5e69f..be5793932 100644 --- a/builder/vmware/common/remote_driver_mock.go +++ b/builder/vmware/common/remote_driver_mock.go @@ -1,7 +1,7 @@ package common import ( - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type RemoteDriverMock struct { @@ -40,7 +40,7 @@ type RemoteDriverMock struct { outputDir string } -func (d *RemoteDriverMock) UploadISO(path string, checksum string, ui packer.Ui) (string, error) { +func (d *RemoteDriverMock) UploadISO(path string, checksum string, ui packersdk.Ui) (string, error) { d.UploadISOCalled = true d.UploadISOPath = path return d.UploadISOResult, d.UploadISOErr @@ -68,7 +68,7 @@ func (d *RemoteDriverMock) IsDestroyed() (bool, error) { return d.IsDestroyedResult, d.IsDestroyedErr } -func (d *RemoteDriverMock) upload(dst, src string, ui packer.Ui) error { +func (d *RemoteDriverMock) upload(dst, src string, ui packersdk.Ui) error { return d.UploadErr } diff --git a/builder/vmware/common/step_clean_files.go b/builder/vmware/common/step_clean_files.go index 93072441f..ebdb4bd2f 100644 --- a/builder/vmware/common/step_clean_files.go +++ b/builder/vmware/common/step_clean_files.go @@ -6,8 +6,8 @@ import ( "os" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // These are the extensions of files that are important for the function @@ -19,7 +19,7 @@ var KeepFileExtensions = []string{".nvram", ".vmdk", ".vmsd", ".vmx", ".vmxf"} // // Uses: // dir OutputDir -// ui packer.Ui +// ui packersdk.Ui // // Produces: // @@ -27,7 +27,7 @@ type StepCleanFiles struct{} func (StepCleanFiles) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { dir := state.Get("dir").(OutputDir) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting unnecessary VMware files...") files, err := dir.ListFiles() diff --git a/builder/vmware/common/step_clean_vmx.go b/builder/vmware/common/step_clean_vmx.go index f89865a06..b4720af4f 100644 --- a/builder/vmware/common/step_clean_vmx.go +++ b/builder/vmware/common/step_clean_vmx.go @@ -6,15 +6,15 @@ import ( "log" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step cleans up the VMX by removing or changing this prior to // being ready for use. // // Uses: -// ui packer.Ui +// ui packersdk.Ui // vmx_path string // // Produces: @@ -25,7 +25,7 @@ type StepCleanVMX struct { } func (s StepCleanVMX) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) ui.Say("Cleaning VMX prior to finishing up...") diff --git a/builder/vmware/common/step_compact_disk.go b/builder/vmware/common/step_compact_disk.go index 7605af6ca..be798fe59 100644 --- a/builder/vmware/common/step_compact_disk.go +++ b/builder/vmware/common/step_compact_disk.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step compacts the virtual disk for the VM unless the "skip_compaction" @@ -15,7 +15,7 @@ import ( // Uses: // driver Driver // disk_full_paths ([]string) - The full paths to all created disks -// ui packer.Ui +// ui packersdk.Ui // // Produces: // @@ -25,7 +25,7 @@ type StepCompactDisk struct { func (s StepCompactDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) diskFullPaths := state.Get("disk_full_paths").([]string) if s.Skip { diff --git a/builder/vmware/common/step_configure_vmx.go b/builder/vmware/common/step_configure_vmx.go index 68dc5709b..a915509b2 100644 --- a/builder/vmware/common/step_configure_vmx.go +++ b/builder/vmware/common/step_configure_vmx.go @@ -7,8 +7,8 @@ import ( "regexp" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step configures a VMX by setting some default settings as well @@ -32,7 +32,7 @@ func (s *StepConfigureVMX) Run(ctx context.Context, state multistep.StateBag) mu log.Printf("Configuring VMX...\n") var err error - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) vmxData, err := ReadVMX(vmxPath) diff --git a/builder/vmware/common/step_configure_vnc.go b/builder/vmware/common/step_configure_vnc.go index 4b8823f4f..498794757 100644 --- a/builder/vmware/common/step_configure_vnc.go +++ b/builder/vmware/common/step_configure_vnc.go @@ -6,15 +6,15 @@ import ( "log" "math/rand" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step configures the VM to enable the VNC server. // // Uses: -// ui packer.Ui +// ui packersdk.Ui // vmx_path string // // Produces: @@ -77,7 +77,7 @@ func (s *StepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) mu } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) vmxData, err := ReadVMX(vmxPath) diff --git a/builder/vmware/common/step_create_disks.go b/builder/vmware/common/step_create_disks.go index 6038f1234..477ef540f 100644 --- a/builder/vmware/common/step_create_disks.go +++ b/builder/vmware/common/step_create_disks.go @@ -6,8 +6,8 @@ import ( "log" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates the virtual disks for the VM. @@ -15,7 +15,7 @@ import ( // Uses: // config *config // driver Driver -// ui packer.Ui +// ui packersdk.Ui // // Produces: // disk_full_paths ([]string) - The full paths to all created disks @@ -31,7 +31,7 @@ type StepCreateDisks struct { func (s *StepCreateDisks) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating required virtual machine disks") diff --git a/builder/vmware/common/step_export.go b/builder/vmware/common/step_export.go index 4ab7b4431..86b031774 100644 --- a/builder/vmware/common/step_export.go +++ b/builder/vmware/common/step_export.go @@ -8,8 +8,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step exports a VM built on ESXi using ovftool @@ -55,7 +55,7 @@ func (s *StepExport) generateLocalExportArgs(exportOutputPath string) ([]string, func (s *StepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { c := state.Get("driverConfig").(*DriverConfig) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) driver := state.Get("driver").(Driver) // Skip export if requested diff --git a/builder/vmware/common/step_http_ip_discover.go b/builder/vmware/common/step_http_ip_discover.go index 8d80ebe24..87041775b 100644 --- a/builder/vmware/common/step_http_ip_discover.go +++ b/builder/vmware/common/step_http_ip_discover.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Step to discover the http ip @@ -16,7 +16,7 @@ type StepHTTPIPDiscover struct{} func (s *StepHTTPIPDiscover) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Determine the host IP hostIP, err := driver.HostIP(state) diff --git a/builder/vmware/common/step_output_dir.go b/builder/vmware/common/step_output_dir.go index 5123754d5..495b3f582 100644 --- a/builder/vmware/common/step_output_dir.go +++ b/builder/vmware/common/step_output_dir.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepOutputDir sets up the output directory by creating it if it does @@ -68,7 +68,7 @@ func (s *StepOutputDir) SetOutputAndExportDirs(state multistep.StateBag) OutputD } func (s *StepOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Configuring output and export directories...") dir := s.SetOutputAndExportDirs(state) @@ -108,7 +108,7 @@ func (s *StepOutputDir) Cleanup(state multistep.StateBag) { if cancelled || halted { dir := state.Get("dir").(OutputDir) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) exists, _ := dir.DirExists() if exists { diff --git a/builder/vmware/common/step_register.go b/builder/vmware/common/step_register.go index baf33268d..24dd1fd7b 100644 --- a/builder/vmware/common/step_register.go +++ b/builder/vmware/common/step_register.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRegister struct { @@ -19,7 +19,7 @@ type StepRegister struct { func (s *StepRegister) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) @@ -44,7 +44,7 @@ func (s *StepRegister) Cleanup(state multistep.StateBag) { } driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) _, cancelled := state.GetOk(multistep.StateCancelled) _, halted := state.GetOk(multistep.StateHalted) diff --git a/builder/vmware/common/step_remote_upload.go b/builder/vmware/common/step_remote_upload.go index c54ed9072..abb9ae15a 100644 --- a/builder/vmware/common/step_remote_upload.go +++ b/builder/vmware/common/step_remote_upload.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // stepRemoteUpload uploads some thing from the state bag to a remote driver @@ -20,7 +20,7 @@ type StepRemoteUpload struct { func (s *StepRemoteUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) remote, ok := driver.(RemoteDriver) if !ok { diff --git a/builder/vmware/common/step_run.go b/builder/vmware/common/step_run.go index 090a36262..0cef4b60b 100644 --- a/builder/vmware/common/step_run.go +++ b/builder/vmware/common/step_run.go @@ -5,15 +5,15 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step runs the created virtual machine. // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmx_path string // // Produces: @@ -28,7 +28,7 @@ type StepRun struct { func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) // Set the VMX path so that we know we started the machine @@ -73,7 +73,7 @@ func (s *StepRun) Run(ctx context.Context, state multistep.StateBag) multistep.S func (s *StepRun) Cleanup(state multistep.StateBag) { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // If we started the machine... stop it. if s.vmxPath != "" { diff --git a/builder/vmware/common/step_shutdown.go b/builder/vmware/common/step_shutdown.go index a75514a29..b1187672f 100644 --- a/builder/vmware/common/step_shutdown.go +++ b/builder/vmware/common/step_shutdown.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step shuts down the machine. It first attempts to do so gracefully, @@ -21,7 +22,7 @@ import ( // communicator packer.Communicator // dir OutputDir // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmx_path string // // Produces: @@ -38,7 +39,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis comm := state.Get("communicator").(packer.Communicator) dir := state.Get("dir").(OutputDir) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) if s.Command != "" { diff --git a/builder/vmware/common/step_suppress_messages.go b/builder/vmware/common/step_suppress_messages.go index 0ab45c27c..f852237d8 100644 --- a/builder/vmware/common/step_suppress_messages.go +++ b/builder/vmware/common/step_suppress_messages.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step suppresses any messages that VMware product might show. @@ -14,7 +14,7 @@ type StepSuppressMessages struct{} func (s *StepSuppressMessages) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) log.Println("Suppressing messages in VMX") diff --git a/builder/vmware/common/step_upload_tools.go b/builder/vmware/common/step_upload_tools.go index 5282a7191..bd5063625 100644 --- a/builder/vmware/common/step_upload_tools.go +++ b/builder/vmware/common/step_upload_tools.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -37,7 +38,7 @@ func (c *StepUploadTools) Run(ctx context.Context, state multistep.StateBag) mul comm := state.Get("communicator").(packer.Communicator) tools_source := state.Get("tools_upload_source").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Uploading the '%s' VMware Tools", c.ToolsUploadFlavor)) f, err := os.Open(tools_source) diff --git a/builder/vmware/common/step_upload_vmx.go b/builder/vmware/common/step_upload_vmx.go index 764c3c439..ce162b0d9 100644 --- a/builder/vmware/common/step_upload_vmx.go +++ b/builder/vmware/common/step_upload_vmx.go @@ -5,15 +5,15 @@ import ( "fmt" "path/filepath" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step upload the VMX to the remote host // // Uses: // driver Driver -// ui packer.Ui +// ui packersdk.Ui // vmx_path string // // Produces: @@ -25,7 +25,7 @@ type StepUploadVMX struct { func (c *StepUploadVMX) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vmxPath := state.Get("vmx_path").(string) if c.RemoteType == "esx5" { diff --git a/builder/vmware/common/step_vnc_boot_command.go b/builder/vmware/common/step_vnc_boot_command.go index 5841ba4c2..e68d64774 100644 --- a/builder/vmware/common/step_vnc_boot_command.go +++ b/builder/vmware/common/step_vnc_boot_command.go @@ -6,9 +6,9 @@ import ( "log" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/mitchellh/go-vnc" ) @@ -17,7 +17,7 @@ import ( // // Uses: // http_port int -// ui packer.Ui +// ui packersdk.Ui // vnc_port int // // Produces: @@ -42,7 +42,7 @@ func (s *StepVNCBootCommand) Run(ctx context.Context, state multistep.StateBag) debug := state.Get("debug").(bool) httpPort := state.Get("http_port").(int) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) conn := state.Get("vnc_conn").(*vnc.ClientConn) defer conn.Close() diff --git a/builder/vmware/common/step_vnc_connect.go b/builder/vmware/common/step_vnc_connect.go index 85c3ab365..043236752 100644 --- a/builder/vmware/common/step_vnc_connect.go +++ b/builder/vmware/common/step_vnc_connect.go @@ -8,8 +8,8 @@ import ( "net" "net/url" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/mitchellh/go-vnc" "golang.org/x/net/websocket" ) @@ -25,7 +25,7 @@ func (s *StepVNCConnect) Run(ctx context.Context, state multistep.StateBag) mult if !s.VNCOverWebsocket && !s.VNCEnabled { return multistep.ActionContinue } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) var c *vnc.ClientConn var err error diff --git a/builder/vmware/iso/builder.go b/builder/vmware/iso/builder.go index e12edd4ee..fea117e93 100644 --- a/builder/vmware/iso/builder.go +++ b/builder/vmware/iso/builder.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Builder struct { @@ -30,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName) if err != nil { return nil, fmt.Errorf("Failed creating VMware driver: %s", err) diff --git a/builder/vmware/iso/step_create_vmx.go b/builder/vmware/iso/step_create_vmx.go index e2dd96af9..749a6ce2f 100644 --- a/builder/vmware/iso/step_create_vmx.go +++ b/builder/vmware/iso/step_create_vmx.go @@ -10,8 +10,8 @@ import ( "strings" vmwcommon "github.com/hashicorp/packer/builder/vmware/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -60,7 +60,7 @@ type additionalDiskTemplateData struct { // Uses: // config *config // iso_path string -// ui packer.Ui +// ui packersdk.Ui // // Produces: // vmx_path string - The path to the VMX file. @@ -72,7 +72,7 @@ type stepCreateVMX struct { func (s *stepCreateVMX) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(*Config) isoPath := state.Get("iso_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Convert the iso_path into a path relative to the .vmx file if possible if relativeIsoPath, err := filepath.Rel(config.VMXTemplatePath, filepath.FromSlash(isoPath)); err == nil { diff --git a/builder/vmware/vmx/builder.go b/builder/vmware/vmx/builder.go index fe6594e86..c4d1d0bc7 100644 --- a/builder/vmware/vmx/builder.go +++ b/builder/vmware/vmx/builder.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Builder implements packer.Builder and builds the actual VMware @@ -35,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a Packer build and returns a packer.Artifact representing // a VMware image. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName) if err != nil { return nil, fmt.Errorf("Failed creating VMware driver: %s", err) diff --git a/builder/vmware/vmx/step_clone_vmx.go b/builder/vmware/vmx/step_clone_vmx.go index 76bcdc73c..be55ec9bb 100644 --- a/builder/vmware/vmx/step_clone_vmx.go +++ b/builder/vmware/vmx/step_clone_vmx.go @@ -9,8 +9,8 @@ import ( "regexp" vmwcommon "github.com/hashicorp/packer/builder/vmware/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -30,7 +30,7 @@ func (s *StepCloneVMX) Run(ctx context.Context, state multistep.StateBag) multis } driver := state.Get("driver").(vmwcommon.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Set the path we want for the new .vmx file and clone vmxPath := filepath.Join(*s.OutputDir, s.VMName+".vmx") diff --git a/builder/vsphere/clone/builder.go b/builder/vsphere/clone/builder.go index cec0ee29d..eea695d97 100644 --- a/builder/vsphere/clone/builder.go +++ b/builder/vsphere/clone/builder.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Builder struct { @@ -29,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("debug", b.config.PackerDebug) state.Put("hook", hook) diff --git a/builder/vsphere/clone/step_clone.go b/builder/vsphere/clone/step_clone.go index 850d2b3d5..f5f4f9f37 100644 --- a/builder/vsphere/clone/step_clone.go +++ b/builder/vsphere/clone/step_clone.go @@ -10,8 +10,8 @@ import ( "github.com/hashicorp/packer/builder/vsphere/common" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type vAppConfig struct { @@ -74,7 +74,7 @@ type StepCloneVM struct { } func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) d := state.Get("driver").(*driver.VCenterDriver) vmPath := path.Join(s.Location.Folder, s.Location.VMName) diff --git a/builder/vsphere/clone/step_customize.go b/builder/vsphere/clone/step_customize.go index c5ebecf96..9818f7765 100644 --- a/builder/vsphere/clone/step_customize.go +++ b/builder/vsphere/clone/step_customize.go @@ -9,8 +9,8 @@ import ( "net" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/vmware/govmomi/vim25/types" ) @@ -124,7 +124,7 @@ func (c *CustomizeConfig) Prepare() []error { func (s *StepCustomize) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { vm := state.Get("vm").(*driver.VirtualMachineDriver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) identity, err := s.identitySettings() if err != nil { diff --git a/builder/vsphere/common/cleanup_vm.go b/builder/vsphere/common/cleanup_vm.go index c5055c5fc..6e8dc5484 100644 --- a/builder/vsphere/common/cleanup_vm.go +++ b/builder/vsphere/common/cleanup_vm.go @@ -2,8 +2,8 @@ package common import ( "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func CleanupVM(state multistep.StateBag) { @@ -14,7 +14,7 @@ func CleanupVM(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) st := state.Get("vm") if st == nil { diff --git a/builder/vsphere/common/step_add_cdrom.go b/builder/vsphere/common/step_add_cdrom.go index f272736dc..8ac3d92fd 100644 --- a/builder/vsphere/common/step_add_cdrom.go +++ b/builder/vsphere/common/step_add_cdrom.go @@ -8,8 +8,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type CDRomConfig struct { @@ -41,7 +41,7 @@ func (c *CDRomConfig) Prepare() []error { } func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(driver.VirtualMachine) if s.Config.CdromType == "sata" { diff --git a/builder/vsphere/common/step_add_floppy.go b/builder/vsphere/common/step_add_floppy.go index c82b08850..81016f5b5 100644 --- a/builder/vsphere/common/step_add_floppy.go +++ b/builder/vsphere/common/step_add_floppy.go @@ -8,8 +8,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type FloppyConfig struct { @@ -36,7 +36,7 @@ type StepAddFloppy struct { } func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(driver.VirtualMachine) d := state.Get("driver").(driver.Driver) @@ -89,7 +89,7 @@ func (s *StepAddFloppy) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) d := state.Get("driver").(driver.Driver) if UploadedFloppyPath, ok := state.GetOk("uploaded_floppy_path"); ok { diff --git a/builder/vsphere/common/step_boot_command.go b/builder/vsphere/common/step_boot_command.go index 8d6658ad9..d1a4460d9 100644 --- a/builder/vsphere/common/step_boot_command.go +++ b/builder/vsphere/common/step_boot_command.go @@ -7,9 +7,9 @@ import ( "time" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/bootcommand" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "golang.org/x/mobile/event/key" ) @@ -42,7 +42,7 @@ type StepBootCommand struct { func (s *StepBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { debug := state.Get("debug").(bool) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) if s.Config.BootCommand == nil { diff --git a/builder/vsphere/common/step_config_params.go b/builder/vsphere/common/step_config_params.go index c317f25f5..7e35a0e7d 100644 --- a/builder/vsphere/common/step_config_params.go +++ b/builder/vsphere/common/step_config_params.go @@ -10,8 +10,8 @@ import ( "github.com/vmware/govmomi/vim25/types" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type ConfigParamsConfig struct { @@ -32,7 +32,7 @@ type StepConfigParams struct { } func (s *StepConfigParams) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) configParams := make(map[string]string) diff --git a/builder/vsphere/common/step_download.go b/builder/vsphere/common/step_download.go index 5b1adbda6..da22eea12 100644 --- a/builder/vsphere/common/step_download.go +++ b/builder/vsphere/common/step_download.go @@ -6,8 +6,8 @@ import ( "net/url" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Defining this interface ensures that we use the common step download, or the @@ -33,7 +33,7 @@ type StepDownload struct { func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(driver.Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) // Check whether iso is present on remote datastore. ds, err := driver.FindDatastore(s.Datastore, s.Host) diff --git a/builder/vsphere/common/step_export.go b/builder/vsphere/common/step_export.go index d3c857304..592644516 100644 --- a/builder/vsphere/common/step_export.go +++ b/builder/vsphere/common/step_export.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/pkg/errors" "github.com/vmware/govmomi/nfc" @@ -153,7 +154,7 @@ func (s *StepExport) Cleanup(multistep.StateBag) { } func (s *StepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) ui.Message("Starting export...") diff --git a/builder/vsphere/common/step_hardware.go b/builder/vsphere/common/step_hardware.go index 654a4145d..1ca1027dc 100644 --- a/builder/vsphere/common/step_hardware.go +++ b/builder/vsphere/common/step_hardware.go @@ -8,8 +8,8 @@ import ( "fmt" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type HardwareConfig struct { @@ -64,7 +64,7 @@ type StepConfigureHardware struct { } func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(driver.VirtualMachine) if *s.Config != (HardwareConfig{}) { diff --git a/builder/vsphere/common/step_import_to_content_library.go b/builder/vsphere/common/step_import_to_content_library.go index 9eacdd5ec..d80d620d1 100644 --- a/builder/vsphere/common/step_import_to_content_library.go +++ b/builder/vsphere/common/step_import_to_content_library.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/vmware/govmomi/vapi/vcenter" ) @@ -117,7 +118,7 @@ type StepImportToContentLibrary struct { } func (s *StepImportToContentLibrary) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) var err error diff --git a/builder/vsphere/common/step_remote_upload.go b/builder/vsphere/common/step_remote_upload.go index 631ab0924..44911c1c7 100644 --- a/builder/vsphere/common/step_remote_upload.go +++ b/builder/vsphere/common/step_remote_upload.go @@ -7,8 +7,8 @@ import ( "path/filepath" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRemoteUpload struct { @@ -19,7 +19,7 @@ type StepRemoteUpload struct { } func (s *StepRemoteUpload) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) d := state.Get("driver").(driver.Driver) if path, ok := state.GetOk("iso_path"); ok { @@ -54,7 +54,7 @@ func GetRemoteDirectoryAndPath(path string, ds driver.Datastore) (string, string return filename, remotePath, remoteDirectory, fullRemotePath } -func (s *StepRemoteUpload) uploadFile(path string, d driver.Driver, ui packer.Ui) (string, error) { +func (s *StepRemoteUpload) uploadFile(path string, d driver.Driver, ui packersdk.Ui) (string, error) { ds, err := d.FindDatastore(s.Datastore, s.Host) if err != nil { return "", fmt.Errorf("datastore doesn't exist: %v", err) @@ -98,7 +98,7 @@ func (s *StepRemoteUpload) Cleanup(state multistep.StateBag) { return } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) d := state.Get("driver").(*driver.VCenterDriver) ui.Say("Deleting cd_files image from remote datastore ...") diff --git a/builder/vsphere/common/step_remove_cdrom.go b/builder/vsphere/common/step_remove_cdrom.go index c3920ec29..0848aff76 100644 --- a/builder/vsphere/common/step_remove_cdrom.go +++ b/builder/vsphere/common/step_remove_cdrom.go @@ -7,8 +7,8 @@ import ( "context" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type RemoveCDRomConfig struct { @@ -21,7 +21,7 @@ type StepRemoveCDRom struct { } func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(driver.VirtualMachine) ui.Say("Eject CD-ROM drives...") diff --git a/builder/vsphere/common/step_remove_floppy.go b/builder/vsphere/common/step_remove_floppy.go index 4662c18b4..d94e4672d 100644 --- a/builder/vsphere/common/step_remove_floppy.go +++ b/builder/vsphere/common/step_remove_floppy.go @@ -4,8 +4,8 @@ import ( "context" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepRemoveFloppy struct { @@ -14,7 +14,7 @@ type StepRemoveFloppy struct { } func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(driver.VirtualMachine) d := state.Get("driver").(driver.Driver) diff --git a/builder/vsphere/common/step_run.go b/builder/vsphere/common/step_run.go index 9262cb31e..82ba25237 100644 --- a/builder/vsphere/common/step_run.go +++ b/builder/vsphere/common/step_run.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type RunConfig struct { @@ -23,7 +23,7 @@ type StepRun struct { } func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) if s.Config.BootOrder != "" { @@ -54,7 +54,7 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste } func (s *StepRun) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) if s.Config.BootOrder == "" && s.SetOrder { diff --git a/builder/vsphere/common/step_shutdown.go b/builder/vsphere/common/step_shutdown.go index 089aba26f..73f8594b7 100644 --- a/builder/vsphere/common/step_shutdown.go +++ b/builder/vsphere/common/step_shutdown.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type ShutdownConfig struct { @@ -52,7 +53,7 @@ type StepShutdown struct { } func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) if off, _ := vm.IsPoweredOff(); off { diff --git a/builder/vsphere/common/step_snapshot.go b/builder/vsphere/common/step_snapshot.go index ed595621d..af3afb8b9 100644 --- a/builder/vsphere/common/step_snapshot.go +++ b/builder/vsphere/common/step_snapshot.go @@ -4,8 +4,8 @@ import ( "context" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCreateSnapshot struct { @@ -13,7 +13,7 @@ type StepCreateSnapshot struct { } func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) if s.CreateSnapshot { diff --git a/builder/vsphere/common/step_ssh_key_pair.go b/builder/vsphere/common/step_ssh_key_pair.go index 80fecaabc..91de68fb9 100644 --- a/builder/vsphere/common/step_ssh_key_pair.go +++ b/builder/vsphere/common/step_ssh_key_pair.go @@ -9,8 +9,8 @@ import ( "github.com/hashicorp/packer/builder/vsphere/driver" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator/ssh" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" ) @@ -27,7 +27,7 @@ func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) mult return multistep.ActionContinue } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) comment := fmt.Sprintf("packer_%s", uuid.TimeOrderedUUID()) if s.Comm.SSHPrivateKeyFile != "" { @@ -107,7 +107,7 @@ func (s *StepSshKeyPair) Run(ctx context.Context, state multistep.StateBag) mult func (s *StepSshKeyPair) Cleanup(state multistep.StateBag) { if s.Debug { if err := os.Remove(s.DebugKeyPath); err != nil { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Error(fmt.Sprintf( "Error removing debug key '%s': %s", s.DebugKeyPath, err)) } diff --git a/builder/vsphere/common/step_template.go b/builder/vsphere/common/step_template.go index 91c14ff58..481a2056f 100644 --- a/builder/vsphere/common/step_template.go +++ b/builder/vsphere/common/step_template.go @@ -4,8 +4,8 @@ import ( "context" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepConvertToTemplate struct { @@ -13,7 +13,7 @@ type StepConvertToTemplate struct { } func (s *StepConvertToTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) if s.ConvertToTemplate { diff --git a/builder/vsphere/common/step_wait_for_ip.go b/builder/vsphere/common/step_wait_for_ip.go index 9a37534c4..263a0db6c 100644 --- a/builder/vsphere/common/step_wait_for_ip.go +++ b/builder/vsphere/common/step_wait_for_ip.go @@ -11,8 +11,8 @@ import ( "time" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type WaitIpConfig struct { @@ -74,7 +74,7 @@ func (c *WaitIpConfig) GetIPNet() *net.IPNet { } func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) vm := state.Get("vm").(*driver.VirtualMachineDriver) var ip string diff --git a/builder/vsphere/driver/driver.go b/builder/vsphere/driver/driver.go index 8e565a653..472a82f5c 100644 --- a/builder/vsphere/driver/driver.go +++ b/builder/vsphere/driver/driver.go @@ -6,7 +6,7 @@ import ( "net/url" "time" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" @@ -22,7 +22,7 @@ type Driver interface { NewVM(ref *types.ManagedObjectReference) VirtualMachine FindVM(name string) (VirtualMachine, error) FindCluster(name string) (*Cluster, error) - PreCleanVM(ui packer.Ui, vmPath string, force bool) error + PreCleanVM(ui packersdk.Ui, vmPath string, force bool) error CreateVM(config *CreateConfig) (VirtualMachine, error) NewDatastore(ref *types.ManagedObjectReference) Datastore diff --git a/builder/vsphere/driver/driver_mock.go b/builder/vsphere/driver/driver_mock.go index 7f8748606..6a2380514 100644 --- a/builder/vsphere/driver/driver_mock.go +++ b/builder/vsphere/driver/driver_mock.go @@ -3,7 +3,7 @@ package driver import ( "fmt" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/vmware/govmomi/vapi/library" "github.com/vmware/govmomi/vim25/types" ) @@ -52,7 +52,7 @@ func (d *DriverMock) FindCluster(name string) (*Cluster, error) { return nil, nil } -func (d *DriverMock) PreCleanVM(ui packer.Ui, vmPath string, force bool) error { +func (d *DriverMock) PreCleanVM(ui packersdk.Ui, vmPath string, force bool) error { d.PreCleanVMCalled = true if d.PreCleanShouldFail { return fmt.Errorf("pre clean failed") diff --git a/builder/vsphere/driver/vm.go b/builder/vsphere/driver/vm.go index acc80ec4e..d45fbbac1 100644 --- a/builder/vsphere/driver/vm.go +++ b/builder/vsphere/driver/vm.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/nfc" "github.com/vmware/govmomi/object" @@ -139,7 +139,7 @@ func (d *VCenterDriver) FindVM(name string) (VirtualMachine, error) { }, nil } -func (d *VCenterDriver) PreCleanVM(ui packer.Ui, vmPath string, force bool) error { +func (d *VCenterDriver) PreCleanVM(ui packersdk.Ui, vmPath string, force bool) error { vm, err := d.FindVM(vmPath) if err != nil { if _, ok := err.(*find.NotFoundError); !ok { diff --git a/builder/vsphere/iso/builder.go b/builder/vsphere/iso/builder.go index 837f4d7a6..8b6ff497a 100644 --- a/builder/vsphere/iso/builder.go +++ b/builder/vsphere/iso/builder.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Builder struct { @@ -28,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, warnings, nil } -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { state := new(multistep.BasicStateBag) state.Put("debug", b.config.PackerDebug) state.Put("hook", hook) diff --git a/builder/vsphere/iso/step_create.go b/builder/vsphere/iso/step_create.go index 7b13f151a..ca2f3bd03 100644 --- a/builder/vsphere/iso/step_create.go +++ b/builder/vsphere/iso/step_create.go @@ -10,8 +10,8 @@ import ( "github.com/hashicorp/packer/builder/vsphere/common" "github.com/hashicorp/packer/builder/vsphere/driver" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Defines a Network Adapter @@ -123,7 +123,7 @@ type StepCreateVM struct { } func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) d := state.Get("driver").(driver.Driver) vmPath := path.Join(s.Location.Folder, s.Location.VMName) diff --git a/builder/yandex/builder.go b/builder/yandex/builder.go index bbde04e84..c04479e3f 100644 --- a/builder/yandex/builder.go +++ b/builder/yandex/builder.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" @@ -49,7 +50,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { // Run executes a yandex Packer build and returns a packer.Artifact // representing a Yandex.Cloud compute image. -func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { driver, err := NewDriverYC(ui, &b.config.AccessConfig) ctx = requestid.ContextWithClientTraceID(ctx, uuid.New().String()) diff --git a/builder/yandex/driver_yc.go b/builder/yandex/driver_yc.go index 08e13d2aa..df4c9f46f 100644 --- a/builder/yandex/driver_yc.go +++ b/builder/yandex/driver_yc.go @@ -8,7 +8,7 @@ import ( "time" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/useragent" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -32,10 +32,10 @@ const ( type driverYC struct { sdk *ycsdk.SDK - ui packer.Ui + ui packersdk.Ui } -func NewDriverYC(ui packer.Ui, ac *AccessConfig) (Driver, error) { +func NewDriverYC(ui packersdk.Ui, ac *AccessConfig) (Driver, error) { log.Printf("[INFO] Initialize Yandex.Cloud client...") sdkConfig := ycsdk.Config{} diff --git a/builder/yandex/step_create_image.go b/builder/yandex/step_create_image.go index 429888a92..a225a522b 100644 --- a/builder/yandex/step_create_image.go +++ b/builder/yandex/step_create_image.go @@ -6,8 +6,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" @@ -20,7 +20,7 @@ type stepCreateImage struct { func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { sdk := state.Get("sdk").(*ycsdk.SDK) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) diskID := state.Get("disk_id").(string) diff --git a/builder/yandex/step_create_instance.go b/builder/yandex/step_create_instance.go index 0e6a99e89..46eb45aa9 100644 --- a/builder/yandex/step_create_instance.go +++ b/builder/yandex/step_create_instance.go @@ -7,8 +7,8 @@ import ( "io/ioutil" "github.com/c2h5oh/datasize" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" @@ -146,7 +146,7 @@ func getImage(ctx context.Context, c *Config, d Driver) (*Image, error) { func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { sdk := state.Get("sdk").(*ycsdk.SDK) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) @@ -317,7 +317,7 @@ func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag) func (s *StepCreateInstance) Cleanup(state multistep.StateBag) { config := state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ctx, cancel := context.WithTimeout(context.Background(), config.StateTimeout) defer cancel() @@ -390,7 +390,7 @@ func (s *StepCreateInstance) Cleanup(state multistep.StateBag) { func (s *StepCreateInstance) writeSerialLogFile(ctx context.Context, state multistep.StateBag) error { sdk := state.Get("sdk").(*ycsdk.SDK) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceID := state.Get("instance_id").(string) ui.Say("Try get instance's serial port output and write to file " + s.SerialLogFile) diff --git a/builder/yandex/step_create_ssh_key.go b/builder/yandex/step_create_ssh_key.go index 19178848a..193287463 100644 --- a/builder/yandex/step_create_ssh_key.go +++ b/builder/yandex/step_create_ssh_key.go @@ -10,8 +10,8 @@ import ( "io/ioutil" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -21,7 +21,7 @@ type StepCreateSSHKey struct { } func (s *StepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) if config.Communicator.SSHPrivateKeyFile != "" { diff --git a/builder/yandex/step_instance_info.go b/builder/yandex/step_instance_info.go index 3e7f0e3d5..e93758d07 100644 --- a/builder/yandex/step_instance_info.go +++ b/builder/yandex/step_instance_info.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" ycsdk "github.com/yandex-cloud/go-sdk" @@ -16,7 +16,7 @@ type stepInstanceInfo struct{} func (s *stepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { sdk := state.Get("sdk").(*ycsdk.SDK) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) instanceID := state.Get("instance_id").(string) diff --git a/builder/yandex/step_teardown_instance.go b/builder/yandex/step_teardown_instance.go index 0d34afe21..0c10b0673 100644 --- a/builder/yandex/step_teardown_instance.go +++ b/builder/yandex/step_teardown_instance.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" ycsdk "github.com/yandex-cloud/go-sdk" @@ -15,7 +15,7 @@ type StepTeardownInstance struct{} func (s *StepTeardownInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { sdk := state.Get("sdk").(*ycsdk.SDK) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) c := state.Get("config").(*Config) instanceID := state.Get("instance_id").(string) diff --git a/builder/yandex/step_wait_cloudinit_script.go b/builder/yandex/step_wait_cloudinit_script.go index 593def95c..35479f794 100644 --- a/builder/yandex/step_wait_cloudinit_script.go +++ b/builder/yandex/step_wait_cloudinit_script.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -22,7 +22,7 @@ type StepWaitCloudInitScript int func (s *StepWaitCloudInitScript) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { _ = state.Get("config").(*Config) driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) instanceID := state.Get("instance_id").(string) ui.Say("Waiting for any running cloud-init script to finish...") diff --git a/builder/yandex/util.go b/builder/yandex/util.go index f11905f5a..42d2082a4 100644 --- a/builder/yandex/util.go +++ b/builder/yandex/util.go @@ -2,12 +2,12 @@ package yandex import ( "github.com/c2h5oh/datasize" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func stepHaltWithError(state multistep.StateBag, err error) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/command/build.go b/command/build.go index da0036ed1..e5acbdec9 100644 --- a/command/build.go +++ b/command/build.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/hcl/v2/hclparse" "github.com/hashicorp/packer/hcl2template" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template" "github.com/hashicorp/packer/version" "golang.org/x/sync/semaphore" @@ -74,7 +75,7 @@ func (m *Meta) GetConfigFromHCL(cla *MetaArgs) (*hcl2template.PackerConfig, int) return cfg, writeDiags(m.Ui, parser.Files(), diags) } -func writeDiags(ui packer.Ui, files map[string]*hcl.File, diags hcl.Diagnostics) int { +func writeDiags(ui packersdk.Ui, files map[string]*hcl.File, diags hcl.Diagnostics) int { // write HCL errors/diagnostics if any. b := bytes.NewBuffer(nil) err := hcl.NewDiagnosticTextWriter(b, files, 80, false).WriteDiagnostics(diags) @@ -176,7 +177,7 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int packer.UiColorYellow, packer.UiColorBlue, } - buildUis := make(map[packer.Build]packer.Ui) + buildUis := make(map[packer.Build]packersdk.Ui) for i := range builds { ui := c.Ui if cla.Color { diff --git a/command/build_parallel_test.go b/command/build_parallel_test.go index abfc34d85..175cd6a02 100644 --- a/command/build_parallel_test.go +++ b/command/build_parallel_test.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/packer/builder/file" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/provisioner/sleep" ) @@ -36,7 +37,7 @@ func (b *ParallelTestBuilder) Prepare(raws ...interface{}) ([]string, []string, return nil, nil, nil } -func (b *ParallelTestBuilder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *ParallelTestBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { ui.Say("building") b.wg.Done() return nil, nil @@ -51,7 +52,7 @@ func (b *LockedBuilder) Prepare(raws ...interface{}) ([]string, []string, error) return nil, nil, nil } -func (b *LockedBuilder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *LockedBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { ui.Say("locking build") select { case <-b.unlock: diff --git a/command/meta.go b/command/meta.go index a57f7244b..60cae4c20 100644 --- a/command/meta.go +++ b/command/meta.go @@ -9,6 +9,7 @@ import ( kvflag "github.com/hashicorp/packer/command/flag-kv" "github.com/hashicorp/packer/helper/wrappedstreams" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template" ) @@ -26,7 +27,7 @@ const ( // Packer command inherits. type Meta struct { CoreConfig *packer.CoreConfig - Ui packer.Ui + Ui packersdk.Ui Version string } diff --git a/command/signal.go b/command/signal.go index 5fcbacae7..091509026 100644 --- a/command/signal.go +++ b/command/signal.go @@ -7,10 +7,10 @@ import ( "os/signal" "syscall" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -func handleTermInterrupt(ui packer.Ui) (context.Context, func()) { +func handleTermInterrupt(ui packersdk.Ui) (context.Context, func()) { ctx, cancelCtx := context.WithCancel(context.Background()) // Handle interrupts for this build sigCh := make(chan os.Signal, 1) diff --git a/go.mod b/go.mod index 352ad70ee..da0ef6825 100644 --- a/go.mod +++ b/go.mod @@ -59,6 +59,7 @@ require ( github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/go-cty-funcs v0.0.0-20200930094925-2721b1e36840 + github.com/hashicorp/go-getter v1.4.1 github.com/hashicorp/go-getter/gcs/v2 v2.0.0-20200604122502-a6995fa1edad github.com/hashicorp/go-getter/s3/v2 v2.0.0-20200604122502-a6995fa1edad github.com/hashicorp/go-getter/v2 v2.0.0-20200604122502-a6995fa1edad diff --git a/hcl2template/internal/mock.go b/hcl2template/internal/mock.go index 8b1dff62c..8a419ed5d 100644 --- a/hcl2template/internal/mock.go +++ b/hcl2template/internal/mock.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/json" @@ -77,7 +78,7 @@ func (b *MockBuilder) Prepare(raws ...interface{}) ([]string, []string, error) { return []string{"ID"}, nil, b.Config.Prepare(raws...) } -func (b *MockBuilder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { return nil, nil } @@ -99,7 +100,7 @@ func (b *MockProvisioner) Prepare(raws ...interface{}) error { return b.Config.Prepare(raws...) } -func (b *MockProvisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (b *MockProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { return nil } @@ -121,7 +122,7 @@ func (b *MockPostProcessor) Configure(raws ...interface{}) error { return b.Config.Prepare(raws...) } -func (b *MockPostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { +func (b *MockPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { return nil, false, false, nil } diff --git a/hcl2template/types.hcl_post-processor.go b/hcl2template/types.hcl_post-processor.go index 37ae1660f..d74366e7a 100644 --- a/hcl2template/types.hcl_post-processor.go +++ b/hcl2template/types.hcl_post-processor.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -62,7 +63,7 @@ func (p *HCL2PostProcessor) Configure(args ...interface{}) error { return p.PostProcessor.Configure(args...) } -func (p *HCL2PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *HCL2PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { generatedData := make(map[string]interface{}) if artifactStateData, ok := artifact.State("generated_data").(map[interface{}]interface{}); ok { for k, v := range artifactStateData { diff --git a/hcl2template/types.hcl_provisioner.go b/hcl2template/types.hcl_provisioner.go index c91d38cfd..dff9b31b5 100644 --- a/hcl2template/types.hcl_provisioner.go +++ b/hcl2template/types.hcl_provisioner.go @@ -3,9 +3,11 @@ package hcl2template import ( "context" "fmt" + "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -65,7 +67,7 @@ func (p *HCL2Provisioner) Prepare(args ...interface{}) error { return p.Provisioner.Prepare(args...) } -func (p *HCL2Provisioner) Provision(ctx context.Context, ui packer.Ui, c packer.Communicator, vars map[string]interface{}) error { +func (p *HCL2Provisioner) Provision(ctx context.Context, ui packersdk.Ui, c packer.Communicator, vars map[string]interface{}) error { err := p.HCL2Prepare(vars) if err != nil { return err diff --git a/helper/communicator/step_connect.go b/helper/communicator/step_connect.go index 8ecaa6b0e..5f4e881ec 100644 --- a/helper/communicator/step_connect.go +++ b/helper/communicator/step_connect.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/none" gossh "golang.org/x/crypto/ssh" ) @@ -57,7 +57,7 @@ func (s *StepConnect) pause(pauseLen time.Duration, ctx context.Context) bool { } func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) typeMap := map[string]multistep.Step{ "none": nil, diff --git a/helper/communicator/step_connect_ssh.go b/helper/communicator/step_connect_ssh.go index 93ba8a3a6..4b9e6b8c4 100644 --- a/helper/communicator/step_connect_ssh.go +++ b/helper/communicator/step_connect_ssh.go @@ -16,6 +16,7 @@ import ( helperssh "github.com/hashicorp/packer/helper/communicator/ssh" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/ssh" gossh "golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh/agent" @@ -34,7 +35,7 @@ type StepConnectSSH struct { } func (s *StepConnectSSH) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) var comm packer.Communicator var err error diff --git a/helper/communicator/step_connect_winrm.go b/helper/communicator/step_connect_winrm.go index 62d248701..7452687b3 100644 --- a/helper/communicator/step_connect_winrm.go +++ b/helper/communicator/step_connect_winrm.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/winrm" winrmcmd "github.com/masterzen/winrm" "golang.org/x/net/http/httpproxy" @@ -25,7 +26,7 @@ import ( // configuration when creating the step. // // Uses: -// ui packer.Ui +// ui packersdk.Ui // // Produces: // communicator packer.Communicator @@ -38,7 +39,7 @@ type StepConnectWinRM struct { } func (s *StepConnectWinRM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) var comm packer.Communicator var err error @@ -181,7 +182,7 @@ func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, ctx context.Co } log.Printf("Checking that WinRM is connected with: '%s'", connectCheckCommand) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) err := cmd.RunWithUi(ctx, comm, ui) if err != nil { diff --git a/helper/communicator/step_debug_ssh_keys.go b/helper/communicator/step_debug_ssh_keys.go index cd67e0641..ab3c62473 100644 --- a/helper/communicator/step_debug_ssh_keys.go +++ b/helper/communicator/step_debug_ssh_keys.go @@ -5,8 +5,8 @@ import ( "fmt" "io/ioutil" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepDumpSSHKey is a multistep Step implementation that writes the ssh @@ -17,7 +17,7 @@ type StepDumpSSHKey struct { } func (s *StepDumpSSHKey) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Message(fmt.Sprintf("Saving key for debug purposes: %s", s.Path)) diff --git a/helper/communicator/step_ssh_keygen.go b/helper/communicator/step_ssh_keygen.go index 73e340529..34f695779 100644 --- a/helper/communicator/step_ssh_keygen.go +++ b/helper/communicator/step_ssh_keygen.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/hashicorp/packer/helper/communicator/sshkey" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepSSHKeyGen is a Packer build step that generates SSH key pairs. @@ -18,7 +18,7 @@ type StepSSHKeyGen struct { // Run executes the Packer build step that generates SSH key pairs. // The key pairs are added to the ssh config func (s *StepSSHKeyGen) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) comm := s.CommConf if comm.SSHPrivateKeyFile != "" { diff --git a/main.go b/main.go index 55b295b78..3041a22e5 100644 --- a/main.go +++ b/main.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/go-uuid" "github.com/hashicorp/packer/command" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" "github.com/hashicorp/packer/packer/plugin" "github.com/hashicorp/packer/version" @@ -180,7 +181,7 @@ func wrappedMain() int { defer plugin.CleanupClients() - var ui packer.Ui + var ui packersdk.Ui if machineReadable { // Setup the UI as we're being machine-readable ui = &packer.MachineReadableUi{ diff --git a/packer-plugin-sdk/adapter/adapter.go b/packer-plugin-sdk/adapter/adapter.go index 8071fff52..230ffd34a 100644 --- a/packer-plugin-sdk/adapter/adapter.go +++ b/packer-plugin-sdk/adapter/adapter.go @@ -13,6 +13,7 @@ import ( "github.com/google/shlex" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "golang.org/x/crypto/ssh" ) @@ -23,11 +24,11 @@ type Adapter struct { l net.Listener config *ssh.ServerConfig sftpCmd string - ui packer.Ui + ui packersdk.Ui comm packer.Communicator } -func NewAdapter(done <-chan struct{}, l net.Listener, config *ssh.ServerConfig, sftpCmd string, ui packer.Ui, comm packer.Communicator) *Adapter { +func NewAdapter(done <-chan struct{}, l net.Listener, config *ssh.ServerConfig, sftpCmd string, ui packersdk.Ui, comm packer.Communicator) *Adapter { return &Adapter{ done: done, l: l, @@ -63,7 +64,7 @@ func (c *Adapter) Serve() { } } -func (c *Adapter) Handle(conn net.Conn, ui packer.Ui) error { +func (c *Adapter) Handle(conn net.Conn, ui packersdk.Ui) error { log.Print("SSH proxy: accepted connection") _, chans, reqs, err := ssh.NewServerConn(conn, c.config) if err != nil { diff --git a/packer-plugin-sdk/chroot/run_local_commands.go b/packer-plugin-sdk/chroot/run_local_commands.go index 320c7dcca..fce3d5154 100644 --- a/packer-plugin-sdk/chroot/run_local_commands.go +++ b/packer-plugin-sdk/chroot/run_local_commands.go @@ -6,11 +6,12 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" sl "github.com/hashicorp/packer/packer-plugin-sdk/shell-local" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) -func RunLocalCommands(commands []string, wrappedCommand common.CommandWrapper, ictx interpolate.Context, ui packer.Ui) error { +func RunLocalCommands(commands []string, wrappedCommand common.CommandWrapper, ictx interpolate.Context, ui packersdk.Ui) error { ctx := context.TODO() for _, rawCmd := range commands { intCmd, err := interpolate.Render(rawCmd, &ictx) diff --git a/packer-plugin-sdk/chroot/step_chroot_provision.go b/packer-plugin-sdk/chroot/step_chroot_provision.go index e3e9030a7..60f2c3a17 100644 --- a/packer-plugin-sdk/chroot/step_chroot_provision.go +++ b/packer-plugin-sdk/chroot/step_chroot_provision.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepChrootProvision provisions the instance within a chroot. @@ -17,7 +18,7 @@ type StepChrootProvision struct { func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { hook := state.Get("hook").(packer.Hook) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) // Create our communicator diff --git a/packer-plugin-sdk/chroot/step_copy_files.go b/packer-plugin-sdk/chroot/step_copy_files.go index 1d2efa7cf..50c76b68c 100644 --- a/packer-plugin-sdk/chroot/step_copy_files.go +++ b/packer-plugin-sdk/chroot/step_copy_files.go @@ -8,9 +8,9 @@ import ( "path/filepath" "runtime" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepCopyFiles copies some files from the host into the chroot environment. @@ -25,7 +25,7 @@ type StepCopyFiles struct { func (s *StepCopyFiles) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) stderr := new(bytes.Buffer) @@ -75,7 +75,7 @@ func (s *StepCopyFiles) Run(ctx context.Context, state multistep.StateBag) multi } func (s *StepCopyFiles) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) } diff --git a/packer-plugin-sdk/chroot/step_copy_files_test.go b/packer-plugin-sdk/chroot/step_copy_files_test.go index e5ebabc85..fc257188e 100644 --- a/packer-plugin-sdk/chroot/step_copy_files_test.go +++ b/packer-plugin-sdk/chroot/step_copy_files_test.go @@ -13,10 +13,11 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // testUI returns a test ui plus a function to retrieve the errors written to the ui -func testUI() (packer.Ui, func() string) { +func testUI() (packersdk.Ui, func() string) { errorBuffer := &strings.Builder{} ui := &packer.BasicUi{ Reader: strings.NewReader(""), diff --git a/packer-plugin-sdk/chroot/step_early_cleanup.go b/packer-plugin-sdk/chroot/step_early_cleanup.go index e84ac77e2..e8cf9593f 100644 --- a/packer-plugin-sdk/chroot/step_early_cleanup.go +++ b/packer-plugin-sdk/chroot/step_early_cleanup.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepEarlyCleanup performs some of the cleanup steps early in order to @@ -14,7 +14,7 @@ import ( type StepEarlyCleanup struct{} func (s *StepEarlyCleanup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cleanupKeys := []string{ "copy_files_cleanup", "mount_extra_cleanup", diff --git a/packer-plugin-sdk/chroot/step_mount_extra.go b/packer-plugin-sdk/chroot/step_mount_extra.go index 8d460718c..0ad511df2 100644 --- a/packer-plugin-sdk/chroot/step_mount_extra.go +++ b/packer-plugin-sdk/chroot/step_mount_extra.go @@ -8,9 +8,9 @@ import ( "os/exec" "syscall" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepMountExtra mounts the attached device. @@ -24,7 +24,7 @@ type StepMountExtra struct { func (s *StepMountExtra) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) s.mounts = make([]string, 0, len(s.ChrootMounts)) @@ -77,7 +77,7 @@ func (s *StepMountExtra) Run(ctx context.Context, state multistep.StateBag) mult } func (s *StepMountExtra) Cleanup(state multistep.StateBag) { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if err := s.CleanupFunc(state); err != nil { ui.Error(err.Error()) diff --git a/packer-plugin-sdk/chroot/step_post_mount_commands.go b/packer-plugin-sdk/chroot/step_post_mount_commands.go index d6ee85968..55ecee7ca 100644 --- a/packer-plugin-sdk/chroot/step_post_mount_commands.go +++ b/packer-plugin-sdk/chroot/step_post_mount_commands.go @@ -3,9 +3,9 @@ package chroot import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type postMountCommandsData struct { @@ -23,7 +23,7 @@ func (s *StepPostMountCommands) Run(ctx context.Context, state multistep.StateBa config := state.Get("config").(interpolateContextProvider) device := state.Get("device").(string) mountPath := state.Get("mount_path").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) if len(s.Commands) == 0 { diff --git a/packer-plugin-sdk/chroot/step_pre_mount_commands.go b/packer-plugin-sdk/chroot/step_pre_mount_commands.go index 20404659f..41c413a13 100644 --- a/packer-plugin-sdk/chroot/step_pre_mount_commands.go +++ b/packer-plugin-sdk/chroot/step_pre_mount_commands.go @@ -3,9 +3,9 @@ package chroot import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type preMountCommandsData struct { @@ -20,7 +20,7 @@ type StepPreMountCommands struct { func (s *StepPreMountCommands) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { config := state.Get("config").(interpolateContextProvider) device := state.Get("device").(string) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper) if len(s.Commands) == 0 { diff --git a/packer-plugin-sdk/multistep/commonsteps/multistep_debug.go b/packer-plugin-sdk/multistep/commonsteps/multistep_debug.go index 74b45a61c..5c64d3545 100644 --- a/packer-plugin-sdk/multistep/commonsteps/multistep_debug.go +++ b/packer-plugin-sdk/multistep/commonsteps/multistep_debug.go @@ -5,13 +5,13 @@ import ( "log" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // MultistepDebugFn will return a proper multistep.DebugPauseFn to // use for debugging if you're using multistep in your builder. -func MultistepDebugFn(ui packer.Ui) multistep.DebugPauseFn { +func MultistepDebugFn(ui packersdk.Ui) multistep.DebugPauseFn { return func(loc multistep.DebugLocation, name string, state multistep.StateBag) { var locationString string switch loc { diff --git a/packer-plugin-sdk/multistep/commonsteps/multistep_runner.go b/packer-plugin-sdk/multistep/commonsteps/multistep_runner.go index d9654cc6c..119a7e8e3 100644 --- a/packer-plugin-sdk/multistep/commonsteps/multistep_runner.go +++ b/packer-plugin-sdk/multistep/commonsteps/multistep_runner.go @@ -8,12 +8,12 @@ import ( "strings" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -func newRunner(steps []multistep.Step, config common.PackerConfig, ui packer.Ui) (multistep.Runner, multistep.DebugPauseFn) { +func newRunner(steps []multistep.Step, config common.PackerConfig, ui packersdk.Ui) (multistep.Runner, multistep.DebugPauseFn) { switch config.PackerOnError { case "", "cleanup": case "abort": @@ -48,7 +48,7 @@ func newRunner(steps []multistep.Step, config common.PackerConfig, ui packer.Ui) // NewRunner returns a multistep.Runner that runs steps augmented with support // for -debug and -on-error command line arguments. -func NewRunner(steps []multistep.Step, config common.PackerConfig, ui packer.Ui) multistep.Runner { +func NewRunner(steps []multistep.Step, config common.PackerConfig, ui packersdk.Ui) multistep.Runner { runner, _ := newRunner(steps, config, ui) return runner } @@ -57,7 +57,7 @@ func NewRunner(steps []multistep.Step, config common.PackerConfig, ui packer.Ui) // with support for -debug and -on-error command line arguments. With -debug it // puts the multistep.DebugPauseFn that will pause execution between steps into // the state under the key "pauseFn". -func NewRunnerWithPauseFn(steps []multistep.Step, config common.PackerConfig, ui packer.Ui, state multistep.StateBag) multistep.Runner { +func NewRunnerWithPauseFn(steps []multistep.Step, config common.PackerConfig, ui packersdk.Ui, state multistep.StateBag) multistep.Runner { runner, pauseFn := newRunner(steps, config, ui) if pauseFn != nil { state.Put("pauseFn", pauseFn) @@ -72,7 +72,7 @@ func typeName(i interface{}) string { type abortStep struct { step multistep.Step cleanupProv bool - ui packer.Ui + ui packersdk.Ui } func (s abortStep) InnerStepName() string { @@ -98,7 +98,7 @@ func (s abortStep) Cleanup(state multistep.StateBag) { type askStep struct { step multistep.Step - ui packer.Ui + ui packersdk.Ui } func (s askStep) InnerStepName() string { @@ -148,7 +148,7 @@ const ( askRetry ) -func ask(ui packer.Ui, name string, state multistep.StateBag) askResponse { +func ask(ui packersdk.Ui, name string, state multistep.StateBag) askResponse { ui.Say(fmt.Sprintf("Step %q failed", name)) result := make(chan askResponse) @@ -168,7 +168,7 @@ func ask(ui packer.Ui, name string, state multistep.StateBag) askResponse { } } -func askPrompt(ui packer.Ui) askResponse { +func askPrompt(ui packersdk.Ui) askResponse { for { line, err := ui.Ask("[c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succeeds)?") if err != nil { @@ -188,7 +188,7 @@ func askPrompt(ui packer.Ui) askResponse { } } -func handleAbortsAndInterupts(state multistep.StateBag, ui packer.Ui, stepName string) bool { +func handleAbortsAndInterupts(state multistep.StateBag, ui packersdk.Ui, stepName string) bool { // if returns false, don't run cleanup. If true, do run cleanup. _, alreadyLogged := state.GetOk("abort_step_logged") diff --git a/packer-plugin-sdk/multistep/commonsteps/step_cleanup_temp_keys.go b/packer-plugin-sdk/multistep/commonsteps/step_cleanup_temp_keys.go index 0bb41c342..aa9924797 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_cleanup_temp_keys.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_cleanup_temp_keys.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type StepCleanupTempKeys struct { @@ -32,7 +33,7 @@ func (s *StepCleanupTempKeys) Run(ctx context.Context, state multistep.StateBag) } comm := state.Get("communicator").(packer.Communicator) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cmd := new(packer.RemoteCmd) diff --git a/packer-plugin-sdk/multistep/commonsteps/step_create_cdrom.go b/packer-plugin-sdk/multistep/commonsteps/step_create_cdrom.go index 0729ae09c..fddeed117 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_create_cdrom.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_create_cdrom.go @@ -11,8 +11,8 @@ import ( "runtime" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/shell-local/localexec" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) @@ -36,7 +36,7 @@ func (s *StepCreateCD) Run(ctx context.Context, state multistep.StateBag) multis return multistep.ActionContinue } - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating CD disk...") if s.Label == "" { diff --git a/packer-plugin-sdk/multistep/commonsteps/step_create_floppy.go b/packer-plugin-sdk/multistep/commonsteps/step_create_floppy.go index 5354143df..920da32fa 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_create_floppy.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_create_floppy.go @@ -10,8 +10,8 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" "github.com/mitchellh/go-fs" "github.com/mitchellh/go-fs/fat" @@ -42,7 +42,7 @@ func (s *StepCreateFloppy) Run(ctx context.Context, state multistep.StateBag) mu s.FilesAdded = make(map[string]bool) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Creating floppy disk...") // Create a temporary file to be our floppy drive diff --git a/packer-plugin-sdk/multistep/commonsteps/step_download.go b/packer-plugin-sdk/multistep/commonsteps/step_download.go index 36a38ae7c..dee8bcf76 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_download.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_download.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/filelock" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepDownload downloads a remote file using the download client within @@ -28,7 +29,7 @@ import ( // // Uses: // cache packer.Cache -// ui packer.Ui +// ui packersdk.Ui type StepDownload struct { // The checksum and the type of the checksum for the download Checksum string @@ -72,7 +73,7 @@ func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multis defer log.Printf("Leaving retrieve loop for %s", s.Description) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say(fmt.Sprintf("Retrieving %s", s.Description)) var errs []error @@ -160,7 +161,7 @@ func (s *StepDownload) UseSourceToFindCacheTarget(source string) (*url.URL, stri return u, targetPath, nil } -func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string) (string, error) { +func (s *StepDownload) download(ctx context.Context, ui packersdk.Ui, source string) (string, error) { u, targetPath, err := s.UseSourceToFindCacheTarget(source) if err != nil { return "", err diff --git a/packer-plugin-sdk/multistep/commonsteps/step_http_server.go b/packer-plugin-sdk/multistep/commonsteps/step_http_server.go index 6da16718e..59a643055 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_http_server.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_http_server.go @@ -6,9 +6,9 @@ import ( "net/http" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/net" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This step creates and runs the HTTP server that is serving files from the @@ -16,7 +16,7 @@ import ( // template. // // Uses: -// ui packer.Ui +// ui packersdk.Ui // // Produces: // http_port int - The port the HTTP server started on. @@ -30,7 +30,7 @@ type StepHTTPServer struct { } func (s *StepHTTPServer) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if s.HTTPDir == "" { state.Put("http_port", 0) diff --git a/packer-plugin-sdk/multistep/commonsteps/step_output_dir.go b/packer-plugin-sdk/multistep/commonsteps/step_output_dir.go index c1e43716a..3a747ff03 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_output_dir.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_output_dir.go @@ -8,8 +8,8 @@ import ( "path/filepath" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepOutputDir sets up the output directory by creating it if it does @@ -23,7 +23,7 @@ type StepOutputDir struct { } func (s *StepOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) if _, err := os.Stat(s.Path); err == nil { if !s.Force { @@ -70,7 +70,7 @@ func (s *StepOutputDir) Cleanup(state multistep.StateBag) { _, halted := state.GetOk(multistep.StateHalted) if cancelled || halted { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) ui.Say("Deleting output directory...") for i := 0; i < 5; i++ { diff --git a/packer-plugin-sdk/multistep/commonsteps/step_provision.go b/packer-plugin-sdk/multistep/commonsteps/step_provision.go index 9b7cc47e2..a7118b84c 100644 --- a/packer-plugin-sdk/multistep/commonsteps/step_provision.go +++ b/packer-plugin-sdk/multistep/commonsteps/step_provision.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // StepProvision runs the provisioners. @@ -18,7 +19,7 @@ import ( // Uses: // communicator packer.Communicator // hook packer.Hook -// ui packer.Ui +// ui packersdk.Ui // // Produces: // @@ -109,7 +110,7 @@ func (s *StepProvision) runWithHook(ctx context.Context, state multistep.StateBa } hook := state.Get("hook").(packer.Hook) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) hookData := PopulateProvisionHookData(state) diff --git a/packer-plugin-sdk/packer/ui.go b/packer-plugin-sdk/packer/ui.go new file mode 100644 index 000000000..1bc1b4591 --- /dev/null +++ b/packer-plugin-sdk/packer/ui.go @@ -0,0 +1,16 @@ +package packer + +import "github.com/hashicorp/go-getter" + +// The Ui interface handles all communication for Packer with the outside +// world. This sort of control allows us to strictly control how output +// is formatted and various levels of output. +type Ui interface { + Ask(string) (string, error) + Say(string) + Message(string) + Error(string) + Machine(string, ...string) + // TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser) + getter.ProgressTracker +} diff --git a/packer-plugin-sdk/shell-local/localexec/run_and_stream.go b/packer-plugin-sdk/shell-local/localexec/run_and_stream.go index d1c7d8d1c..c5f932015 100644 --- a/packer-plugin-sdk/shell-local/localexec/run_and_stream.go +++ b/packer-plugin-sdk/shell-local/localexec/run_and_stream.go @@ -12,13 +12,14 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/iochan" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // RunAndStream allows you to run a local command and stream output to the UI. // This does not require use of a shell-local communicator, so is a nice tool // for plugins that need to shell out to a local dependency and provide clear // output to users. -func RunAndStream(cmd *exec.Cmd, ui packer.Ui, sensitive []string) error { +func RunAndStream(cmd *exec.Cmd, ui packersdk.Ui, sensitive []string) error { stdout_r, stdout_w := io.Pipe() stderr_r, stderr_w := io.Pipe() defer stdout_w.Close() diff --git a/packer-plugin-sdk/shell-local/run.go b/packer-plugin-sdk/shell-local/run.go index 8e52f5a09..9b7a0b961 100644 --- a/packer-plugin-sdk/shell-local/run.go +++ b/packer-plugin-sdk/shell-local/run.go @@ -13,11 +13,12 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" ) -func Run(ctx context.Context, ui packer.Ui, config *Config, generatedData map[string]interface{}) (bool, error) { +func Run(ctx context.Context, ui packersdk.Ui, config *Config, generatedData map[string]interface{}) (bool, error) { if generatedData != nil { config.generatedData = generatedData } else { diff --git a/packer/build.go b/packer/build.go index 28e02f3c5..28313ee27 100644 --- a/packer/build.go +++ b/packer/build.go @@ -6,6 +6,7 @@ import ( "log" "sync" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/version" ) @@ -63,7 +64,7 @@ type Build interface { // Run runs the actual builder, returning an artifact implementation // of what is built. If anything goes wrong, an error is returned. // Run can be context cancelled. - Run(context.Context, Ui) ([]Artifact, error) + Run(context.Context, packersdk.Ui) ([]Artifact, error) // SetDebug will enable/disable debug mode. Debug mode is always // enabled by adding the additional key "packer_debug" to boolean @@ -231,7 +232,7 @@ func (b *CoreBuild) Prepare() (warn []string, err error) { } // Runs the actual build. Prepare must be called prior to running this. -func (b *CoreBuild) Run(ctx context.Context, originalUi Ui) ([]Artifact, error) { +func (b *CoreBuild) Run(ctx context.Context, originalUi packersdk.Ui) ([]Artifact, error) { if !b.prepareCalled { panic("Prepare must be called first") } diff --git a/packer/builder.go b/packer/builder.go index 11bdc3046..9c0296632 100644 --- a/packer/builder.go +++ b/packer/builder.go @@ -2,6 +2,8 @@ package packer import ( "context" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Implementers of Builder are responsible for actually building images @@ -35,5 +37,5 @@ type Builder interface { Prepare(...interface{}) ([]string, []string, error) // Run is where the actual build should take place. It takes a Build and a Ui. - Run(context.Context, Ui, Hook) (Artifact, error) + Run(context.Context, packersdk.Ui, Hook) (Artifact, error) } diff --git a/packer/builder_mock.go b/packer/builder_mock.go index 06aa87291..e3585fd95 100644 --- a/packer/builder_mock.go +++ b/packer/builder_mock.go @@ -7,6 +7,7 @@ import ( "errors" "github.com/hashicorp/hcl/v2/hcldec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // MockBuilder is an implementation of Builder that can be used for tests. @@ -22,7 +23,7 @@ type MockBuilder struct { PrepareConfig []interface{} RunCalled bool RunHook Hook - RunUi Ui + RunUi packersdk.Ui CancelCalled bool RunFn func(ctx context.Context) @@ -39,7 +40,7 @@ func (tb *MockBuilder) Prepare(config ...interface{}) ([]string, []string, error return tb.GeneratedVars, tb.PrepareWarnings, nil } -func (tb *MockBuilder) Run(ctx context.Context, ui Ui, h Hook) (Artifact, error) { +func (tb *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, h Hook) (Artifact, error) { tb.RunCalled = true tb.RunHook = h tb.RunUi = ui diff --git a/packer/builder_mock.hcl2spec.go b/packer/builder_mock.hcl2spec.go index 5f5de8a11..61687b14c 100644 --- a/packer/builder_mock.hcl2spec.go +++ b/packer/builder_mock.hcl2spec.go @@ -5,6 +5,7 @@ import ( "io" "github.com/hashicorp/hcl/v2/hcldec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -19,7 +20,7 @@ type FlatMockBuilder struct { PrepareConfig []interface{} `cty:"prepare_config" hcl:"prepare_config"` RunCalled *bool `cty:"run_called" hcl:"run_called"` RunHook Hook `cty:"run_hook" hcl:"run_hook"` - RunUi Ui `cty:"run_ui" hcl:"run_ui"` + RunUi packersdk.Ui `cty:"run_ui" hcl:"run_ui"` CancelCalled *bool `cty:"cancel_called" hcl:"cancel_called"` GeneratedVars []string `cty:"generated_vars" hcl:"generated_vars"` } @@ -120,7 +121,7 @@ type FlatMockPostProcessor struct { ConfigureError error `cty:"configure_error" hcl:"configure_error"` PostProcessCalled *bool `cty:"post_process_called" hcl:"post_process_called"` PostProcessArtifact Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"` - PostProcessUi Ui `cty:"post_process_ui" hcl:"post_process_ui"` + PostProcessUi packersdk.Ui `cty:"post_process_ui" hcl:"post_process_ui"` } // FlatMapstructure returns a new FlatMockPostProcessor. @@ -157,7 +158,7 @@ type FlatMockProvisioner struct { ProvCalled *bool `cty:"prov_called" hcl:"prov_called"` ProvRetried *bool `cty:"prov_retried" hcl:"prov_retried"` ProvCommunicator Communicator `cty:"prov_communicator" hcl:"prov_communicator"` - ProvUi Ui `cty:"prov_ui" hcl:"prov_ui"` + ProvUi packersdk.Ui `cty:"prov_ui" hcl:"prov_ui"` } // FlatMapstructure returns a new FlatMockProvisioner. diff --git a/packer/communicator.go b/packer/communicator.go index 026737d4b..6bf76e86a 100644 --- a/packer/communicator.go +++ b/packer/communicator.go @@ -8,6 +8,7 @@ import ( "sync" "unicode" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/mitchellh/iochan" ) @@ -88,7 +89,7 @@ type ConfigurableCommunicator interface { // RunWithUi runs the remote command and streams the output to any configured // Writers for stdout/stderr, while also writing each line as it comes to a Ui. // RunWithUi will not return until the command finishes or is cancelled. -func (r *RemoteCmd) RunWithUi(ctx context.Context, c Communicator, ui Ui) error { +func (r *RemoteCmd) RunWithUi(ctx context.Context, c Communicator, ui packersdk.Ui) error { r.initchan() stdout_r, stdout_w := io.Pipe() diff --git a/packer/hook.go b/packer/hook.go index ee8104ac9..583fcb706 100644 --- a/packer/hook.go +++ b/packer/hook.go @@ -2,6 +2,8 @@ package packer import ( "context" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // This is the hook that should be fired for provisioners to run. @@ -22,7 +24,7 @@ const HookCleanupProvision = "packer_cleanup_provision" // must be race-free. Cancel should attempt to cancel the hook in the quickest, // safest way possible. type Hook interface { - Run(context.Context, string, Ui, Communicator, interface{}) error + Run(context.Context, string, packersdk.Ui, Communicator, interface{}) error } // A Hook implementation that dispatches based on an internal mapping. @@ -33,7 +35,7 @@ type DispatchHook struct { // Runs the hook with the given name by dispatching it to the proper // hooks if a mapping exists. If a mapping doesn't exist, then nothing // happens. -func (h *DispatchHook) Run(ctx context.Context, name string, ui Ui, comm Communicator, data interface{}) error { +func (h *DispatchHook) Run(ctx context.Context, name string, ui packersdk.Ui, comm Communicator, data interface{}) error { hooks, ok := h.Mapping[name] if !ok { // No hooks for that name. No problem. diff --git a/packer/hook_mock.go b/packer/hook_mock.go index 16571f1fe..f6243f988 100644 --- a/packer/hook_mock.go +++ b/packer/hook_mock.go @@ -2,6 +2,8 @@ package packer import ( "context" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // MockHook is an implementation of Hook that can be used for tests. @@ -12,10 +14,10 @@ type MockHook struct { RunComm Communicator RunData interface{} RunName string - RunUi Ui + RunUi packersdk.Ui } -func (t *MockHook) Run(ctx context.Context, name string, ui Ui, comm Communicator, data interface{}) error { +func (t *MockHook) Run(ctx context.Context, name string, ui packersdk.Ui, comm Communicator, data interface{}) error { t.RunCalled = true t.RunComm = comm diff --git a/packer/hook_test.go b/packer/hook_test.go index efe0f0fd0..8bbbb943e 100644 --- a/packer/hook_test.go +++ b/packer/hook_test.go @@ -3,6 +3,8 @@ package packer import ( "context" "testing" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestDispatchHook_Implements(t *testing.T) { @@ -40,7 +42,7 @@ type CancelHook struct { cancel func() } -func (h *CancelHook) Run(ctx context.Context, _ string, _ Ui, _ Communicator, _ interface{}) error { +func (h *CancelHook) Run(ctx context.Context, _ string, _ packersdk.Ui, _ Communicator, _ interface{}) error { h.cancel() <-ctx.Done() return ctx.Err() diff --git a/packer/plugin/builder.go b/packer/plugin/builder.go index abe508692..95ee181eb 100644 --- a/packer/plugin/builder.go +++ b/packer/plugin/builder.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdBuilder struct { @@ -31,7 +32,7 @@ func (b *cmdBuilder) Prepare(config ...interface{}) ([]string, []string, error) return b.builder.Prepare(config...) } -func (b *cmdBuilder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *cmdBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { defer func() { r := recover() b.checkExit(r, nil) diff --git a/packer/plugin/hook.go b/packer/plugin/hook.go index e983e00af..92da9cb18 100644 --- a/packer/plugin/hook.go +++ b/packer/plugin/hook.go @@ -5,6 +5,7 @@ import ( "log" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdHook struct { @@ -12,7 +13,7 @@ type cmdHook struct { client *Client } -func (c *cmdHook) Run(ctx context.Context, name string, ui packer.Ui, comm packer.Communicator, data interface{}) error { +func (c *cmdHook) Run(ctx context.Context, name string, ui packersdk.Ui, comm packer.Communicator, data interface{}) error { defer func() { r := recover() c.checkExit(r, nil) diff --git a/packer/plugin/post_processor.go b/packer/plugin/post_processor.go index 98a956523..1d9877081 100644 --- a/packer/plugin/post_processor.go +++ b/packer/plugin/post_processor.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdPostProcessor struct { @@ -31,7 +32,7 @@ func (c *cmdPostProcessor) Configure(config ...interface{}) error { return c.p.Configure(config...) } -func (c *cmdPostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { +func (c *cmdPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { defer func() { r := recover() c.checkExit(r, nil) diff --git a/packer/plugin/post_processor_test.go b/packer/plugin/post_processor_test.go index b28340773..5c72d8f45 100644 --- a/packer/plugin/post_processor_test.go +++ b/packer/plugin/post_processor_test.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type helperPostProcessor byte @@ -17,7 +18,7 @@ func (helperPostProcessor) Configure(...interface{}) error { return nil } -func (helperPostProcessor) PostProcess(context.Context, packer.Ui, packer.Artifact) (packer.Artifact, bool, bool, error) { +func (helperPostProcessor) PostProcess(context.Context, packersdk.Ui, packer.Artifact) (packer.Artifact, bool, bool, error) { return nil, false, false, nil } diff --git a/packer/plugin/provisioner.go b/packer/plugin/provisioner.go index bc07d6b61..8602b7ad1 100644 --- a/packer/plugin/provisioner.go +++ b/packer/plugin/provisioner.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdProvisioner struct { @@ -31,7 +32,7 @@ func (c *cmdProvisioner) Prepare(configs ...interface{}) error { return c.p.Prepare(configs...) } -func (c *cmdProvisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (c *cmdProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { defer func() { r := recover() c.checkExit(r, nil) diff --git a/packer/post_processor.go b/packer/post_processor.go index fd7df4e27..b1f32382c 100644 --- a/packer/post_processor.go +++ b/packer/post_processor.go @@ -1,6 +1,10 @@ package packer -import "context" +import ( + "context" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" +) // A PostProcessor is responsible for taking an artifact of a build // and doing some sort of post-processing to turn this into another @@ -22,5 +26,5 @@ type PostProcessor interface { // user input for keep_input_artifact is ignored and the artifact is either // kept or discarded according to the value set in `keep`. // PostProcess is cancellable using context - PostProcess(context.Context, Ui, Artifact) (a Artifact, keep bool, forceOverride bool, err error) + PostProcess(context.Context, packersdk.Ui, Artifact) (a Artifact, keep bool, forceOverride bool, err error) } diff --git a/packer/post_processor_mock.go b/packer/post_processor_mock.go index b03abd4eb..87284e819 100644 --- a/packer/post_processor_mock.go +++ b/packer/post_processor_mock.go @@ -4,6 +4,7 @@ import ( "context" "github.com/hashicorp/hcl/v2/hcldec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // MockPostProcessor is an implementation of PostProcessor that can be @@ -20,7 +21,7 @@ type MockPostProcessor struct { PostProcessCalled bool PostProcessArtifact Artifact - PostProcessUi Ui + PostProcessUi packersdk.Ui } func (t *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec { return t.FlatMapstructure().HCL2Spec() } @@ -31,7 +32,7 @@ func (t *MockPostProcessor) Configure(configs ...interface{}) error { return t.ConfigureError } -func (t *MockPostProcessor) PostProcess(ctx context.Context, ui Ui, a Artifact) (Artifact, bool, bool, error) { +func (t *MockPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a Artifact) (Artifact, bool, bool, error) { t.PostProcessCalled = true t.PostProcessArtifact = a t.PostProcessUi = ui diff --git a/packer/provisioner.go b/packer/provisioner.go index 78da57524..0fa22fb42 100644 --- a/packer/provisioner.go +++ b/packer/provisioner.go @@ -8,6 +8,7 @@ import ( "time" "github.com/hashicorp/hcl/v2/hcldec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" ) @@ -25,7 +26,7 @@ type Provisioner interface { // given for cancellation, a UI is given to communicate with the user, and // a communicator is given that is guaranteed to be connected to some // machine so that provisioning can be done. - Provision(context.Context, Ui, Communicator, map[string]interface{}) error + Provision(context.Context, packersdk.Ui, Communicator, map[string]interface{}) error } // A HookedProvisioner represents a provisioner and information describing it @@ -119,7 +120,7 @@ func CastDataToMap(data interface{}) map[string]interface{} { } // Runs the provisioners in order. -func (h *ProvisionHook) Run(ctx context.Context, name string, ui Ui, comm Communicator, data interface{}) error { +func (h *ProvisionHook) Run(ctx context.Context, name string, ui packersdk.Ui, comm Communicator, data interface{}) error { // Shortcut if len(h.Provisioners) == 0 { return nil @@ -159,7 +160,7 @@ func (p *PausedProvisioner) Prepare(raws ...interface{}) error { return p.Provisioner.Prepare(raws...) } -func (p *PausedProvisioner) Provision(ctx context.Context, ui Ui, comm Communicator, generatedData map[string]interface{}) error { +func (p *PausedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm Communicator, generatedData map[string]interface{}) error { // Use a select to determine if we get cancelled during the wait ui.Say(fmt.Sprintf("Pausing %s before the next provisioner...", p.PauseBefore)) @@ -185,7 +186,7 @@ func (r *RetriedProvisioner) Prepare(raws ...interface{}) error { return r.Provisioner.Prepare(raws...) } -func (r *RetriedProvisioner) Provision(ctx context.Context, ui Ui, comm Communicator, generatedData map[string]interface{}) error { +func (r *RetriedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm Communicator, generatedData map[string]interface{}) error { if ctx.Err() != nil { // context was cancelled return ctx.Err() } @@ -230,7 +231,7 @@ func (p *DebuggedProvisioner) Prepare(raws ...interface{}) error { return p.Provisioner.Prepare(raws...) } -func (p *DebuggedProvisioner) Provision(ctx context.Context, ui Ui, comm Communicator, generatedData map[string]interface{}) error { +func (p *DebuggedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm Communicator, generatedData map[string]interface{}) error { // Use a select to determine if we get cancelled during the wait message := "Pausing before the next provisioner . Press enter to continue." diff --git a/packer/provisioner_mock.go b/packer/provisioner_mock.go index 9b17228e3..1353c0d49 100644 --- a/packer/provisioner_mock.go +++ b/packer/provisioner_mock.go @@ -4,6 +4,7 @@ import ( "context" "github.com/hashicorp/hcl/v2/hcldec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // MockProvisioner is an implementation of Provisioner that can be @@ -16,7 +17,7 @@ type MockProvisioner struct { ProvCalled bool ProvRetried bool ProvCommunicator Communicator - ProvUi Ui + ProvUi packersdk.Ui } func (tp *MockProvisioner) ConfigSpec() hcldec.ObjectSpec { return tp.FlatMapstructure().HCL2Spec() } @@ -29,7 +30,7 @@ func (t *MockProvisioner) Prepare(configs ...interface{}) error { return nil } -func (t *MockProvisioner) Provision(ctx context.Context, ui Ui, comm Communicator, generatedData map[string]interface{}) error { +func (t *MockProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm Communicator, generatedData map[string]interface{}) error { if t.ProvCalled { t.ProvRetried = true return nil diff --git a/packer/provisioner_timeout.go b/packer/provisioner_timeout.go index a3104815c..14050a52d 100644 --- a/packer/provisioner_timeout.go +++ b/packer/provisioner_timeout.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "time" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // TimeoutProvisioner is a Provisioner implementation that can timeout after a @@ -13,7 +15,7 @@ type TimeoutProvisioner struct { Timeout time.Duration } -func (p *TimeoutProvisioner) Provision(ctx context.Context, ui Ui, comm Communicator, generatedData map[string]interface{}) error { +func (p *TimeoutProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm Communicator, generatedData map[string]interface{}) error { ctx, cancel := context.WithTimeout(ctx, p.Timeout) defer cancel() diff --git a/packer/rpc/build.go b/packer/rpc/build.go index 02ac0f86d..58fa0e3d7 100644 --- a/packer/rpc/build.go +++ b/packer/rpc/build.go @@ -5,6 +5,7 @@ import ( "log" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // An implementation of packer.Build where the build is actually executed @@ -46,7 +47,7 @@ func (b *build) Prepare() ([]string, error) { return resp.Warnings, err } -func (b *build) Run(ctx context.Context, ui packer.Ui) ([]packer.Artifact, error) { +func (b *build) Run(ctx context.Context, ui packersdk.Ui) ([]packer.Artifact, error) { nextId := b.mux.NextId() server := newServerWithMux(b.mux, nextId) server.RegisterUi(ui) diff --git a/packer/rpc/build_test.go b/packer/rpc/build_test.go index 9656c6227..ea4d4b22d 100644 --- a/packer/rpc/build_test.go +++ b/packer/rpc/build_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var testBuildArtifact = &packer.MockArtifact{} @@ -17,7 +18,7 @@ type testBuild struct { prepareWarnings []string runFn func(context.Context) runCalled bool - runUi packer.Ui + runUi packersdk.Ui setDebugCalled bool setForceCalled bool setOnErrorCalled bool @@ -35,7 +36,7 @@ func (b *testBuild) Prepare() ([]string, error) { return b.prepareWarnings, nil } -func (b *testBuild) Run(ctx context.Context, ui packer.Ui) ([]packer.Artifact, error) { +func (b *testBuild) Run(ctx context.Context, ui packersdk.Ui) ([]packer.Artifact, error) { b.runCalled = true b.runUi = ui diff --git a/packer/rpc/builder.go b/packer/rpc/builder.go index ae8b80a5c..4e321dee0 100644 --- a/packer/rpc/builder.go +++ b/packer/rpc/builder.go @@ -5,6 +5,7 @@ import ( "log" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // An implementation of packer.Builder where the builder is actually executed @@ -51,7 +52,7 @@ func (b *builder) Prepare(config ...interface{}) ([]string, []string, error) { return resp.GeneratedVars, resp.Warnings, err } -func (b *builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { +func (b *builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) { nextId := b.mux.NextId() server := newServerWithMux(b.mux, nextId) server.RegisterHook(hook) diff --git a/packer/rpc/client.go b/packer/rpc/client.go index a23437a72..ea2919c4b 100644 --- a/packer/rpc/client.go +++ b/packer/rpc/client.go @@ -6,6 +6,7 @@ import ( "net/rpc" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ugorji/go/codec" ) @@ -138,7 +139,7 @@ func (c *Client) Provisioner() packer.Provisioner { } } -func (c *Client) Ui() packer.Ui { +func (c *Client) Ui() packersdk.Ui { return &Ui{ commonClient: commonClient{ endpoint: DefaultUiEndpoint, diff --git a/packer/rpc/hook.go b/packer/rpc/hook.go index 12334b1d3..55de54a91 100644 --- a/packer/rpc/hook.go +++ b/packer/rpc/hook.go @@ -6,6 +6,7 @@ import ( "sync" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // An implementation of packer.Hook where the hook is actually executed @@ -31,7 +32,7 @@ type HookRunArgs struct { StreamId uint32 } -func (h *hook) Run(ctx context.Context, name string, ui packer.Ui, comm packer.Communicator, data interface{}) error { +func (h *hook) Run(ctx context.Context, name string, ui packersdk.Ui, comm packer.Communicator, data interface{}) error { nextId := h.mux.NextId() server := newServerWithMux(h.mux, nextId) server.RegisterCommunicator(comm) diff --git a/packer/rpc/post_processor.go b/packer/rpc/post_processor.go index 00d492a0a..9a5037796 100644 --- a/packer/rpc/post_processor.go +++ b/packer/rpc/post_processor.go @@ -5,6 +5,7 @@ import ( "log" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // An implementation of packer.PostProcessor where the PostProcessor is actually @@ -43,7 +44,7 @@ func (p *postProcessor) Configure(raw ...interface{}) error { return p.client.Call(p.endpoint+".Configure", args, new(interface{})) } -func (p *postProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *postProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { nextId := p.mux.NextId() server := newServerWithMux(p.mux, nextId) server.RegisterArtifact(a) diff --git a/packer/rpc/post_processor_test.go b/packer/rpc/post_processor_test.go index e6f7235a1..d4b5a01f2 100644 --- a/packer/rpc/post_processor_test.go +++ b/packer/rpc/post_processor_test.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var testPostProcessorArtifact = new(packer.MockArtifact) @@ -17,7 +18,7 @@ type TestPostProcessor struct { ppCalled bool ppArtifact packer.Artifact ppArtifactId string - ppUi packer.Ui + ppUi packersdk.Ui postProcessFn func(context.Context) error } @@ -30,7 +31,7 @@ func (pp *TestPostProcessor) Configure(v ...interface{}) error { return nil } -func (pp *TestPostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { +func (pp *TestPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { pp.ppCalled = true pp.ppArtifact = a pp.ppArtifactId = a.Id() diff --git a/packer/rpc/provisioner.go b/packer/rpc/provisioner.go index 2d826e0a8..f1de8e0fc 100644 --- a/packer/rpc/provisioner.go +++ b/packer/rpc/provisioner.go @@ -5,6 +5,7 @@ import ( "log" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // An implementation of packer.Provisioner where the provisioner is actually @@ -41,7 +42,7 @@ type ProvisionerProvisionArgs struct { StreamID uint32 } -func (p *provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { nextId := p.mux.NextId() server := newServerWithMux(p.mux, nextId) server.RegisterCommunicator(comm) diff --git a/packer/rpc/server.go b/packer/rpc/server.go index acfea8c7c..5dea62ce6 100644 --- a/packer/rpc/server.go +++ b/packer/rpc/server.go @@ -6,6 +6,7 @@ import ( "net/rpc" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/ugorji/go/codec" ) @@ -122,7 +123,7 @@ func (s *Server) RegisterProvisioner(p packer.Provisioner) error { }) } -func (s *Server) RegisterUi(ui packer.Ui) error { +func (s *Server) RegisterUi(ui packersdk.Ui) error { return s.server.RegisterName(DefaultUiEndpoint, &UiServer{ ui: ui, register: s.server.RegisterName, diff --git a/packer/rpc/ui.go b/packer/rpc/ui.go index adcee28b5..6fd9de2ee 100644 --- a/packer/rpc/ui.go +++ b/packer/rpc/ui.go @@ -3,22 +3,22 @@ package rpc import ( "log" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// An implementation of packer.Ui where the Ui is actually executed +// An implementation of packersdk.Ui where the Ui is actually executed // over an RPC connection. type Ui struct { commonClient endpoint string } -var _ packer.Ui = new(Ui) +var _ packersdk.Ui = new(Ui) -// UiServer wraps a packer.Ui implementation and makes it exportable +// UiServer wraps a packersdk.Ui implementation and makes it exportable // as part of a Golang RPC server. type UiServer struct { - ui packer.Ui + ui packersdk.Ui register func(name string, rcvr interface{}) error } diff --git a/packer/run_interfaces.go b/packer/run_interfaces.go index 7e428fbe7..dc869932c 100644 --- a/packer/run_interfaces.go +++ b/packer/run_interfaces.go @@ -1,6 +1,9 @@ package packer -import "github.com/hashicorp/hcl/v2" +import ( + "github.com/hashicorp/hcl/v2" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" +) type GetBuildsOptions struct { // Get builds except the ones that match with except and with only the ones @@ -56,7 +59,7 @@ type ConfigFixer interface { } type InspectConfigOptions struct { - Ui + packersdk.Ui } type ConfigInspector interface { diff --git a/packer/testing.go b/packer/testing.go index 4df1b5de7..bf5e81a82 100644 --- a/packer/testing.go +++ b/packer/testing.go @@ -4,6 +4,8 @@ import ( "bytes" "io/ioutil" "testing" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestCoreConfig(t *testing.T) *CoreConfig { @@ -29,7 +31,7 @@ func TestCore(t *testing.T, c *CoreConfig) *Core { return core } -func TestUi(t *testing.T) Ui { +func TestUi(t *testing.T) packersdk.Ui { var buf bytes.Buffer return &BasicUi{ Reader: &buf, diff --git a/packer/ui.go b/packer/ui.go index 46bfbf235..820992d57 100644 --- a/packer/ui.go +++ b/packer/ui.go @@ -16,6 +16,7 @@ import ( "unicode" getter "github.com/hashicorp/go-getter/v2" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) var ErrInterrupted = errors.New("interrupted") @@ -31,24 +32,11 @@ const ( UiColorCyan = 36 ) -// The Ui interface handles all communication for Packer with the outside -// world. This sort of control allows us to strictly control how output -// is formatted and various levels of output. -type Ui interface { - Ask(string) (string, error) - Say(string) - Message(string) - Error(string) - Machine(string, ...string) - // TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser) - getter.ProgressTracker -} - type NoopUi struct { PB NoopProgressTracker } -var _ Ui = new(NoopUi) +var _ packersdk.Ui = new(NoopUi) func (*NoopUi) Ask(string) (string, error) { return "", errors.New("this is a noop ui") } func (*NoopUi) Say(string) { return } @@ -63,11 +51,11 @@ func (u *NoopUi) TrackProgress(src string, currentSize, totalSize int64, stream type ColoredUi struct { Color UiColor ErrorColor UiColor - Ui Ui + Ui packersdk.Ui PB getter.ProgressTracker } -var _ Ui = new(ColoredUi) +var _ packersdk.Ui = new(ColoredUi) func (u *ColoredUi) Ask(query string) (string, error) { return u.Ui.Ask(u.colorize(query, u.Color, true)) @@ -138,10 +126,10 @@ func (u *ColoredUi) supportsColors() bool { // with Say output. Machine-readable output has the proper target set. type TargetedUI struct { Target string - Ui Ui + Ui packersdk.Ui } -var _ Ui = new(TargetedUI) +var _ packersdk.Ui = new(TargetedUI) func (u *TargetedUI) Ask(query string) (string, error) { return u.Ui.Ask(u.prefixLines(true, query)) @@ -196,7 +184,7 @@ type BasicUi struct { PB getter.ProgressTracker } -var _ Ui = new(BasicUi) +var _ packersdk.Ui = new(BasicUi) func (rw *BasicUi) Ask(query string) (string, error) { rw.l.Lock() @@ -319,7 +307,7 @@ type MachineReadableUi struct { PB NoopProgressTracker } -var _ Ui = new(MachineReadableUi) +var _ packersdk.Ui = new(MachineReadableUi) func (u *MachineReadableUi) Ask(query string) (string, error) { return "", errors.New("machine-readable UI can't ask") @@ -381,11 +369,11 @@ func (u *MachineReadableUi) TrackProgress(src string, currentSize, totalSize int // TimestampedUi is a UI that wraps another UI implementation and // prefixes each message with an RFC3339 timestamp type TimestampedUi struct { - Ui Ui + Ui packersdk.Ui PB getter.ProgressTracker } -var _ Ui = new(TimestampedUi) +var _ packersdk.Ui = new(TimestampedUi) func (u *TimestampedUi) Ask(query string) (string, error) { return u.Ui.Ask(query) @@ -419,11 +407,11 @@ func (u *TimestampedUi) timestampLine(string string) string { // provides concurrency-safe access type SafeUi struct { Sem chan int - Ui Ui + Ui packersdk.Ui PB getter.ProgressTracker } -var _ Ui = new(SafeUi) +var _ packersdk.Ui = new(SafeUi) func (u *SafeUi) Ask(s string) (string, error) { u.Sem <- 1 diff --git a/post-processor/alicloud-import/post-processor.go b/post-processor/alicloud-import/post-processor.go index f965ad77b..c838191b3 100644 --- a/post-processor/alicloud-import/post-processor.go +++ b/post-processor/alicloud-import/post-processor.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" packerecs "github.com/hashicorp/packer/builder/alicloud/ecs" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -164,7 +165,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { var err error generatedData := artifact.State("generated_data") diff --git a/post-processor/amazon-import/post-processor.go b/post-processor/amazon-import/post-processor.go index df4062c6a..5d866fab4 100644 --- a/post-processor/amazon-import/post-processor.go +++ b/post-processor/amazon-import/post-processor.go @@ -18,6 +18,7 @@ import ( awscommon "github.com/hashicorp/packer/builder/amazon/common" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -130,7 +131,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { var err error generatedData := artifact.State("generated_data") diff --git a/post-processor/artifice/post-processor.go b/post-processor/artifice/post-processor.go index 104d144fe..ee4d7737d 100644 --- a/post-processor/artifice/post-processor.go +++ b/post-processor/artifice/post-processor.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -55,7 +56,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { if len(artifact.Files()) > 0 { ui.Say(fmt.Sprintf("Discarding files from artifact: %s", strings.Join(artifact.Files(), ", "))) } diff --git a/post-processor/checksum/post-processor.go b/post-processor/checksum/post-processor.go index 5d0a9c2b5..df0fea928 100644 --- a/post-processor/checksum/post-processor.go +++ b/post-processor/checksum/post-processor.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -95,7 +96,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { files := artifact.Files() var h hash.Hash diff --git a/post-processor/checksum/post-processor_test.go b/post-processor/checksum/post-processor_test.go index ce527ab23..2c41b5ac9 100644 --- a/post-processor/checksum/post-processor_test.go +++ b/post-processor/checksum/post-processor_test.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/builder/file" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template" ) @@ -44,7 +45,7 @@ func TestChecksumSHA1(t *testing.T) { // Test Helpers -func setup(t *testing.T) (packer.Ui, packer.Artifact, error) { +func setup(t *testing.T) (packersdk.Ui, packer.Artifact, error) { // Create fake UI and Cache ui := packer.TestUi(t) diff --git a/post-processor/compress/post-processor.go b/post-processor/compress/post-processor.go index 0864a5dff..a0ffa700b 100644 --- a/post-processor/compress/post-processor.go +++ b/post-processor/compress/post-processor.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/klauspost/pgzip" @@ -107,7 +108,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { func (p *PostProcessor) PostProcess( ctx context.Context, - ui packer.Ui, + ui packersdk.Ui, artifact packer.Artifact, ) (packer.Artifact, bool, bool, error) { var generatedData map[interface{}]interface{} diff --git a/post-processor/compress/post-processor_test.go b/post-processor/compress/post-processor_test.go index 1e1a7b8a4..15fa64f11 100644 --- a/post-processor/compress/post-processor_test.go +++ b/post-processor/compress/post-processor_test.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/builder/file" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template" ) @@ -184,7 +185,7 @@ func TestCompressInterpolation(t *testing.T) { // Test Helpers -func setup(t *testing.T) (packer.Ui, packer.Artifact, error) { +func setup(t *testing.T) (packersdk.Ui, packer.Artifact, error) { // Create fake UI and Cache ui := packer.TestUi(t) diff --git a/post-processor/digitalocean-import/post-processor.go b/post-processor/digitalocean-import/post-processor.go index fe652ecf1..9f7898829 100644 --- a/post-processor/digitalocean-import/post-processor.go +++ b/post-processor/digitalocean-import/post-processor.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/packer/builder/digitalocean" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -148,7 +149,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { var err error generatedData := artifact.State("generated_data") diff --git a/post-processor/docker-import/post-processor.go b/post-processor/docker-import/post-processor.go index 7cde7c926..cfce7a6a8 100644 --- a/post-processor/docker-import/post-processor.go +++ b/post-processor/docker-import/post-processor.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/builder/docker" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/post-processor/artifice" @@ -50,7 +51,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { switch artifact.BuilderId() { case docker.BuilderId, artifice.BuilderId: break diff --git a/post-processor/docker-push/post-processor.go b/post-processor/docker-push/post-processor.go index facce79b5..723320752 100644 --- a/post-processor/docker-push/post-processor.go +++ b/post-processor/docker-push/post-processor.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/builder/docker" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" dockerimport "github.com/hashicorp/packer/post-processor/docker-import" @@ -58,7 +59,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { if artifact.BuilderId() != dockerimport.BuilderId && artifact.BuilderId() != dockertag.BuilderId { err := fmt.Errorf( diff --git a/post-processor/docker-save/post-processor.go b/post-processor/docker-save/post-processor.go index bfa44d065..a15c7221e 100644 --- a/post-processor/docker-save/post-processor.go +++ b/post-processor/docker-save/post-processor.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/packer/builder/docker" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" dockerimport "github.com/hashicorp/packer/post-processor/docker-import" @@ -52,7 +53,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { if artifact.BuilderId() != dockerimport.BuilderId && artifact.BuilderId() != dockertag.BuilderId { err := fmt.Errorf( diff --git a/post-processor/docker-tag/post-processor.go b/post-processor/docker-tag/post-processor.go index 254e63859..21c8de182 100644 --- a/post-processor/docker-tag/post-processor.go +++ b/post-processor/docker-tag/post-processor.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/packer/builder/docker" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" dockerimport "github.com/hashicorp/packer/post-processor/docker-import" @@ -60,7 +61,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { if len(p.config.Tag) > 0 { ui.Say("Deprecation warning: \"tag\" option has been replaced with " + "\"tags\". In future versions of Packer, this configuration may " + diff --git a/post-processor/exoscale-import/post-processor.go b/post-processor/exoscale-import/post-processor.go index 685ef903f..12ff896d4 100644 --- a/post-processor/exoscale-import/post-processor.go +++ b/post-processor/exoscale-import/post-processor.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/packer/builder/qemu" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/post-processor/artifice" "github.com/hashicorp/packer/post-processor/exoscale-import/version" @@ -105,7 +106,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) { switch a.BuilderId() { case qemu.BuilderId, file.BuilderId, artifice.BuilderId: break @@ -139,7 +140,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, a packer. return &Artifact{id}, false, false, nil } -func (p *PostProcessor) uploadImage(ctx context.Context, ui packer.Ui, a packer.Artifact) (string, string, error) { +func (p *PostProcessor) uploadImage(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (string, string, error) { var ( imageFile = a.Files()[0] bucketFile = filepath.Base(imageFile) @@ -188,7 +189,7 @@ func (p *PostProcessor) uploadImage(ctx context.Context, ui packer.Ui, a packer. return output.Location, fmt.Sprintf("%x", hash.Sum(nil)), nil } -func (p *PostProcessor) deleteImage(ctx context.Context, ui packer.Ui, a packer.Artifact) error { +func (p *PostProcessor) deleteImage(ctx context.Context, ui packersdk.Ui, a packer.Artifact) error { var ( imageFile = a.Files()[0] bucketFile = filepath.Base(imageFile) @@ -210,7 +211,7 @@ func (p *PostProcessor) deleteImage(ctx context.Context, ui packer.Ui, a packer. return nil } -func (p *PostProcessor) registerTemplate(ctx context.Context, ui packer.Ui, url, md5sum string) (string, error) { +func (p *PostProcessor) registerTemplate(ctx context.Context, ui packersdk.Ui, url, md5sum string) (string, error) { var ( passwordEnabled = !p.config.TemplateDisablePassword sshkeyEnabled = !p.config.TemplateDisableSSHKey diff --git a/post-processor/googlecompute-export/post-processor.go b/post-processor/googlecompute-export/post-processor.go index f3bcc684a..1100f2c89 100644 --- a/post-processor/googlecompute-export/post-processor.go +++ b/post-processor/googlecompute-export/post-processor.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/post-processor/artifice" @@ -118,7 +119,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { switch artifact.BuilderId() { case googlecompute.BuilderId, artifice.BuilderId: break diff --git a/post-processor/googlecompute-import/post-processor.go b/post-processor/googlecompute-import/post-processor.go index 8605a6629..fedacfd85 100644 --- a/post-processor/googlecompute-import/post-processor.go +++ b/post-processor/googlecompute-import/post-processor.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/packer/builder/googlecompute" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/post-processor/artifice" @@ -143,7 +144,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { generatedData := artifact.State("generated_data") if generatedData == nil { // Make sure it's not a nil map so we can assign to it later. @@ -259,7 +260,7 @@ func CreateShieldedVMStateConfig(imageGuestOsFeatures []string, imagePlatformKey return shieldedVMStateConfig, nil } -func UploadToBucket(opts option.ClientOption, ui packer.Ui, artifact packer.Artifact, bucket string, gcsObjectName string) (string, error) { +func UploadToBucket(opts option.ClientOption, ui packersdk.Ui, artifact packer.Artifact, bucket string, gcsObjectName string) (string, error) { service, err := storage.NewService(context.TODO(), opts) if err != nil { return "", err @@ -295,7 +296,7 @@ func UploadToBucket(opts option.ClientOption, ui packer.Ui, artifact packer.Arti return storageObject.SelfLink, nil } -func CreateGceImage(opts option.ClientOption, ui packer.Ui, project string, rawImageURL string, imageName string, imageDescription string, imageFamily string, imageLabels map[string]string, imageGuestOsFeatures []string, shieldedVMStateConfig *compute.InitialStateConfig) (packer.Artifact, error) { +func CreateGceImage(opts option.ClientOption, ui packersdk.Ui, project string, rawImageURL string, imageName string, imageDescription string, imageFamily string, imageLabels map[string]string, imageGuestOsFeatures []string, shieldedVMStateConfig *compute.InitialStateConfig) (packer.Artifact, error) { service, err := compute.NewService(context.TODO(), opts) if err != nil { @@ -351,7 +352,7 @@ func CreateGceImage(opts option.ClientOption, ui packer.Ui, project string, rawI return &Artifact{paths: []string{op.TargetLink}}, nil } -func DeleteFromBucket(opts option.ClientOption, ui packer.Ui, bucket string, gcsObjectName string) error { +func DeleteFromBucket(opts option.ClientOption, ui packersdk.Ui, bucket string, gcsObjectName string) error { service, err := storage.NewService(context.TODO(), opts) if err != nil { diff --git a/post-processor/manifest/post-processor.go b/post-processor/manifest/post-processor.go index 26e9ac191..ce6308294 100644 --- a/post-processor/manifest/post-processor.go +++ b/post-processor/manifest/post-processor.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -73,7 +74,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, source packer.Artifact) (packer.Artifact, bool, bool, error) { generatedData := source.State("generated_data") if generatedData == nil { // Make sure it's not a nil map so we can assign to it later. diff --git a/post-processor/shell-local/post-processor.go b/post-processor/shell-local/post-processor.go index b7ce71673..574e97a7d 100644 --- a/post-processor/shell-local/post-processor.go +++ b/post-processor/shell-local/post-processor.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" sl "github.com/hashicorp/packer/packer-plugin-sdk/shell-local" ) @@ -40,7 +41,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return sl.Validate(&p.config) } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { generatedData := make(map[string]interface{}) artifactStateData := artifact.State("generated_data") if artifactStateData != nil { diff --git a/post-processor/ucloud-import/post-processor.go b/post-processor/ucloud-import/post-processor.go index 1296f326d..ccb9a8897 100644 --- a/post-processor/ucloud-import/post-processor.go +++ b/post-processor/ucloud-import/post-processor.go @@ -15,6 +15,7 @@ import ( ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -154,7 +155,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { var err error generatedData := artifact.State("generated_data") diff --git a/post-processor/vagrant-cloud/post-processor.go b/post-processor/vagrant-cloud/post-processor.go index 602393620..2271a2211 100644 --- a/post-processor/vagrant-cloud/post-processor.go +++ b/post-processor/vagrant-cloud/post-processor.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -129,7 +130,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { if _, ok := builtins[artifact.BuilderId()]; !ok { return nil, false, false, fmt.Errorf( "Unknown artifact type: this post-processor requires an input artifact from the artifice post-processor, vagrant post-processor, or vagrant builder: %s", artifact.BuilderId()) diff --git a/post-processor/vagrant-cloud/step_confirm_upload.go b/post-processor/vagrant-cloud/step_confirm_upload.go index e338fcf8f..a5463cc0a 100644 --- a/post-processor/vagrant-cloud/step_confirm_upload.go +++ b/post-processor/vagrant-cloud/step_confirm_upload.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepConfirmUpload struct { @@ -13,7 +13,7 @@ type stepConfirmUpload struct { func (s *stepConfirmUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) upload := state.Get("upload").(*Upload) url := upload.CallbackPath diff --git a/post-processor/vagrant-cloud/step_create_provider.go b/post-processor/vagrant-cloud/step_create_provider.go index a6cfaa02f..add13f5c0 100644 --- a/post-processor/vagrant-cloud/step_create_provider.go +++ b/post-processor/vagrant-cloud/step_create_provider.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Provider struct { @@ -21,7 +21,7 @@ type stepCreateProvider struct { func (s *stepCreateProvider) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) box := state.Get("box").(*Box) version := state.Get("version").(*Version) providerName := state.Get("providerName").(string) @@ -68,7 +68,7 @@ func (s *stepCreateProvider) Run(ctx context.Context, state multistep.StateBag) func (s *stepCreateProvider) Cleanup(state multistep.StateBag) { client := state.Get("client").(*VagrantCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) box := state.Get("box").(*Box) version := state.Get("version").(*Version) diff --git a/post-processor/vagrant-cloud/step_create_version.go b/post-processor/vagrant-cloud/step_create_version.go index 75bd3f0a4..9333dd9e2 100644 --- a/post-processor/vagrant-cloud/step_create_version.go +++ b/post-processor/vagrant-cloud/step_create_version.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Version struct { @@ -18,7 +18,7 @@ type stepCreateVersion struct { func (s *stepCreateVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) box := state.Get("box").(*Box) diff --git a/post-processor/vagrant-cloud/step_prepare_upload.go b/post-processor/vagrant-cloud/step_prepare_upload.go index 463b5afbc..85b4a9b5a 100644 --- a/post-processor/vagrant-cloud/step_prepare_upload.go +++ b/post-processor/vagrant-cloud/step_prepare_upload.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Upload struct { @@ -19,7 +19,7 @@ type stepPrepareUpload struct { func (s *stepPrepareUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) box := state.Get("box").(*Box) version := state.Get("version").(*Version) provider := state.Get("provider").(*Provider) diff --git a/post-processor/vagrant-cloud/step_release_version.go b/post-processor/vagrant-cloud/step_release_version.go index d8e41a05a..d66a9e38e 100644 --- a/post-processor/vagrant-cloud/step_release_version.go +++ b/post-processor/vagrant-cloud/step_release_version.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type stepReleaseVersion struct { @@ -14,7 +14,7 @@ type stepReleaseVersion struct { func (s *stepReleaseVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) box := state.Get("box").(*Box) version := state.Get("version").(*Version) config := state.Get("config").(*Config) diff --git a/post-processor/vagrant-cloud/step_upload.go b/post-processor/vagrant-cloud/step_upload.go index 669011520..18c90b6ca 100644 --- a/post-processor/vagrant-cloud/step_upload.go +++ b/post-processor/vagrant-cloud/step_upload.go @@ -7,8 +7,8 @@ import ( "net/http" "time" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" ) @@ -18,7 +18,7 @@ type stepUpload struct { func (s *stepUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) config := state.Get("config").(*Config) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) upload := state.Get("upload").(*Upload) artifactFilePath := state.Get("artifactFilePath").(string) url := upload.UploadPath diff --git a/post-processor/vagrant-cloud/step_verify_box.go b/post-processor/vagrant-cloud/step_verify_box.go index 4cf25a62e..6ad02132a 100644 --- a/post-processor/vagrant-cloud/step_verify_box.go +++ b/post-processor/vagrant-cloud/step_verify_box.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type Box struct { @@ -27,7 +27,7 @@ type stepVerifyBox struct { func (s *stepVerifyBox) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { client := state.Get("client").(*VagrantCloudClient) - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) config := state.Get("config").(*Config) ui.Say(fmt.Sprintf("Verifying box is accessible: %s", config.Tag)) diff --git a/post-processor/vagrant/aws.go b/post-processor/vagrant/aws.go index be23f038d..dac7ecc06 100644 --- a/post-processor/vagrant/aws.go +++ b/post-processor/vagrant/aws.go @@ -7,6 +7,7 @@ import ( "text/template" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type AWSProvider struct{} @@ -15,7 +16,7 @@ func (p *AWSProvider) KeepInputArtifact() bool { return true } -func (p *AWSProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *AWSProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "aws"} diff --git a/post-processor/vagrant/azure.go b/post-processor/vagrant/azure.go index 031e70259..55bb016a7 100644 --- a/post-processor/vagrant/azure.go +++ b/post-processor/vagrant/azure.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type AzureProvider struct{} @@ -13,7 +14,7 @@ func (p *AzureProvider) KeepInputArtifact() bool { return true } -func (p *AzureProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *AzureProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "azure"} diff --git a/post-processor/vagrant/digitalocean.go b/post-processor/vagrant/digitalocean.go index 292b00600..28bbd7a63 100644 --- a/post-processor/vagrant/digitalocean.go +++ b/post-processor/vagrant/digitalocean.go @@ -7,6 +7,7 @@ import ( "text/template" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type digitalOceanVagrantfileTemplate struct { @@ -20,7 +21,7 @@ func (p *DigitalOceanProvider) KeepInputArtifact() bool { return true } -func (p *DigitalOceanProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *DigitalOceanProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "digital_ocean"} diff --git a/post-processor/vagrant/docker.go b/post-processor/vagrant/docker.go index 6f5aeb3dc..a4ab0b85c 100644 --- a/post-processor/vagrant/docker.go +++ b/post-processor/vagrant/docker.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type DockerProvider struct{} @@ -12,7 +13,7 @@ func (p *DockerProvider) KeepInputArtifact() bool { return false } -func (p *DockerProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *DockerProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "docker"} diff --git a/post-processor/vagrant/google.go b/post-processor/vagrant/google.go index a4d9dbf48..fb14d55b6 100644 --- a/post-processor/vagrant/google.go +++ b/post-processor/vagrant/google.go @@ -5,6 +5,7 @@ import ( "text/template" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type googleVagrantfileTemplate struct { @@ -17,7 +18,7 @@ func (p *GoogleProvider) KeepInputArtifact() bool { return true } -func (p *GoogleProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *GoogleProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "google"} diff --git a/post-processor/vagrant/hyperv.go b/post-processor/vagrant/hyperv.go index 657304963..9058aa54a 100644 --- a/post-processor/vagrant/hyperv.go +++ b/post-processor/vagrant/hyperv.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type HypervProvider struct{} @@ -15,7 +16,7 @@ func (p *HypervProvider) KeepInputArtifact() bool { return false } -func (p *HypervProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *HypervProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "hyperv"} diff --git a/post-processor/vagrant/libvirt.go b/post-processor/vagrant/libvirt.go index 5f14ba777..085935210 100644 --- a/post-processor/vagrant/libvirt.go +++ b/post-processor/vagrant/libvirt.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Lowercase a ascii letter. @@ -63,7 +64,7 @@ type LibVirtProvider struct{} func (p *LibVirtProvider) KeepInputArtifact() bool { return false } -func (p *LibVirtProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *LibVirtProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { diskName := artifact.State("diskName").(string) // Copy the disk image into the temporary directory (as box.img) diff --git a/post-processor/vagrant/lxc.go b/post-processor/vagrant/lxc.go index 771df9509..d5955df7d 100644 --- a/post-processor/vagrant/lxc.go +++ b/post-processor/vagrant/lxc.go @@ -5,6 +5,7 @@ import ( "path/filepath" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type LXCProvider struct{} @@ -13,7 +14,7 @@ func (p *LXCProvider) KeepInputArtifact() bool { return false } -func (p *LXCProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *LXCProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{ "provider": "lxc", diff --git a/post-processor/vagrant/parallels.go b/post-processor/vagrant/parallels.go index 41f9afa1a..c84bc832b 100644 --- a/post-processor/vagrant/parallels.go +++ b/post-processor/vagrant/parallels.go @@ -6,6 +6,7 @@ import ( "regexp" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // These are the extensions of files and directories that are unnecessary for the function @@ -18,7 +19,7 @@ func (p *ParallelsProvider) KeepInputArtifact() bool { return false } -func (p *ParallelsProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *ParallelsProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "parallels"} diff --git a/post-processor/vagrant/post-processor.go b/post-processor/vagrant/post-processor.go index 06f546523..e82925da5 100644 --- a/post-processor/vagrant/post-processor.go +++ b/post-processor/vagrant/post-processor.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" @@ -104,7 +105,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcessProvider(name string, provider Provider, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, error) { +func (p *PostProcessor) PostProcessProvider(name string, provider Provider, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, error) { config, err := p.specificConfig(name) if err != nil { return nil, false, err @@ -204,7 +205,7 @@ func (p *PostProcessor) PostProcessProvider(name string, provider Provider, ui p return NewArtifact(name, outputPath), provider.KeepInputArtifact(), nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { name := p.config.ProviderOverride if name == "" { n, ok := builtins[artifact.BuilderId()] diff --git a/post-processor/vagrant/provider.go b/post-processor/vagrant/provider.go index e9b76d0c7..28d11bbe1 100644 --- a/post-processor/vagrant/provider.go +++ b/post-processor/vagrant/provider.go @@ -2,6 +2,7 @@ package vagrant import ( "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Provider is the interface that each provider must implement in order @@ -18,5 +19,5 @@ type Provider interface { // The Provider should return the contents for the Vagrantfile, // any metadata (including the provider type in that), and an error // if any. - Process(packer.Ui, packer.Artifact, string) (vagrantfile string, metadata map[string]interface{}, err error) + Process(packersdk.Ui, packer.Artifact, string) (vagrantfile string, metadata map[string]interface{}, err error) } diff --git a/post-processor/vagrant/scaleway.go b/post-processor/vagrant/scaleway.go index ee275cffd..9a6ec7087 100644 --- a/post-processor/vagrant/scaleway.go +++ b/post-processor/vagrant/scaleway.go @@ -7,6 +7,7 @@ import ( "text/template" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type scalewayVagrantfileTemplate struct { @@ -20,7 +21,7 @@ func (p *ScalewayProvider) KeepInputArtifact() bool { return true } -func (p *ScalewayProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *ScalewayProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "scaleway"} diff --git a/post-processor/vagrant/util.go b/post-processor/vagrant/util.go index b58e9ecfe..f1248c86f 100644 --- a/post-processor/vagrant/util.go +++ b/post-processor/vagrant/util.go @@ -11,7 +11,7 @@ import ( "path/filepath" "runtime" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" "github.com/klauspost/pgzip" ) @@ -72,7 +72,7 @@ func LinkFile(dst, src string) error { // DirToBox takes the directory and compresses it into a Vagrant-compatible // box. This function does not perform checks to verify that dir is // actually a proper box. This is an expected precondition. -func DirToBox(dst, dir string, ui packer.Ui, level int) error { +func DirToBox(dst, dir string, ui packersdk.Ui, level int) error { log.Printf("Turning dir into box: %s => %s", dir, dst) // Make the containing directory, if it does not already exist @@ -163,7 +163,7 @@ func DirToBox(dst, dir string, ui packer.Ui, level int) error { // This function is mainly used to check cases such as the host system having // a GNU tar incompatible uname that will cause the actual Vagrant box creation // to fail later -func CreateDummyBox(ui packer.Ui, level int) error { +func CreateDummyBox(ui packersdk.Ui, level int) error { ui.Say("Creating a dummy Vagrant box to ensure the host system can create one correctly") // Create a temporary dir to create dummy Vagrant box from diff --git a/post-processor/vagrant/virtualbox.go b/post-processor/vagrant/virtualbox.go index 3efda5e9f..afcbeb29c 100644 --- a/post-processor/vagrant/virtualbox.go +++ b/post-processor/vagrant/virtualbox.go @@ -12,6 +12,7 @@ import ( "regexp" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type VBoxProvider struct{} @@ -20,7 +21,7 @@ func (p *VBoxProvider) KeepInputArtifact() bool { return false } -func (p *VBoxProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *VBoxProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "virtualbox"} diff --git a/post-processor/vagrant/vmware.go b/post-processor/vagrant/vmware.go index 66d75b1ba..83db1964b 100644 --- a/post-processor/vagrant/vmware.go +++ b/post-processor/vagrant/vmware.go @@ -5,6 +5,7 @@ import ( "path/filepath" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type VMwareProvider struct{} @@ -13,7 +14,7 @@ func (p *VMwareProvider) KeepInputArtifact() bool { return false } -func (p *VMwareProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { +func (p *VMwareProvider) Process(ui packersdk.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) { // Create the metadata metadata = map[string]interface{}{"provider": "vmware_desktop"} diff --git a/post-processor/vsphere-template/post-processor.go b/post-processor/vsphere-template/post-processor.go index 2d3fc18b4..6e2661951 100644 --- a/post-processor/vsphere-template/post-processor.go +++ b/post-processor/vsphere-template/post-processor.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/post-processor/artifice" @@ -103,7 +104,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { if _, ok := builtins[artifact.BuilderId()]; !ok { return nil, false, false, fmt.Errorf("The Packer vSphere Template post-processor "+ "can only take an artifact from the VMware-iso builder, built on "+ diff --git a/post-processor/vsphere-template/step_choose_datacenter.go b/post-processor/vsphere-template/step_choose_datacenter.go index 0dd9f8b55..90ac9a86a 100644 --- a/post-processor/vsphere-template/step_choose_datacenter.go +++ b/post-processor/vsphere-template/step_choose_datacenter.go @@ -3,8 +3,8 @@ package vsphere_template import ( "context" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" ) @@ -14,7 +14,7 @@ type stepChooseDatacenter struct { } func (s *stepChooseDatacenter) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cli := state.Get("client").(*govmomi.Client) finder := find.NewFinder(cli.Client, false) diff --git a/post-processor/vsphere-template/step_create_folder.go b/post-processor/vsphere-template/step_create_folder.go index 8d16506ac..7ab7136e9 100644 --- a/post-processor/vsphere-template/step_create_folder.go +++ b/post-processor/vsphere-template/step_create_folder.go @@ -5,8 +5,8 @@ import ( "fmt" "path" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/vmware/govmomi" "github.com/vmware/govmomi/object" ) @@ -16,7 +16,7 @@ type stepCreateFolder struct { } func (s *stepCreateFolder) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cli := state.Get("client").(*govmomi.Client) dcPath := state.Get("dcPath").(string) diff --git a/post-processor/vsphere-template/step_create_snapshot.go b/post-processor/vsphere-template/step_create_snapshot.go index 6a091e841..302091e82 100644 --- a/post-processor/vsphere-template/step_create_snapshot.go +++ b/post-processor/vsphere-template/step_create_snapshot.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/post-processor/vsphere" "github.com/vmware/govmomi" ) @@ -38,7 +39,7 @@ func NewStepCreateSnapshot(artifact packer.Artifact, p *PostProcessor) *stepCrea } func (s *stepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cli := state.Get("client").(*govmomi.Client) dcPath := state.Get("dcPath").(string) diff --git a/post-processor/vsphere-template/step_mark_as_template.go b/post-processor/vsphere-template/step_mark_as_template.go index e4af31f83..87df4b008 100644 --- a/post-processor/vsphere-template/step_mark_as_template.go +++ b/post-processor/vsphere-template/step_mark_as_template.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/post-processor/vsphere" "github.com/vmware/govmomi" @@ -40,7 +41,7 @@ func NewStepMarkAsTemplate(artifact packer.Artifact, p *PostProcessor) *stepMark } func (s *stepMarkAsTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - ui := state.Get("ui").(packer.Ui) + ui := state.Get("ui").(packersdk.Ui) cli := state.Get("client").(*govmomi.Client) folder := state.Get("folder").(*object.Folder) dcPath := state.Get("dcPath").(string) diff --git a/post-processor/vsphere/post-processor.go b/post-processor/vsphere/post-processor.go index ba3645db5..ae617c66e 100644 --- a/post-processor/vsphere/post-processor.go +++ b/post-processor/vsphere/post-processor.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" shelllocal "github.com/hashicorp/packer/packer-plugin-sdk/shell-local" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -155,7 +156,7 @@ func getEncodedPassword(u *url.URL) (string, bool) { return password, false } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { source := "" for _, path := range artifact.Files() { if strings.HasSuffix(path, ".vmx") || strings.HasSuffix(path, ".ovf") || strings.HasSuffix(path, ".ova") { diff --git a/post-processor/yandex-export/post-processor.go b/post-processor/yandex-export/post-processor.go index e10deed7c..0a0cda0d7 100644 --- a/post-processor/yandex-export/post-processor.go +++ b/post-processor/yandex-export/post-processor.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -127,7 +128,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { switch artifact.BuilderId() { case yandex.BuilderID, artifice.BuilderId: break diff --git a/post-processor/yandex-import/post-processor.go b/post-processor/yandex-import/post-processor.go index 8800e2381..f1c52147b 100644 --- a/post-processor/yandex-import/post-processor.go +++ b/post-processor/yandex-import/post-processor.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/packer/builder/yandex" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/post-processor/artifice" @@ -121,7 +122,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { return nil } -func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { +func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { var imageSrc cloudImageSource var fileSource bool var err error diff --git a/post-processor/yandex-import/storage.go b/post-processor/yandex-import/storage.go index 536515ea4..2f30fa219 100644 --- a/post-processor/yandex-import/storage.go +++ b/post-processor/yandex-import/storage.go @@ -10,7 +10,7 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) const defaultS3Region = "ru-central1" @@ -46,7 +46,7 @@ func newYCStorageClient(storageEndpoint, accessKey, secretKey string) (*s3.S3, e } // Get path-style S3 URL and return presigned URL -func presignUrl(s3conn *s3.S3, ui packer.Ui, fullUrl string) (cloudImageSource, error) { +func presignUrl(s3conn *s3.S3, ui packersdk.Ui, fullUrl string) (cloudImageSource, error) { bucket, key, err := s3URLToBucketKey(fullUrl) if err != nil { return nil, err diff --git a/post-processor/yandex-import/utils.go b/post-processor/yandex-import/utils.go index 00b53a4a3..f6978af34 100644 --- a/post-processor/yandex-import/utils.go +++ b/post-processor/yandex-import/utils.go @@ -10,10 +10,11 @@ import ( "github.com/aws/aws-sdk-go/service/s3" "github.com/hashicorp/packer/builder/yandex" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" ) -func uploadToBucket(s3conn *s3.S3, ui packer.Ui, artifact packer.Artifact, bucket string, objectName string) (cloudImageSource, error) { +func uploadToBucket(s3conn *s3.S3, ui packersdk.Ui, artifact packer.Artifact, bucket string, objectName string) (cloudImageSource, error) { ui.Say("Looking for qcow2 file in list of artifacts...") source := "" for _, path := range artifact.Files() { @@ -66,7 +67,7 @@ func uploadToBucket(s3conn *s3.S3, ui packer.Ui, artifact packer.Artifact, bucke }, nil } -func createYCImage(ctx context.Context, driver yandex.Driver, ui packer.Ui, folderID string, imageSrc cloudImageSource, imageName string, imageDescription string, imageFamily string, imageLabels map[string]string) (*compute.Image, error) { +func createYCImage(ctx context.Context, driver yandex.Driver, ui packersdk.Ui, folderID string, imageSrc cloudImageSource, imageName string, imageDescription string, imageFamily string, imageLabels map[string]string) (*compute.Image, error) { req := &compute.CreateImageRequest{ FolderId: folderID, Name: imageName, @@ -122,7 +123,7 @@ func createYCImage(ctx context.Context, driver yandex.Driver, ui packer.Ui, fold } -func deleteFromBucket(s3conn *s3.S3, ui packer.Ui, imageSrc cloudImageSource) error { +func deleteFromBucket(s3conn *s3.S3, ui packersdk.Ui, imageSrc cloudImageSource) error { var url string // switch on cloudImageSource type: cloud image id or storage URL switch v := imageSrc.(type) { diff --git a/provisioner/ansible-local/provisioner.go b/provisioner/ansible-local/provisioner.go index 96f9cf0be..e98889833 100644 --- a/provisioner/ansible-local/provisioner.go +++ b/provisioner/ansible-local/provisioner.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" @@ -193,7 +194,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say("Provisioning with Ansible...") p.generatedData = generatedData @@ -317,7 +318,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) provisionPlaybookFiles(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) provisionPlaybookFiles(ui packersdk.Ui, comm packer.Communicator) error { var playbookDir string if p.config.PlaybookDir != "" { var err error @@ -338,7 +339,7 @@ func (p *Provisioner) provisionPlaybookFiles(ui packer.Ui, comm packer.Communica return nil } -func (p *Provisioner) provisionPlaybookFile(ui packer.Ui, comm packer.Communicator, playbookFile string) error { +func (p *Provisioner) provisionPlaybookFile(ui packersdk.Ui, comm packer.Communicator, playbookFile string) error { ui.Message(fmt.Sprintf("Uploading playbook file: %s", playbookFile)) remoteDir := filepath.ToSlash(filepath.Join(p.config.StagingDir, filepath.Dir(playbookFile))) @@ -355,7 +356,7 @@ func (p *Provisioner) provisionPlaybookFile(ui packer.Ui, comm packer.Communicat return nil } -func (p *Provisioner) executeGalaxy(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) executeGalaxy(ui packersdk.Ui, comm packer.Communicator) error { ctx := context.TODO() rolesDir := filepath.ToSlash(filepath.Join(p.config.StagingDir, "roles")) galaxyFile := filepath.ToSlash(filepath.Join(p.config.StagingDir, filepath.Base(p.config.GalaxyFile))) @@ -377,7 +378,7 @@ func (p *Provisioner) executeGalaxy(ui packer.Ui, comm packer.Communicator) erro return nil } -func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) executeAnsible(ui packersdk.Ui, comm packer.Communicator) error { inventory := filepath.ToSlash(filepath.Join(p.config.StagingDir, filepath.Base(p.config.InventoryFile))) extraArgs := fmt.Sprintf(" --extra-vars \"packer_build_name=%s packer_builder_type=%s packer_http_addr=%s -o IdentitiesOnly=yes\" ", @@ -410,7 +411,7 @@ func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator) err } func (p *Provisioner) executeAnsiblePlaybook( - ui packer.Ui, comm packer.Communicator, playbookFile, extraArgs, inventory string, + ui packersdk.Ui, comm packer.Communicator, playbookFile, extraArgs, inventory string, ) error { ctx := context.TODO() command := fmt.Sprintf("cd %s && %s %s%s -c local -i %s", @@ -460,7 +461,7 @@ func validateFileConfig(name string, config string, req bool) error { return nil } -func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, src string) error { +func (p *Provisioner) uploadFile(ui packersdk.Ui, comm packer.Communicator, dst, src string) error { f, err := os.Open(src) if err != nil { return fmt.Errorf("Error opening: %s", err) @@ -473,7 +474,7 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, sr return nil } -func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) createDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ctx := context.TODO() cmd := &packer.RemoteCmd{ Command: fmt.Sprintf("mkdir -p '%s'", dir), @@ -490,7 +491,7 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) removeDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ctx := context.TODO() cmd := &packer.RemoteCmd{ Command: fmt.Sprintf("rm -rf '%s'", dir), @@ -507,7 +508,7 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) uploadDir(ui packer.Ui, comm packer.Communicator, dst, src string) error { +func (p *Provisioner) uploadDir(ui packersdk.Ui, comm packer.Communicator, dst, src string) error { if err := p.createDir(ui, comm, dst); err != nil { return err } diff --git a/provisioner/ansible/mock_ansible.go b/provisioner/ansible/mock_ansible.go index f0d1fe69a..db1a57ba6 100644 --- a/provisioner/ansible/mock_ansible.go +++ b/provisioner/ansible/mock_ansible.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type provisionLogicTracker struct { @@ -14,7 +15,7 @@ type provisionLogicTracker struct { happyPath bool } -func (l *provisionLogicTracker) setupAdapter(ui packer.Ui, comm packer.Communicator) (string, error) { +func (l *provisionLogicTracker) setupAdapter(ui packersdk.Ui, comm packer.Communicator) (string, error) { l.setupAdapterCalled = true if l.happyPath { return "fakeKeyString", nil @@ -22,7 +23,7 @@ func (l *provisionLogicTracker) setupAdapter(ui packer.Ui, comm packer.Communica return "", fmt.Errorf("chose sadpath") } -func (l *provisionLogicTracker) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { +func (l *provisionLogicTracker) executeAnsible(ui packersdk.Ui, comm packer.Communicator, privKeyFile string) error { l.executeAnsibleCalled = true if l.happyPath { return fmt.Errorf("Chose sadpath") diff --git a/provisioner/ansible/provisioner.go b/provisioner/ansible/provisioner.go index 63de5f4df..67701f0fe 100644 --- a/provisioner/ansible/provisioner.go +++ b/provisioner/ansible/provisioner.go @@ -34,6 +34,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/adapter" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/tmp" @@ -214,8 +215,8 @@ type Provisioner struct { ansibleMajVersion uint generatedData map[string]interface{} - setupAdapterFunc func(ui packer.Ui, comm packer.Communicator) (string, error) - executeAnsibleFunc func(ui packer.Ui, comm packer.Communicator, privKeyFile string) error + setupAdapterFunc func(ui packersdk.Ui, comm packer.Communicator) (string, error) + executeAnsibleFunc func(ui packersdk.Ui, comm packer.Communicator, privKeyFile string) error } func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapstructure().HCL2Spec() } @@ -361,7 +362,7 @@ func (p *Provisioner) getVersion() error { return nil } -func (p *Provisioner) setupAdapter(ui packer.Ui, comm packer.Communicator) (string, error) { +func (p *Provisioner) setupAdapter(ui packersdk.Ui, comm packer.Communicator) (string, error) { ui.Message("Setting up proxy adapter for Ansible....") k, err := newUserKey(p.config.SSHAuthorizedKeyFile) @@ -502,7 +503,7 @@ func (p *Provisioner) createInventoryFile() error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say("Provisioning with Ansible...") // Interpolate env vars to check for generated values like password and port p.generatedData = generatedData @@ -627,7 +628,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) executeGalaxy(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) executeGalaxy(ui packersdk.Ui, comm packer.Communicator) error { galaxyFile := filepath.ToSlash(p.config.GalaxyFile) // ansible-galaxy install -r requirements.yml @@ -676,7 +677,7 @@ func (p *Provisioner) executeGalaxy(ui packer.Ui, comm packer.Communicator) erro } // Intended to be invoked from p.executeGalaxy depending on the Ansible Galaxy parameters passed to Packer -func (p *Provisioner) invokeGalaxyCommand(args []string, ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) invokeGalaxyCommand(args []string, ui packersdk.Ui, comm packer.Communicator) error { ui.Message(fmt.Sprintf("Executing Ansible Galaxy")) cmd := exec.Command(p.config.GalaxyCommand, args...) @@ -781,7 +782,7 @@ func (p *Provisioner) createCmdArgs(httpAddr, inventory, playbook, privKeyFile s return args, envVars } -func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { +func (p *Provisioner) executeAnsible(ui packersdk.Ui, comm packer.Communicator, privKeyFile string) error { playbook, _ := filepath.Abs(p.config.PlaybookFile) inventory := p.config.InventoryFile httpAddr := p.generatedData["PackerHTTPAddr"].(string) diff --git a/provisioner/azure-dtlartifact/provisioner.go b/provisioner/azure-dtlartifact/provisioner.go index 68e83ed79..612e24b01 100644 --- a/provisioner/azure-dtlartifact/provisioner.go +++ b/provisioner/azure-dtlartifact/provisioner.go @@ -13,6 +13,7 @@ import ( dtlBuilder "github.com/hashicorp/packer/builder/azure/dtl" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" @@ -96,7 +97,7 @@ func (p *Provisioner) Communicator() packer.Communicator { return p.communicator } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { p.communicator = comm diff --git a/provisioner/breakpoint/provisioner.go b/provisioner/breakpoint/provisioner.go index b1fb64611..a31f68e27 100644 --- a/provisioner/breakpoint/provisioner.go +++ b/provisioner/breakpoint/provisioner.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -46,7 +47,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { if p.config.Disable { if p.config.Note != "" { ui.Say(fmt.Sprintf( diff --git a/provisioner/chef-client/provisioner.go b/provisioner/chef-client/provisioner.go index feef39f9e..13e2b2db6 100644 --- a/provisioner/chef-client/provisioner.go +++ b/provisioner/chef-client/provisioner.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/guestexec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" "github.com/hashicorp/packer/packer-plugin-sdk/uuid" @@ -240,7 +241,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { p.generatedData = generatedData p.communicator = comm @@ -348,7 +349,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, remotePath string, localPath string) error { +func (p *Provisioner) uploadFile(ui packersdk.Ui, comm packer.Communicator, remotePath string, localPath string) error { ui.Message(fmt.Sprintf("Uploading %s...", localPath)) f, err := os.Open(localPath) @@ -361,7 +362,7 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, remoteP } func (p *Provisioner) createConfig( - ui packer.Ui, + ui packersdk.Ui, comm packer.Communicator, nodeName string, serverUrl string, @@ -423,7 +424,7 @@ func (p *Provisioner) createConfig( return remotePath, nil } -func (p *Provisioner) createKnifeConfig(ui packer.Ui, comm packer.Communicator, nodeName string, serverUrl string, clientKey string, sslVerifyMode string, trustedCertsDir string) (string, error) { +func (p *Provisioner) createKnifeConfig(ui packersdk.Ui, comm packer.Communicator, nodeName string, serverUrl string, clientKey string, sslVerifyMode string, trustedCertsDir string) (string, error) { ui.Message("Creating configuration file 'knife.rb'") // Read the template @@ -450,7 +451,7 @@ func (p *Provisioner) createKnifeConfig(ui packer.Ui, comm packer.Communicator, return remotePath, nil } -func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string, error) { +func (p *Provisioner) createJson(ui packersdk.Ui, comm packer.Communicator) (string, error) { ui.Message("Creating JSON attribute file") jsonData := make(map[string]interface{}) @@ -479,7 +480,7 @@ func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string return remotePath, nil } -func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) createDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ctx := context.TODO() ui.Message(fmt.Sprintf("Creating directory: %s", dir)) @@ -503,7 +504,7 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) cleanNode(ui packer.Ui, comm packer.Communicator, node string, knifeConfigPath string) error { +func (p *Provisioner) cleanNode(ui packersdk.Ui, comm packer.Communicator, node string, knifeConfigPath string) error { ui.Say("Cleaning up chef node...") args := []string{"node", "delete", node} if err := p.knifeExec(ui, comm, node, knifeConfigPath, args); err != nil { @@ -513,7 +514,7 @@ func (p *Provisioner) cleanNode(ui packer.Ui, comm packer.Communicator, node str return nil } -func (p *Provisioner) cleanClient(ui packer.Ui, comm packer.Communicator, node string, knifeConfigPath string) error { +func (p *Provisioner) cleanClient(ui packersdk.Ui, comm packer.Communicator, node string, knifeConfigPath string) error { ui.Say("Cleaning up chef client...") args := []string{"client", "delete", node} if err := p.knifeExec(ui, comm, node, knifeConfigPath, args); err != nil { @@ -523,7 +524,7 @@ func (p *Provisioner) cleanClient(ui packer.Ui, comm packer.Communicator, node s return nil } -func (p *Provisioner) knifeExec(ui packer.Ui, comm packer.Communicator, node string, knifeConfigPath string, args []string) error { +func (p *Provisioner) knifeExec(ui packersdk.Ui, comm packer.Communicator, node string, knifeConfigPath string, args []string) error { flags := []string{ "-y", "-c", knifeConfigPath, @@ -555,7 +556,7 @@ func (p *Provisioner) knifeExec(ui packer.Ui, comm packer.Communicator, node str return nil } -func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) removeDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ui.Message(fmt.Sprintf("Removing directory: %s", dir)) ctx := context.TODO() @@ -567,7 +568,7 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) executeChef(ui packer.Ui, comm packer.Communicator, config string, json string) error { +func (p *Provisioner) executeChef(ui packersdk.Ui, comm packer.Communicator, config string, json string) error { p.config.ctx.Data = &ExecuteTemplate{ ConfigPath: config, JsonPath: json, @@ -604,7 +605,7 @@ func (p *Provisioner) executeChef(ui packer.Ui, comm packer.Communicator, config return nil } -func (p *Provisioner) installChef(ui packer.Ui, comm packer.Communicator, version string) error { +func (p *Provisioner) installChef(ui packersdk.Ui, comm packer.Communicator, version string) error { ui.Message("Installing Chef...") ctx := context.TODO() diff --git a/provisioner/chef-solo/provisioner.go b/provisioner/chef-solo/provisioner.go index 07bf75432..61b4f3695 100644 --- a/provisioner/chef-solo/provisioner.go +++ b/provisioner/chef-solo/provisioner.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/guestexec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -242,7 +243,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { ui.Say("Provisioning with chef-solo") if !p.config.SkipInstall { @@ -314,7 +315,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, dst string, src string) error { +func (p *Provisioner) uploadDirectory(ui packersdk.Ui, comm packer.Communicator, dst string, src string) error { if err := p.createDir(ui, comm, dst); err != nil { return err } @@ -328,7 +329,7 @@ func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, ds return comm.UploadDir(dst, src, nil) } -func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst string, src string) error { +func (p *Provisioner) uploadFile(ui packersdk.Ui, comm packer.Communicator, dst string, src string) error { f, err := os.Open(src) if err != nil { return err @@ -338,7 +339,7 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst str return comm.Upload(dst, f, nil) } -func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, localCookbooks []string, rolesPath string, dataBagsPath string, encryptedDataBagSecretPath string, environmentsPath string, chefEnvironment string, chefLicense string) (string, error) { +func (p *Provisioner) createConfig(ui packersdk.Ui, comm packer.Communicator, localCookbooks []string, rolesPath string, dataBagsPath string, encryptedDataBagSecretPath string, environmentsPath string, chefEnvironment string, chefLicense string) (string, error) { ui.Message("Creating configuration file 'solo.rb'") cookbook_paths := make([]string, len(p.config.RemoteCookbookPaths)+len(localCookbooks)) @@ -394,7 +395,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, local return remotePath, nil } -func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string, error) { +func (p *Provisioner) createJson(ui packersdk.Ui, comm packer.Communicator) (string, error) { ui.Message("Creating JSON attribute file") jsonData := make(map[string]interface{}) @@ -423,7 +424,7 @@ func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string return remotePath, nil } -func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) createDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ui.Message(fmt.Sprintf("Creating directory: %s", dir)) ctx := context.TODO() @@ -447,7 +448,7 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) executeChef(ui packer.Ui, comm packer.Communicator, config string, json string) error { +func (p *Provisioner) executeChef(ui packersdk.Ui, comm packer.Communicator, config string, json string) error { p.config.ctx.Data = &ExecuteTemplate{ ConfigPath: config, JsonPath: json, @@ -475,7 +476,7 @@ func (p *Provisioner) executeChef(ui packer.Ui, comm packer.Communicator, config return nil } -func (p *Provisioner) installChef(ui packer.Ui, comm packer.Communicator, version string) error { +func (p *Provisioner) installChef(ui packersdk.Ui, comm packer.Communicator, version string) error { ui.Message("Installing Chef...") ctx := context.TODO() diff --git a/provisioner/converge/provisioner.go b/provisioner/converge/provisioner.go index a34323cdf..d179cb1bb 100644 --- a/provisioner/converge/provisioner.go +++ b/provisioner/converge/provisioner.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -111,7 +112,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { } // Provision node somehow. TODO: actual docs -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { ui.Say("Provisioning with Converge") // bootstrapping @@ -132,7 +133,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) maybeBootstrap(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) maybeBootstrap(ui packersdk.Ui, comm packer.Communicator) error { ctx := context.TODO() if !p.config.Bootstrap { return nil @@ -174,7 +175,7 @@ func (p *Provisioner) maybeBootstrap(ui packer.Ui, comm packer.Communicator) err return nil } -func (p *Provisioner) sendModuleDirectories(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) sendModuleDirectories(ui packersdk.Ui, comm packer.Communicator) error { for _, dir := range p.config.ModuleDirs { if err := comm.UploadDir(dir.Destination, dir.Source, dir.Exclude); err != nil { return fmt.Errorf("Could not upload %q: %s", dir.Source, err) @@ -185,7 +186,7 @@ func (p *Provisioner) sendModuleDirectories(ui packer.Ui, comm packer.Communicat return nil } -func (p *Provisioner) applyModules(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) applyModules(ui packersdk.Ui, comm packer.Communicator) error { ctx := context.TODO() // create params JSON file params, err := json.Marshal(p.config.Params) diff --git a/provisioner/file/provisioner.go b/provisioner/file/provisioner.go index abf6e0ad4..60a267291 100644 --- a/provisioner/file/provisioner.go +++ b/provisioner/file/provisioner.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -119,7 +120,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { if generatedData == nil { generatedData = make(map[string]interface{}) } @@ -132,7 +133,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C } } -func (p *Provisioner) ProvisionDownload(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) ProvisionDownload(ui packersdk.Ui, comm packer.Communicator) error { dst, err := interpolate.Render(p.config.Destination, &p.config.ctx) if err != nil { return fmt.Errorf("Error interpolating destination: %s", err) @@ -181,7 +182,7 @@ func (p *Provisioner) ProvisionDownload(ui packer.Ui, comm packer.Communicator) return nil } -func (p *Provisioner) ProvisionUpload(ui packer.Ui, comm packer.Communicator) error { +func (p *Provisioner) ProvisionUpload(ui packersdk.Ui, comm packer.Communicator) error { dst, err := interpolate.Render(p.config.Destination, &p.config.ctx) if err != nil { return fmt.Errorf("Error interpolating destination: %s", err) diff --git a/provisioner/inspec/provisioner.go b/provisioner/inspec/provisioner.go index fdf13cc5a..3bf669088 100644 --- a/provisioner/inspec/provisioner.go +++ b/provisioner/inspec/provisioner.go @@ -31,6 +31,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/adapter" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -190,7 +191,7 @@ func (p *Provisioner) getVersion() error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say("Provisioning with Inspec...") p.config.ctx.Data = generatedData @@ -341,7 +342,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) executeInspec(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { +func (p *Provisioner) executeInspec(ui packersdk.Ui, comm packer.Communicator, privKeyFile string) error { var envvars []string args := []string{p.config.SubCommand, p.config.Profile} diff --git a/provisioner/powershell/provisioner.go b/provisioner/powershell/provisioner.go index 2f44644e1..368a6ec6d 100644 --- a/provisioner/powershell/provisioner.go +++ b/provisioner/powershell/provisioner.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/guestexec" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/shell" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" @@ -257,7 +258,7 @@ func extractScript(p *Provisioner) (string, error) { return temp.Name(), nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say(fmt.Sprintf("Provisioning with Powershell...")) p.communicator = comm p.generatedData = generatedData diff --git a/provisioner/puppet-masterless/provisioner.go b/provisioner/puppet-masterless/provisioner.go index a851aa7e2..c982915b4 100644 --- a/provisioner/puppet-masterless/provisioner.go +++ b/provisioner/puppet-masterless/provisioner.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/guestexec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -257,7 +258,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say("Provisioning with Puppet...") p.communicator = comm p.generatedData = generatedData @@ -366,7 +367,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) uploadHieraConfig(ui packer.Ui, comm packer.Communicator) (string, error) { +func (p *Provisioner) uploadHieraConfig(ui packersdk.Ui, comm packer.Communicator) (string, error) { ui.Message("Uploading hiera configuration...") f, err := os.Open(p.config.HieraConfigPath) if err != nil { @@ -382,7 +383,7 @@ func (p *Provisioner) uploadHieraConfig(ui packer.Ui, comm packer.Communicator) return path, nil } -func (p *Provisioner) uploadManifests(ui packer.Ui, comm packer.Communicator) (string, error) { +func (p *Provisioner) uploadManifests(ui packersdk.Ui, comm packer.Communicator) (string, error) { // Create the remote manifests directory... ui.Message("Uploading manifests...") remoteManifestsPath := fmt.Sprintf("%s/manifests", p.config.StagingDir) @@ -428,7 +429,7 @@ func (p *Provisioner) uploadManifests(ui packer.Ui, comm packer.Communicator) (s return remoteManifestFile, nil } -func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) createDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ui.Message(fmt.Sprintf("Creating directory: %s", dir)) cmd := &packer.RemoteCmd{Command: p.guestCommands.CreateDir(dir)} @@ -454,7 +455,7 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) removeDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ctx := context.TODO() cmd := &packer.RemoteCmd{Command: p.guestCommands.RemoveDir(dir)} @@ -469,7 +470,7 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, dst string, src string) error { +func (p *Provisioner) uploadDirectory(ui packersdk.Ui, comm packer.Communicator, dst string, src string) error { if err := p.createDir(ui, comm, dst); err != nil { return err } diff --git a/provisioner/puppet-server/provisioner.go b/provisioner/puppet-server/provisioner.go index e652e3c5b..923a7e62d 100644 --- a/provisioner/puppet-server/provisioner.go +++ b/provisioner/puppet-server/provisioner.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/guestexec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -227,7 +228,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say("Provisioning with Puppet...") p.communicator = comm p.generatedData = generatedData @@ -319,7 +320,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C return nil } -func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) createDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ui.Message(fmt.Sprintf("Creating directory: %s", dir)) ctx := context.TODO() @@ -343,7 +344,7 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) removeDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ctx := context.TODO() cmd := &packer.RemoteCmd{Command: p.guestCommands.RemoveDir(dir)} @@ -358,7 +359,7 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) uploadDirectory(ui packer.Ui, comm packer.Communicator, dst string, src string) error { +func (p *Provisioner) uploadDirectory(ui packersdk.Ui, comm packer.Communicator, dst string, src string) error { if err := p.createDir(ui, comm, dst); err != nil { return err } diff --git a/provisioner/salt-masterless/provisioner.go b/provisioner/salt-masterless/provisioner.go index fbf67db0e..b1631de4b 100644 --- a/provisioner/salt-masterless/provisioner.go +++ b/provisioner/salt-masterless/provisioner.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/guestexec" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) @@ -239,7 +240,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { var err error var src, dst string var formulas []string @@ -514,7 +515,7 @@ func hasValidFormulaURLs(s []string) bool { return true } -func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, src string) error { +func (p *Provisioner) uploadFile(ui packersdk.Ui, comm packer.Communicator, dst, src string) error { f, err := os.Open(src) if err != nil { return fmt.Errorf("Error opening: %s", err) @@ -535,7 +536,7 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, sr return nil } -func (p *Provisioner) moveFile(ui packer.Ui, comm packer.Communicator, dst string, src string) error { +func (p *Provisioner) moveFile(ui packersdk.Ui, comm packer.Communicator, dst string, src string) error { ctx := context.TODO() ui.Message(fmt.Sprintf("Moving %s to %s", src, dst)) @@ -552,7 +553,7 @@ func (p *Provisioner) moveFile(ui packer.Ui, comm packer.Communicator, dst strin return nil } -func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) createDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ui.Message(fmt.Sprintf("Creating directory: %s", dir)) cmd := &packer.RemoteCmd{ Command: p.guestCommands.CreateDir(dir), @@ -567,7 +568,7 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) statPath(ui packer.Ui, comm packer.Communicator, path string) error { +func (p *Provisioner) statPath(ui packersdk.Ui, comm packer.Communicator, path string) error { ctx := context.TODO() ui.Message(fmt.Sprintf("Verifying Path: %s", path)) cmd := &packer.RemoteCmd{ @@ -582,7 +583,7 @@ func (p *Provisioner) statPath(ui packer.Ui, comm packer.Communicator, path stri return nil } -func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir string) error { +func (p *Provisioner) removeDir(ui packersdk.Ui, comm packer.Communicator, dir string) error { ctx := context.TODO() ui.Message(fmt.Sprintf("Removing directory: %s", dir)) cmd := &packer.RemoteCmd{ @@ -597,7 +598,7 @@ func (p *Provisioner) removeDir(ui packer.Ui, comm packer.Communicator, dir stri return nil } -func (p *Provisioner) uploadDir(ui packer.Ui, comm packer.Communicator, dst, src string, ignore []string) error { +func (p *Provisioner) uploadDir(ui packersdk.Ui, comm packer.Communicator, dst, src string, ignore []string) error { _, temp_dst := filepath.Split(dst) if err := comm.UploadDir(temp_dst, src, ignore); err != nil { return err diff --git a/provisioner/shell-local/provisioner.go b/provisioner/shell-local/provisioner.go index 566e4e344..aecf871cb 100644 --- a/provisioner/shell-local/provisioner.go +++ b/provisioner/shell-local/provisioner.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" sl "github.com/hashicorp/packer/packer-plugin-sdk/shell-local" ) @@ -28,7 +29,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, _ packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, _ packer.Communicator, generatedData map[string]interface{}) error { _, retErr := sl.Run(ctx, ui, &p.config, generatedData) return retErr diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index 4d6cd376f..189eec479 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/shell" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" @@ -177,7 +178,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { if generatedData == nil { generatedData = make(map[string]interface{}) } diff --git a/provisioner/sleep/provisioner.go b/provisioner/sleep/provisioner.go index e530e4761..4e01e808e 100644 --- a/provisioner/sleep/provisioner.go +++ b/provisioner/sleep/provisioner.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -25,7 +26,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return config.Decode(&p, &config.DecodeOpts{}, raws...) } -func (p *Provisioner) Provision(ctx context.Context, _ packer.Ui, _ packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, _ packersdk.Ui, _ packer.Communicator, _ map[string]interface{}) error { select { case <-ctx.Done(): return ctx.Err() diff --git a/provisioner/windows-restart/provisioner.go b/provisioner/windows-restart/provisioner.go index a14603b63..d3c6bdd92 100644 --- a/provisioner/windows-restart/provisioner.go +++ b/provisioner/windows-restart/provisioner.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/common" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" @@ -59,7 +60,7 @@ type Config struct { type Provisioner struct { config Config comm packer.Communicator - ui packer.Ui + ui packersdk.Ui cancel chan struct{} cancelLock sync.Mutex } @@ -100,7 +101,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, _ map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error { p.cancelLock.Lock() p.cancel = make(chan struct{}) p.cancelLock.Unlock() diff --git a/provisioner/windows-shell/provisioner.go b/provisioner/windows-shell/provisioner.go index 25db70ef2..ec0a765cf 100644 --- a/provisioner/windows-shell/provisioner.go +++ b/provisioner/windows-shell/provisioner.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/retry" "github.com/hashicorp/packer/packer-plugin-sdk/shell" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" @@ -159,7 +160,7 @@ func extractScript(p *Provisioner) (string, error) { return temp.Name(), nil } -func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { +func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, generatedData map[string]interface{}) error { ui.Say("Provisioning with windows-shell...") scripts := make([]string, len(p.config.Scripts)) copy(scripts, p.config.Scripts)