move Ui definition into the packer plugin sdk.
This commit is contained in:
parent
47f623a3a5
commit
001886670d
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/config"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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
|
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()
|
client, err := b.config.Client()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,15 +4,15 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func cleanUpMessage(state multistep.StateBag, module string) {
|
func cleanUpMessage(state multistep.StateBag, module string) {
|
||||||
_, cancelled := state.GetOk(multistep.StateCancelled)
|
_, cancelled := state.GetOk(multistep.StateCancelled)
|
||||||
_, halted := state.GetOk(multistep.StateHalted)
|
_, halted := state.GetOk(multistep.StateHalted)
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
if cancelled || halted {
|
if cancelled || halted {
|
||||||
ui.Say(fmt.Sprintf("Deleting %s because of cancellation or error...", module))
|
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 {
|
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 != "" {
|
if prefix != "" {
|
||||||
err = fmt.Errorf("%s: %s", prefix, err)
|
err = fmt.Errorf("%s: %s", prefix, err)
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepAttachKeyPair struct {
|
type stepAttachKeyPair struct {
|
||||||
@ -21,7 +21,7 @@ var attachKeyPairNotRetryErrors = []string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *stepAttachKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
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) {
|
func (s *stepAttachKeyPair) Cleanup(state multistep.StateBag) {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
keyPairName := config.Comm.SSHKeyPairName
|
keyPairName := config.Comm.SSHKeyPairName
|
||||||
if keyPairName == "" {
|
if keyPairName == "" {
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepCheckAlicloudSourceImage struct {
|
type stepCheckAlicloudSourceImage struct {
|
||||||
@ -16,7 +16,7 @@ type stepCheckAlicloudSourceImage struct {
|
|||||||
func (s *stepCheckAlicloudSourceImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepCheckAlicloudSourceImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||||
describeImagesRequest.RegionId = config.AlicloudRegion
|
describeImagesRequest.RegionId = config.AlicloudRegion
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepConfigAlicloudEIP struct {
|
type stepConfigAlicloudEIP struct {
|
||||||
@ -28,7 +28,7 @@ var allocateEipAddressRetryErrors = []string{
|
|||||||
|
|
||||||
func (s *stepConfigAlicloudEIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepConfigAlicloudEIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
|
|
||||||
if s.SSHPrivateIp {
|
if s.SSHPrivateIp {
|
||||||
@ -96,7 +96,7 @@ func (s *stepConfigAlicloudEIP) Cleanup(state multistep.StateBag) {
|
|||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
unassociateEipAddressRequest := ecs.CreateUnassociateEipAddressRequest()
|
unassociateEipAddressRequest := ecs.CreateUnassociateEipAddressRequest()
|
||||||
unassociateEipAddressRequest.AllocationId = s.allocatedId
|
unassociateEipAddressRequest.AllocationId = s.allocatedId
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"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/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepConfigAlicloudKeyPair struct {
|
type stepConfigAlicloudKeyPair struct {
|
||||||
@ -22,7 +22,7 @@ type stepConfigAlicloudKeyPair struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *stepConfigAlicloudKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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 != "" {
|
if s.Comm.SSHPrivateKeyFile != "" {
|
||||||
ui.Say("Using existing SSH private key")
|
ui.Say("Using existing SSH private key")
|
||||||
@ -108,7 +108,7 @@ func (s *stepConfigAlicloudKeyPair) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
// Remove the keypair
|
// Remove the keypair
|
||||||
ui.Say("Deleting temporary keypair...")
|
ui.Say("Deleting temporary keypair...")
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepConfigAlicloudPublicIP struct {
|
type stepConfigAlicloudPublicIP struct {
|
||||||
@ -17,7 +17,7 @@ type stepConfigAlicloudPublicIP struct {
|
|||||||
|
|
||||||
func (s *stepConfigAlicloudPublicIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepConfigAlicloudPublicIP) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
|
|
||||||
if s.SSHPrivateIp {
|
if s.SSHPrivateIp {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/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 {
|
func (s *stepConfigAlicloudSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
networkType := state.Get("networktype").(InstanceNetWork)
|
networkType := state.Get("networktype").(InstanceNetWork)
|
||||||
|
|
||||||
if len(s.SecurityGroupId) != 0 {
|
if len(s.SecurityGroupId) != 0 {
|
||||||
@ -117,7 +117,7 @@ func (s *stepConfigAlicloudSecurityGroup) Cleanup(state multistep.StateBag) {
|
|||||||
cleanUpMessage(state, "security group")
|
cleanUpMessage(state, "security group")
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
||||||
RequestFunc: func() (responses.AcsResponse, error) {
|
RequestFunc: func() (responses.AcsResponse, error) {
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/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 {
|
func (s *stepConfigAlicloudVPC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
if len(s.VpcId) != 0 {
|
if len(s.VpcId) != 0 {
|
||||||
describeVpcsRequest := ecs.CreateDescribeVpcsRequest()
|
describeVpcsRequest := ecs.CreateDescribeVpcsRequest()
|
||||||
@ -118,7 +118,7 @@ func (s *stepConfigAlicloudVPC) Cleanup(state multistep.StateBag) {
|
|||||||
cleanUpMessage(state, "VPC")
|
cleanUpMessage(state, "VPC")
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
||||||
RequestFunc: func() (responses.AcsResponse, error) {
|
RequestFunc: func() (responses.AcsResponse, error) {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/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 {
|
func (s *stepConfigAlicloudVSwitch) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
vpcId := state.Get("vpcid").(string)
|
vpcId := state.Get("vpcid").(string)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ func (s *stepConfigAlicloudVSwitch) Cleanup(state multistep.StateBag) {
|
|||||||
cleanUpMessage(state, "vSwitch")
|
cleanUpMessage(state, "vSwitch")
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
||||||
RequestFunc: func() (responses.AcsResponse, error) {
|
RequestFunc: func() (responses.AcsResponse, error) {
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/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 {
|
func (s *stepCreateAlicloudImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
tempImageName := config.AlicloudImageName
|
tempImageName := config.AlicloudImageName
|
||||||
if config.ImageEncrypted.True() {
|
if config.ImageEncrypted.True() {
|
||||||
@ -95,7 +95,7 @@ func (s *stepCreateAlicloudImage) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
if !cancelled && !halted && encryptedSet {
|
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))
|
ui.Say(fmt.Sprintf("Deleting temporary image %s(%s) and related snapshots after finishing encryption...", s.image.ImageId, s.image.ImageName))
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
"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/sdk/responses"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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"
|
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 {
|
func (s *stepCreateAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Creating instance...")
|
ui.Say("Creating instance...")
|
||||||
createInstanceRequest, err := s.buildCreateInstanceRequest(state)
|
createInstanceRequest, err := s.buildCreateInstanceRequest(state)
|
||||||
@ -91,7 +91,7 @@ func (s *stepCreateAlicloudInstance) Cleanup(state multistep.StateBag) {
|
|||||||
cleanUpMessage(state, "instance")
|
cleanUpMessage(state, "instance")
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
_, err := client.WaitForExpected(&WaitForExpectArgs{
|
||||||
RequestFunc: func() (responses.AcsResponse, error) {
|
RequestFunc: func() (responses.AcsResponse, error) {
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepCreateAlicloudSnapshot struct {
|
type stepCreateAlicloudSnapshot struct {
|
||||||
@ -19,7 +19,7 @@ type stepCreateAlicloudSnapshot struct {
|
|||||||
func (s *stepCreateAlicloudSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepCreateAlicloudSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
|
|
||||||
describeDisksRequest := ecs.CreateDescribeDisksRequest()
|
describeDisksRequest := ecs.CreateDescribeDisksRequest()
|
||||||
@ -77,7 +77,7 @@ func (s *stepCreateAlicloudSnapshot) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
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...")
|
ui.Say("Deleting the snapshot because of cancellation or error...")
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepCreateTags struct {
|
type stepCreateTags struct {
|
||||||
@ -16,7 +16,7 @@ type stepCreateTags struct {
|
|||||||
func (s *stepCreateTags) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepCreateTags) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
imageId := state.Get("alicloudimage").(string)
|
imageId := state.Get("alicloudimage").(string)
|
||||||
snapshotIds := state.Get("alicloudsnapshots").([]string)
|
snapshotIds := state.Get("alicloudsnapshots").([]string)
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepDeleteAlicloudImageSnapshots struct {
|
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 {
|
func (s *stepDeleteAlicloudImageSnapshots) deleteImageAndSnapshots(state multistep.StateBag, imageName string, region string) error {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
describeImagesRequest := ecs.CreateDescribeImagesRequest()
|
||||||
describeImagesRequest.RegionId = region
|
describeImagesRequest.RegionId = region
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepPreValidate struct {
|
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 {
|
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)
|
config := state.Get("config").(*Config)
|
||||||
|
|
||||||
if config.AlicloudSkipValidation {
|
if config.AlicloudSkipValidation {
|
||||||
@ -55,7 +56,7 @@ func (s *stepPreValidate) validateRegions(state multistep.StateBag) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *stepPreValidate) validateDestImageName(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)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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"
|
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)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
srcImageId := state.Get("alicloudimage").(string)
|
srcImageId := state.Get("alicloudimage").(string)
|
||||||
alicloudImages := state.Get("alicloudimages").(map[string]string)
|
alicloudImages := state.Get("alicloudimages").(map[string]string)
|
||||||
@ -83,7 +83,7 @@ func (s *stepRegionCopyAlicloudImage) Cleanup(state multistep.StateBag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
ui.Say(fmt.Sprintf("Stopping copy image because cancellation or error..."))
|
ui.Say(fmt.Sprintf("Stopping copy image because cancellation or error..."))
|
||||||
|
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepRunAlicloudInstance struct {
|
type stepRunAlicloudInstance struct {
|
||||||
@ -15,7 +15,7 @@ type stepRunAlicloudInstance struct {
|
|||||||
|
|
||||||
func (s *stepRunAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepRunAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
|
|
||||||
startInstanceRequest := ecs.CreateStartInstanceRequest()
|
startInstanceRequest := ecs.CreateStartInstanceRequest()
|
||||||
@ -42,7 +42,7 @@ func (s *stepRunAlicloudInstance) Cleanup(state multistep.StateBag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepShareAlicloudImage struct {
|
type stepShareAlicloudImage struct {
|
||||||
@ -41,7 +41,7 @@ func (s *stepShareAlicloudImage) Cleanup(state multistep.StateBag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
alicloudImages := state.Get("alicloudimages").(map[string]string)
|
alicloudImages := state.Get("alicloudimages").(map[string]string)
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepStopAlicloudInstance struct {
|
type stepStopAlicloudInstance struct {
|
||||||
@ -20,7 +20,7 @@ type stepStopAlicloudInstance struct {
|
|||||||
func (s *stepStopAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepStopAlicloudInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*ClientWrapper)
|
client := state.Get("client").(*ClientWrapper)
|
||||||
instance := state.Get("instance").(*ecs.Instance)
|
instance := state.Get("instance").(*ecs.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
if !s.DisableStop {
|
if !s.DisableStop {
|
||||||
ui.Say(fmt.Sprintf("Stopping instance: %s", instance.InstanceId))
|
ui.Say(fmt.Sprintf("Stopping instance: %s", instance.InstanceId))
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
"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/template/interpolate"
|
||||||
@ -345,7 +346,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return generatedData, warns, nil
|
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" {
|
if runtime.GOOS != "linux" {
|
||||||
return nil, errors.New("The amazon-chroot builder only works on Linux environments.")
|
return nil, errors.New("The amazon-chroot builder only works on Linux environments.")
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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
|
// 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)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
device := state.Get("device").(string)
|
device := state.Get("device").(string)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
instance := state.Get("instance").(*ec2.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
volumeId := state.Get("volume_id").(string)
|
volumeId := state.Get("volume_id").(string)
|
||||||
|
|
||||||
// For the API call, it expects "sd" prefixed devices.
|
// 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) {
|
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 {
|
if err := s.CleanupFunc(state); err != nil {
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ func (s *StepAttachVolume) CleanupFunc(state multistep.StateBag) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Detaching EBS volume...")
|
ui.Say("Detaching EBS volume...")
|
||||||
_, err := ec2conn.DetachVolume(&ec2.DetachVolumeInput{VolumeId: &s.volumeId})
|
_, err := ec2conn.DetachVolume(&ec2.DetachVolumeInput{VolumeId: &s.volumeId})
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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.
|
// 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 {
|
func (s *StepCheckRootDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
image := state.Get("source_image").(*ec2.Image)
|
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...")
|
ui.Say("Checking the root device on source AMI...")
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ func (s *StepCreateVolume) Run(ctx context.Context, state multistep.StateBag) mu
|
|||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
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)
|
volTags, err := awscommon.TagMap(s.RootVolumeTags).EC2Tags(s.Ctx, *ec2conn.Config.Region, state)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -129,7 +129,7 @@ func (s *StepCreateVolume) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
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...")
|
ui.Say("Deleting the created EBS volume...")
|
||||||
_, err := ec2conn.DeleteVolume(&ec2.DeleteVolumeInput{VolumeId: &s.volumeId})
|
_, err := ec2conn.DeleteVolume(&ec2.DeleteVolumeInput{VolumeId: &s.volumeId})
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/chroot"
|
"github.com/hashicorp/packer/packer-plugin-sdk/chroot"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StepEarlyUnflock unlocks the flock.
|
// StepEarlyUnflock unlocks the flock.
|
||||||
@ -15,7 +15,7 @@ type StepEarlyUnflock struct{}
|
|||||||
|
|
||||||
func (s *StepEarlyUnflock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepEarlyUnflock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
cleanup := state.Get("flock_cleanup").(chroot.Cleanup)
|
cleanup := state.Get("flock_cleanup").(chroot.Cleanup)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
log.Println("Unlocking file lock...")
|
log.Println("Unlocking file lock...")
|
||||||
if err := cleanup.CleanupFunc(state); err != nil {
|
if err := cleanup.CleanupFunc(state); err != nil {
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StepFlock provisions the instance within a chroot.
|
// 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 {
|
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"
|
lockfile := "/var/lock/packer-chroot/lock"
|
||||||
if err := os.MkdirAll(filepath.Dir(lockfile), 0755); err != nil {
|
if err := os.MkdirAll(filepath.Dir(lockfile), 0755); err != nil {
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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.
|
// 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 {
|
func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
session := state.Get("awsSession").(*session.Session)
|
session := state.Get("awsSession").(*session.Session)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
// Get our own instance ID
|
// Get our own instance ID
|
||||||
ui.Say("Gathering information about this EC2 instance...")
|
ui.Say("Gathering information about this EC2 instance...")
|
||||||
|
@ -10,9 +10,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"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/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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 {
|
func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
device := state.Get("device").(string)
|
device := state.Get("device").(string)
|
||||||
if config.NVMEDevicePath != "" {
|
if config.NVMEDevicePath != "" {
|
||||||
// customizable device path for mounting NVME block devices on c5 and m5 HVM
|
// 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) {
|
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 {
|
if err := s.CleanupFunc(state); err != nil {
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ func (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper)
|
wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper)
|
||||||
|
|
||||||
ui.Say("Unmounting the root device...")
|
ui.Say("Unmounting the root device...")
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/packerbuilderdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ type StepPrepareDevice struct {
|
|||||||
|
|
||||||
func (s *StepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
device := config.DevicePath
|
device := config.DevicePath
|
||||||
if device == "" {
|
if device == "" {
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/random"
|
||||||
confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
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)
|
config := state.Get("config").(*Config)
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
snapshotID := state.Get("snapshot_id").(string)
|
snapshotID := state.Get("snapshot_id").(string)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Registering the AMI...")
|
ui.Say("Registering the AMI...")
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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.
|
// 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 {
|
func (s *StepSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
volumeId := state.Get("volume_id").(string)
|
volumeId := state.Get("volume_id").(string)
|
||||||
|
|
||||||
ui.Say("Creating snapshot...")
|
ui.Say("Creating snapshot...")
|
||||||
@ -72,7 +72,7 @@ func (s *StepSnapshot) Cleanup(state multistep.StateBag) {
|
|||||||
|
|
||||||
if cancelled || halted {
|
if cancelled || halted {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
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...")
|
ui.Say("Removing snapshot since we cancelled or halted...")
|
||||||
_, err := ec2conn.DeleteSnapshot(&ec2.DeleteSnapshotInput{SnapshotId: &s.snapshotId})
|
_, err := ec2conn.DeleteSnapshot(&ec2.DeleteSnapshotInput{SnapshotId: &s.snapshotId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ssm"
|
"github.com/aws/aws-sdk-go/service/ssm"
|
||||||
"github.com/aws/aws-sdk-go/service/ssm/ssmiface"
|
"github.com/aws/aws-sdk-go/service/ssm/ssmiface"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"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/retry"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/shell-local/localexec"
|
"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
|
// context. If you do not wish to terminate the session manually: calling
|
||||||
// StopSession on a instance of this driver will terminate the active session
|
// StopSession on a instance of this driver will terminate the active session
|
||||||
// created from calling StartSession.
|
// 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 {
|
for ctx.Err() == nil {
|
||||||
log.Printf("ssm: Starting PortForwarding session to instance %s", s.InstanceID)
|
log.Printf("ssm: Starting PortForwarding session to instance %s", s.InstanceID)
|
||||||
args, sessionID, err := s.getCommand(ctx)
|
args, sessionID, err := s.getCommand(ctx)
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/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 {
|
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)
|
amis := state.Get("amis").(map[string]string)
|
||||||
snapshots := state.Get("snapshots").(map[string][]string)
|
snapshots := state.Get("snapshots").(map[string][]string)
|
||||||
intermediary, _ := state.Get("intermediary_image").(bool)
|
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) {
|
func (s *StepAMIRegionCopy) Cleanup(state multistep.StateBag) {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
if len(s.toDelete) == 0 {
|
if len(s.toDelete) == 0 {
|
||||||
return
|
return
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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
|
// 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 {
|
if instanceRaw != nil {
|
||||||
instance = instanceRaw.(*ec2.Instance)
|
instance = instanceRaw.(*ec2.Instance)
|
||||||
}
|
}
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
if instance == nil {
|
if instance == nil {
|
||||||
ui.Say("No volumes to clean up, skipping")
|
ui.Say("No volumes to clean up, skipping")
|
||||||
return
|
return
|
||||||
|
@ -10,9 +10,9 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/aws/aws-sdk-go/service/ssm"
|
"github.com/aws/aws-sdk-go/service/ssm"
|
||||||
pssm "github.com/hashicorp/packer/builder/amazon/common/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/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/net"
|
"github.com/hashicorp/packer/packer-plugin-sdk/net"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepCreateSSMTunnel struct {
|
type StepCreateSSMTunnel struct {
|
||||||
@ -27,7 +27,7 @@ type StepCreateSSMTunnel struct {
|
|||||||
|
|
||||||
// Run executes the Packer build step that creates a session tunnel.
|
// Run executes the Packer build step that creates a session tunnel.
|
||||||
func (s *StepCreateSSMTunnel) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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 {
|
if !s.SSMAgentEnabled {
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/retry"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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 {
|
func (s *StepCreateTags) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
session := state.Get("awsSession").(*session.Session)
|
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)
|
amis := state.Get("amis").(map[string]string)
|
||||||
|
|
||||||
if len(s.Tags) == 0 && len(s.SnapshotTags) == 0 {
|
if len(s.Tags) == 0 && len(s.SnapshotTags) == 0 {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepDeregisterAMI struct {
|
type StepDeregisterAMI struct {
|
||||||
@ -24,7 +24,7 @@ func (s *StepDeregisterAMI) Run(ctx context.Context, state multistep.StateBag) m
|
|||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
// Add the session region to list of regions will deregister AMIs in
|
// Add the session region to list of regions will deregister AMIs in
|
||||||
regions := append(s.Regions, *ec2conn.Config.Region)
|
regions := append(s.Regions, *ec2conn.Config.Region)
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/helper/communicator"
|
"github.com/hashicorp/packer/helper/communicator"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ type StepGetPassword struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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
|
// Skip if we're not using winrm
|
||||||
if s.Comm.Type != "winrm" {
|
if s.Comm.Type != "winrm" {
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/iam"
|
"github.com/aws/aws-sdk-go/service/iam"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/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 {
|
func (s *StepIamInstanceProfile) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
iamsvc := state.Get("iam").(*iam.IAM)
|
iamsvc := state.Get("iam").(*iam.IAM)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
state.Put("iamInstanceProfile", "")
|
state.Put("iamInstanceProfile", "")
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ func (s *StepIamInstanceProfile) Run(ctx context.Context, state multistep.StateB
|
|||||||
|
|
||||||
func (s *StepIamInstanceProfile) Cleanup(state multistep.StateBag) {
|
func (s *StepIamInstanceProfile) Cleanup(state multistep.StateBag) {
|
||||||
iamsvc := state.Get("iam").(*iam.IAM)
|
iamsvc := state.Get("iam").(*iam.IAM)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if s.roleIsAttached == true {
|
if s.roleIsAttached == true {
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"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/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/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ type StepKeyPair struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepKeyPair) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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 != "" {
|
if s.Comm.SSHPrivateKeyFile != "" {
|
||||||
ui.Say("Using existing SSH private key")
|
ui.Say("Using existing SSH private key")
|
||||||
@ -114,7 +114,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
// Remove the keypair
|
// Remove the keypair
|
||||||
ui.Say("Deleting temporary keypair...")
|
ui.Say("Deleting temporary keypair...")
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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 {
|
func (s *StepModifyAMIAttributes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
session := state.Get("awsSession").(*session.Session)
|
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)
|
amis := state.Get("amis").(map[string]string)
|
||||||
snapshots := state.Get("snapshots").(map[string][]string)
|
snapshots := state.Get("snapshots").(map[string][]string)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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"
|
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 {
|
func (s *StepModifyEBSBackedInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(ec2iface.EC2API)
|
ec2conn := state.Get("ec2").(ec2iface.EC2API)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
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
|
// Skip when it is a spot instance
|
||||||
if s.Skip {
|
if s.Skip {
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StepNetworkInfo queries AWS for information about
|
// 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 {
|
func (s *StepNetworkInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
// VPC
|
// VPC
|
||||||
if s.VpcId == "" && !s.VpcFilter.Empty() {
|
if s.VpcId == "" && !s.VpcFilter.Empty() {
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ type StepPreValidate struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepPreValidate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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 {
|
if accessConfig, ok := state.GetOk("access_config"); ok {
|
||||||
accessconf := accessConfig.(*AccessConfig)
|
accessconf := accessConfig.(*AccessConfig)
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"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/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/retry"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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))
|
securityGroupIds := aws.StringSlice(state.Get("securityGroupIds").([]string))
|
||||||
iamInstanceProfile := aws.String(state.Get("iamInstanceProfile").(string))
|
iamInstanceProfile := aws.String(state.Get("iamInstanceProfile").(string))
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
userData := s.UserData
|
userData := s.UserData
|
||||||
if s.UserDataFile != "" {
|
if s.UserDataFile != "" {
|
||||||
@ -371,7 +371,7 @@ func (s *StepRunSourceInstance) Run(ctx context.Context, state multistep.StateBa
|
|||||||
func (s *StepRunSourceInstance) Cleanup(state multistep.StateBag) {
|
func (s *StepRunSourceInstance) Cleanup(state multistep.StateBag) {
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
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
|
// Terminate the source instance if it exists
|
||||||
if s.instanceId != "" {
|
if s.instanceId != "" {
|
||||||
|
@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"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/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/random"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/retry"
|
"github.com/hashicorp/packer/packer-plugin-sdk/retry"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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 {
|
func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(ec2iface.EC2API)
|
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...")
|
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) {
|
func (s *StepRunSpotInstance) Cleanup(state multistep.StateBag) {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
launchTemplateName := state.Get("launchTemplateName").(string)
|
launchTemplateName := state.Get("launchTemplateName").(string)
|
||||||
|
|
||||||
// Terminate the source instance if it exists
|
// Terminate the source instance if it exists
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws/request"
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"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/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/uuid"
|
"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 {
|
func (s *StepSecurityGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
vpcId := state.Get("vpc_id").(string)
|
vpcId := state.Get("vpc_id").(string)
|
||||||
|
|
||||||
if len(s.SecurityGroupIds) > 0 {
|
if len(s.SecurityGroupIds) > 0 {
|
||||||
@ -165,7 +165,7 @@ func (s *StepSecurityGroup) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Deleting temporary security group...")
|
ui.Say("Deleting temporary security group...")
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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"
|
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 {
|
func (s *StepSourceAMIInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
params := &ec2.DescribeImagesInput{}
|
params := &ec2.DescribeImagesInput{}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ type StepStopEBSBackedInstance struct {
|
|||||||
func (s *StepStopEBSBackedInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepStopEBSBackedInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
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
|
// Skip when it is a spot instance
|
||||||
if s.Skip {
|
if s.Skip {
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
||||||
)
|
)
|
||||||
@ -14,7 +14,7 @@ import (
|
|||||||
type TagMap map[string]string
|
type TagMap map[string]string
|
||||||
type EC2Tags []*ec2.Tag
|
type EC2Tags []*ec2.Tag
|
||||||
|
|
||||||
func (t EC2Tags) Report(ui packer.Ui) {
|
func (t EC2Tags) Report(ui packersdk.Ui) {
|
||||||
for _, tag := range t {
|
for _, tag := range t {
|
||||||
ui.Message(fmt.Sprintf("Adding tag: \"%s\": \"%s\"",
|
ui.Message(fmt.Sprintf("Adding tag: \"%s\": \"%s\"",
|
||||||
aws.StringValue(tag.Key), aws.StringValue(tag.Value)))
|
aws.StringValue(tag.Key), aws.StringValue(tag.Value)))
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
"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/template/interpolate"
|
||||||
@ -150,7 +151,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return generatedData, warns, nil
|
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()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/random"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/retry"
|
"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)
|
config := state.Get("config").(*Config)
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
instance := state.Get("instance").(*ec2.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
// Create the image
|
// Create the image
|
||||||
amiName := config.AMIName
|
amiName := config.AMIName
|
||||||
@ -144,7 +144,7 @@ func (s *stepCreateAMI) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
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 " +
|
ui.Say("Deregistering the AMI and deleting associated snapshots because " +
|
||||||
"of cancellation, or error...")
|
"of cancellation, or error...")
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
"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/template/interpolate"
|
||||||
@ -173,7 +174,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return generatedData, warns, nil
|
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()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/random"
|
||||||
confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
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)
|
config := state.Get("config").(*Config)
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
snapshotIds := state.Get("snapshot_ids").(map[string]string)
|
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...")
|
ui.Say("Registering the AMI...")
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ func (s *StepRegisterAMI) Cleanup(state multistep.StateBag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
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...")
|
ui.Say("Deregistering the AMI because cancellation or error...")
|
||||||
deregisterOpts := &ec2.DeregisterImageInput{ImageId: s.image.ImageId}
|
deregisterOpts := &ec2.DeregisterImageInput{ImageId: s.image.ImageId}
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
multierror "github.com/hashicorp/go-multierror"
|
multierror "github.com/hashicorp/go-multierror"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ type StepSnapshotVolumes struct {
|
|||||||
|
|
||||||
func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName string, state multistep.StateBag) error {
|
func (s *StepSnapshotVolumes) snapshotVolume(ctx context.Context, deviceName string, state multistep.StateBag) error {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
instance := state.Get("instance").(*ec2.Instance)
|
||||||
|
|
||||||
var volumeId string
|
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 {
|
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{}
|
s.snapshotIds = map[string]string{}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ func (s *StepSnapshotVolumes) Cleanup(state multistep.StateBag) {
|
|||||||
|
|
||||||
if cancelled || halted {
|
if cancelled || halted {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
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...")
|
ui.Say("Removing snapshots since we cancelled or halted...")
|
||||||
s.snapshotMutex.Lock()
|
s.snapshotMutex.Lock()
|
||||||
for _, snapshotId := range s.snapshotIds {
|
for _, snapshotId := range s.snapshotIds {
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
"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/template/interpolate"
|
||||||
@ -164,7 +165,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return generatedData, warns, nil
|
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()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ type stepTagEBSVolumes struct {
|
|||||||
func (s *stepTagEBSVolumes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepTagEBSVolumes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
instance := state.Get("instance").(*ec2.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
|
|
||||||
volumes := make(EbsVolumes)
|
volumes := make(EbsVolumes)
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/packerbuilderdata"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
"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/template/interpolate"
|
||||||
@ -233,7 +234,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return generatedData, warns, nil
|
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()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ func (s *StepBundleVolume) Run(ctx context.Context, state multistep.StateBag) mu
|
|||||||
comm := state.Get("communicator").(packer.Communicator)
|
comm := state.Get("communicator").(packer.Communicator)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
instance := state.Get("instance").(*ec2.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
x509RemoteCertPath := state.Get("x509RemoteCertPath").(string)
|
x509RemoteCertPath := state.Get("x509RemoteCertPath").(string)
|
||||||
x509RemoteKeyPath := state.Get("x509RemoteKeyPath").(string)
|
x509RemoteKeyPath := state.Get("x509RemoteKeyPath").(string)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/random"
|
||||||
confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
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)
|
config := state.Get("config").(*Config)
|
||||||
ec2conn := state.Get("ec2").(*ec2.EC2)
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
||||||
manifestPath := state.Get("remote_manifest_path").(string)
|
manifestPath := state.Get("remote_manifest_path").(string)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Registering the AMI...")
|
ui.Say("Registering the AMI...")
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ func (s *StepUploadBundle) Run(ctx context.Context, state multistep.StateBag) mu
|
|||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
manifestName := state.Get("manifest_name").(string)
|
manifestName := state.Get("manifest_name").(string)
|
||||||
manifestPath := state.Get("manifest_path").(string)
|
manifestPath := state.Get("manifest_path").(string)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
accessKey := config.AccessKey
|
accessKey := config.AccessKey
|
||||||
secretKey := config.SecretKey
|
secretKey := config.SecretKey
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepUploadX509Cert struct{}
|
type StepUploadX509Cert struct{}
|
||||||
@ -14,7 +15,7 @@ type StepUploadX509Cert struct{}
|
|||||||
func (s *StepUploadX509Cert) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepUploadX509Cert) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
comm := state.Get("communicator").(packer.Communicator)
|
comm := state.Get("communicator").(packer.Communicator)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
x509RemoteCertPath := config.X509UploadPath + "/cert.pem"
|
x509RemoteCertPath := config.X509UploadPath + "/cert.pem"
|
||||||
x509RemoteKeyPath := config.X509UploadPath + "/key.pem"
|
x509RemoteKeyPath := config.X509UploadPath + "/key.pem"
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
@ -51,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return nil, warnings, errs
|
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 ...")
|
ui.Say("Running builder ...")
|
||||||
|
|
||||||
@ -339,7 +340,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) writeSSHPrivateKey(ui packer.Ui, debugKeyPath string) {
|
func (b *Builder) writeSSHPrivateKey(ui packersdk.Ui, debugKeyPath string) {
|
||||||
f, err := os.Create(debugKeyPath)
|
f, err := os.Create(debugKeyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Say(fmt.Sprintf("Error saving debug key: %s", err))
|
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)
|
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{}
|
claims := jwt.MapClaims{}
|
||||||
var p jwt.Parser
|
var p jwt.Parser
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
"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/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepCaptureImage struct {
|
type StepCaptureImage struct {
|
||||||
@ -20,7 +20,7 @@ type StepCaptureImage struct {
|
|||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepCaptureImage(client *AzureClient, ui packer.Ui) *StepCaptureImage {
|
func NewStepCaptureImage(client *AzureClient, ui packersdk.Ui) *StepCaptureImage {
|
||||||
var step = &StepCaptureImage{
|
var step = &StepCaptureImage{
|
||||||
client: client,
|
client: client,
|
||||||
get: func(client *AzureClient) *CaptureTemplate {
|
get: func(client *AzureClient) *CaptureTemplate {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
"github.com/hashicorp/packer/builder/azure/common"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepCertificateInKeyVault struct {
|
type StepCertificateInKeyVault struct {
|
||||||
@ -17,7 +17,7 @@ type StepCertificateInKeyVault struct {
|
|||||||
error func(e error)
|
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{
|
var step = &StepCertificateInKeyVault{
|
||||||
client: cli,
|
client: cli,
|
||||||
config: config,
|
config: config,
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
"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/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepCreateResourceGroup struct {
|
type StepCreateResourceGroup struct {
|
||||||
@ -19,7 +19,7 @@ type StepCreateResourceGroup struct {
|
|||||||
exists func(ctx context.Context, resourceGroupName string) (bool, error)
|
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{
|
var step = &StepCreateResourceGroup{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
@ -113,7 +113,7 @@ func (s *StepCreateResourceGroup) Cleanup(state multistep.StateBag) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
if state.Get(constants.ArmIsExistingResourceGroup).(bool) {
|
if state.Get(constants.ArmIsExistingResourceGroup).(bool) {
|
||||||
ui.Say("\nThe resource group was not created by Packer, not deleting ...")
|
ui.Say("\nThe resource group was not created by Packer, not deleting ...")
|
||||||
return
|
return
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepDeleteAdditionalDisk struct {
|
type StepDeleteAdditionalDisk struct {
|
||||||
@ -21,7 +21,7 @@ type StepDeleteAdditionalDisk struct {
|
|||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepDeleteAdditionalDisks(client *AzureClient, ui packer.Ui) *StepDeleteAdditionalDisk {
|
func NewStepDeleteAdditionalDisks(client *AzureClient, ui packersdk.Ui) *StepDeleteAdditionalDisk {
|
||||||
var step = &StepDeleteAdditionalDisk{
|
var step = &StepDeleteAdditionalDisk{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/retry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ type StepDeployTemplate struct {
|
|||||||
name string
|
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{
|
var step = &StepDeployTemplate{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
@ -73,7 +73,7 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) {
|
|||||||
return
|
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 ...")
|
ui.Say("\nThe resource group was not created by Packer, deleting individual resources ...")
|
||||||
|
|
||||||
deploymentName := s.name
|
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 {
|
func (s *StepDeployTemplate) deleteTemplate(ctx context.Context, state multistep.StateBag) error {
|
||||||
deploymentName := s.name
|
deploymentName := s.name
|
||||||
resourceGroupName := state.Get(constants.ArmResourceGroupName).(string)
|
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))
|
ui.Say(fmt.Sprintf("Removing the created Deployment object: '%s'", deploymentName))
|
||||||
f, err := s.client.DeploymentsClient.Delete(ctx, resourceGroupName, deploymentName)
|
f, err := s.client.DeploymentsClient.Delete(ctx, resourceGroupName, deploymentName)
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepGetDataDisk struct {
|
type StepGetDataDisk struct {
|
||||||
@ -19,7 +19,7 @@ type StepGetDataDisk struct {
|
|||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepGetAdditionalDisks(client *AzureClient, ui packer.Ui) *StepGetDataDisk {
|
func NewStepGetAdditionalDisks(client *AzureClient, ui packersdk.Ui) *StepGetDataDisk {
|
||||||
var step = &StepGetDataDisk{
|
var step = &StepGetDataDisk{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepGetCertificate struct {
|
type StepGetCertificate struct {
|
||||||
@ -18,7 +18,7 @@ type StepGetCertificate struct {
|
|||||||
pause func()
|
pause func()
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepGetCertificate(client *AzureClient, ui packer.Ui) *StepGetCertificate {
|
func NewStepGetCertificate(client *AzureClient, ui packersdk.Ui) *StepGetCertificate {
|
||||||
var step = &StepGetCertificate{
|
var step = &StepGetCertificate{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EndpointType int
|
type EndpointType int
|
||||||
@ -33,7 +33,7 @@ type StepGetIPAddress struct {
|
|||||||
error func(e error)
|
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{
|
var step = &StepGetIPAddress{
|
||||||
client: client,
|
client: client,
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepGetOSDisk struct {
|
type StepGetOSDisk struct {
|
||||||
@ -19,7 +19,7 @@ type StepGetOSDisk struct {
|
|||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepGetOSDisk(client *AzureClient, ui packer.Ui) *StepGetOSDisk {
|
func NewStepGetOSDisk(client *AzureClient, ui packersdk.Ui) *StepGetOSDisk {
|
||||||
var step = &StepGetOSDisk{
|
var step = &StepGetOSDisk{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepPowerOffCompute struct {
|
type StepPowerOffCompute struct {
|
||||||
@ -16,7 +16,7 @@ type StepPowerOffCompute struct {
|
|||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepPowerOffCompute(client *AzureClient, ui packer.Ui) *StepPowerOffCompute {
|
func NewStepPowerOffCompute(client *AzureClient, ui packersdk.Ui) *StepPowerOffCompute {
|
||||||
var step = &StepPowerOffCompute{
|
var step = &StepPowerOffCompute{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/date"
|
"github.com/Azure/go-autorest/autorest/date"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepPublishToSharedImageGallery struct {
|
type StepPublishToSharedImageGallery struct {
|
||||||
@ -19,7 +19,7 @@ type StepPublishToSharedImageGallery struct {
|
|||||||
toSIG func() bool
|
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{
|
var step = &StepPublishToSharedImageGallery{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) {
|
say: func(message string) {
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepSetCertificate struct {
|
type StepSetCertificate struct {
|
||||||
@ -14,7 +14,7 @@ type StepSetCertificate struct {
|
|||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepSetCertificate(config *Config, ui packer.Ui) *StepSetCertificate {
|
func NewStepSetCertificate(config *Config, ui packersdk.Ui) *StepSetCertificate {
|
||||||
var step = &StepSetCertificate{
|
var step = &StepSetCertificate{
|
||||||
config: config,
|
config: config,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepSnapshotDataDisks struct {
|
type StepSnapshotDataDisks struct {
|
||||||
@ -20,7 +20,7 @@ type StepSnapshotDataDisks struct {
|
|||||||
enable func() bool
|
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{
|
var step = &StepSnapshotDataDisks{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepSnapshotOSDisk struct {
|
type StepSnapshotOSDisk struct {
|
||||||
@ -19,7 +19,7 @@ type StepSnapshotOSDisk struct {
|
|||||||
enable func() bool
|
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{
|
var step = &StepSnapshotOSDisk{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepValidateTemplate struct {
|
type StepValidateTemplate struct {
|
||||||
@ -18,7 +18,7 @@ type StepValidateTemplate struct {
|
|||||||
factory templateFactoryFunc
|
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{
|
var step = &StepValidateTemplate{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"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/config"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
||||||
|
|
||||||
@ -392,7 +393,7 @@ func checkHyperVGeneration(s string) interface{} {
|
|||||||
s, compute.PossibleHyperVGenerationValues())
|
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 {
|
switch runtime.GOOS {
|
||||||
case "linux", "freebsd":
|
case "linux", "freebsd":
|
||||||
break
|
break
|
||||||
|
@ -5,10 +5,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"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
|
// 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{}
|
errorBuffer := &strings.Builder{}
|
||||||
ui := &packer.BasicUi{
|
ui := &packer.BasicUi{
|
||||||
Reader: strings.NewReader(""),
|
Reader: strings.NewReader(""),
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ multistep.Step = &StepAttachDisk{}
|
var _ multistep.Step = &StepAttachDisk{}
|
||||||
@ -19,7 +19,7 @@ type StepAttachDisk struct {
|
|||||||
|
|
||||||
func (s *StepAttachDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepAttachDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
||||||
diskResourceID := diskset.OS().String()
|
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) {
|
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 {
|
if err := s.CleanupFunc(state); err != nil {
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ func (s *StepAttachDisk) CleanupFunc(state multistep.StateBag) error {
|
|||||||
|
|
||||||
if s.attached {
|
if s.attached {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
||||||
diskResourceID := diskset.OS().String()
|
diskResourceID := diskset.OS().String()
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/Azure/go-autorest/autorest/azure"
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ multistep.Step = &StepCreateImage{}
|
var _ multistep.Step = &StepCreateImage{}
|
||||||
@ -28,7 +28,7 @@ type StepCreateImage struct {
|
|||||||
|
|
||||||
func (s *StepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
||||||
diskResourceID := diskset.OS().String()
|
diskResourceID := diskset.OS().String()
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"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 {
|
func (s *StepCreateNewDiskset) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
s.disks = make(Diskset)
|
s.disks = make(Diskset)
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ func (s StepCreateNewDiskset) getDatadiskDefinitionFromImage(lun int32) compute.
|
|||||||
func (s *StepCreateNewDiskset) Cleanup(state multistep.StateBag) {
|
func (s *StepCreateNewDiskset) Cleanup(state multistep.StateBag) {
|
||||||
if !s.SkipCleanup {
|
if !s.SkipCleanup {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
for _, d := range s.disks {
|
for _, d := range s.disks {
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepCreateSharedImageVersion struct {
|
type StepCreateSharedImageVersion struct {
|
||||||
@ -23,7 +23,7 @@ type StepCreateSharedImageVersion struct {
|
|||||||
|
|
||||||
func (s *StepCreateSharedImageVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepCreateSharedImageVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
snapshotset := state.Get(stateBagKey_Snapshotset).(Diskset)
|
snapshotset := state.Get(stateBagKey_Snapshotset).(Diskset)
|
||||||
|
|
||||||
ui.Say(fmt.Sprintf("Creating image version %s\n using %q for os disk.",
|
ui.Say(fmt.Sprintf("Creating image version %s\n using %q for os disk.",
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"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 {
|
func (s *StepCreateSnapshotset) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
diskset := state.Get(stateBagKey_Diskset).(Diskset)
|
||||||
|
|
||||||
s.snapshots = make(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) {
|
func (s *StepCreateSnapshotset) Cleanup(state multistep.StateBag) {
|
||||||
if !s.SkipCleanup {
|
if !s.SkipCleanup {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
for _, resource := range s.snapshots {
|
for _, resource := range s.snapshots {
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ type StepMountDevice struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
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)
|
device := state.Get("device").(string)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper)
|
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) {
|
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 {
|
if err := s.CleanupFunc(state); err != nil {
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ func (s *StepMountDevice) CleanupFunc(state multistep.StateBag) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper)
|
wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper)
|
||||||
|
|
||||||
ui.Say("Unmounting the root device...")
|
ui.Say("Unmounting the root device...")
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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'
|
// 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
|
// 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 {
|
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") {
|
if strings.EqualFold(pi.Version, "latest") {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ multistep.Step = &StepVerifySharedImageDestination{}
|
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.
|
// 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 {
|
func (s *StepVerifySharedImageDestination) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
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 {
|
errorMessage := func(message string, parameters ...interface{}) multistep.StepAction {
|
||||||
err := fmt.Errorf(message, parameters...)
|
err := fmt.Errorf(message, parameters...)
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ multistep.Step = &StepVerifySharedImageSource{}
|
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.
|
// 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 {
|
func (s *StepVerifySharedImageSource) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
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 {
|
errorMessage := func(message string, parameters ...interface{}) multistep.StepAction {
|
||||||
err := fmt.Errorf(message, parameters...)
|
err := fmt.Errorf(message, parameters...)
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepVerifySourceDisk struct {
|
type StepVerifySourceDisk struct {
|
||||||
@ -21,7 +21,7 @@ type StepVerifySourceDisk struct {
|
|||||||
|
|
||||||
func (s StepVerifySourceDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s StepVerifySourceDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
azcli := state.Get("azureclient").(client.AzureClientSet)
|
azcli := state.Get("azureclient").(client.AzureClientSet)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Checking source disk location")
|
ui.Say("Checking source disk location")
|
||||||
resource, err := azure.ParseResourceID(s.SourceDiskResourceID)
|
resource, err := azure.ParseResourceID(s.SourceDiskResourceID)
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"github.com/hashicorp/packer/builder/azure/common/client"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_StepVerifySourceDisk_Run(t *testing.T) {
|
func Test_StepVerifySourceDisk_Run(t *testing.T) {
|
||||||
@ -152,6 +152,6 @@ func Test_StepVerifySourceDisk_Run(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type uiThatRemebersErrors struct {
|
type uiThatRemebersErrors struct {
|
||||||
packer.Ui
|
packersdk.Ui
|
||||||
LastError string
|
LastError string
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
@ -51,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
|||||||
return nil, warnings, errs
|
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 ...")
|
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
|
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)
|
f, err := os.Create(debugKeyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Say(fmt.Sprintf("Error saving debug key: %s", err))
|
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)
|
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)
|
num := int32(10)
|
||||||
virtualNetworkPage, err := azClient.DtlVirtualNetworksClient.List(ctx, b.config.LabResourceGroupName, b.config.LabName, "", "", &num, "")
|
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)
|
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{}
|
claims := jwt.MapClaims{}
|
||||||
var p jwt.Parser
|
var p jwt.Parser
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl"
|
"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/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepCaptureImage struct {
|
type StepCaptureImage struct {
|
||||||
@ -20,7 +20,7 @@ type StepCaptureImage struct {
|
|||||||
error func(e error)
|
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{
|
var step = &StepCaptureImage{
|
||||||
client: client,
|
client: client,
|
||||||
get: func(client *AzureClient) *CaptureTemplate {
|
get: func(client *AzureClient) *CaptureTemplate {
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepDeleteVirtualMachine struct {
|
type StepDeleteVirtualMachine struct {
|
||||||
@ -17,7 +17,7 @@ type StepDeleteVirtualMachine struct {
|
|||||||
error func(e error)
|
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{
|
var step = &StepDeleteVirtualMachine{
|
||||||
client: client,
|
client: client,
|
||||||
config: config,
|
config: config,
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepDeployTemplate struct {
|
type StepDeployTemplate struct {
|
||||||
@ -25,7 +25,7 @@ type StepDeployTemplate struct {
|
|||||||
name string
|
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{
|
var step = &StepDeployTemplate{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) { ui.Say(message) },
|
say: func(message string) { ui.Say(message) },
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepPowerOffCompute struct {
|
type StepPowerOffCompute struct {
|
||||||
@ -17,7 +17,7 @@ type StepPowerOffCompute struct {
|
|||||||
error func(e error)
|
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{
|
var step = &StepPowerOffCompute{
|
||||||
client: client,
|
client: client,
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
|
"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/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepPublishToSharedImageGallery struct {
|
type StepPublishToSharedImageGallery struct {
|
||||||
@ -18,7 +18,7 @@ type StepPublishToSharedImageGallery struct {
|
|||||||
toSIG func() bool
|
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{
|
var step = &StepPublishToSharedImageGallery{
|
||||||
client: client,
|
client: client,
|
||||||
say: func(message string) {
|
say: func(message string) {
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/xanzy/go-cloudstack/cloudstack"
|
"github.com/xanzy/go-cloudstack/cloudstack"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ const BuilderId = "packer.cloudstack"
|
|||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
runner multistep.Runner
|
runner multistep.Runner
|
||||||
ui packer.Ui
|
ui packersdk.Ui
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
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.
|
// 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
|
b.ui = ui
|
||||||
|
|
||||||
// Create a CloudStack API client.
|
// Create a CloudStack API client.
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/xanzy/go-cloudstack/cloudstack"
|
"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 {
|
func (s *stepSetupNetworking) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*cloudstack.CloudStackClient)
|
client := state.Get("client").(*cloudstack.CloudStackClient)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Setup networking...")
|
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.
|
// Cleanup any resources that may have been created during the Run phase.
|
||||||
func (s *stepSetupNetworking) Cleanup(state multistep.StateBag) {
|
func (s *stepSetupNetworking) Cleanup(state multistep.StateBag) {
|
||||||
client := state.Get("client").(*cloudstack.CloudStackClient)
|
client := state.Get("client").(*cloudstack.CloudStackClient)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Cleanup networking...")
|
ui.Say("Cleanup networking...")
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"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/template/interpolate"
|
||||||
"github.com/xanzy/go-cloudstack/cloudstack"
|
"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 {
|
func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
client := state.Get("client").(*cloudstack.CloudStackClient)
|
client := state.Get("client").(*cloudstack.CloudStackClient)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
ui.Say("Creating instance...")
|
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) {
|
func (s *stepCreateInstance) Cleanup(state multistep.StateBag) {
|
||||||
client := state.Get("client").(*cloudstack.CloudStackClient)
|
client := state.Get("client").(*cloudstack.CloudStackClient)
|
||||||
config := state.Get("config").(*Config)
|
config := state.Get("config").(*Config)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packersdk.Ui)
|
||||||
|
|
||||||
instanceID, ok := state.Get("instance_id").(string)
|
instanceID, ok := state.Get("instance_id").(string)
|
||||||
if !ok || instanceID == "" {
|
if !ok || instanceID == "" {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user