diff --git a/Gopkg.lock b/Gopkg.lock index eec8d0251..4be470e7d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -80,8 +80,10 @@ "communicator/ssh", "communicator/winrm", "helper/builder/testing", + "helper/common", "helper/communicator", "helper/config", + "helper/multistep", "packer", "packer/plugin", "packer/rpc", @@ -89,8 +91,8 @@ "template/interpolate", "version" ] - revision = "6a8ae4b258d1bb0beece05c9fc3bbc1c186a0480" - version = "v1.0.2" + revision = "ab8811dca8f375344f36dfc32710b9790b2ec03e" + version = "v1.2.2" [[projects]] branch = "master" @@ -135,7 +137,7 @@ ".", "fat" ] - revision = "7bae45d9a684750e82b97ff320c82556614e621b" + revision = "b7b9ca407ffff465de12fc37ccbb81ea8b428c43" [[projects]] branch = "master" @@ -149,12 +151,6 @@ packages = ["."] revision = "00c29f56e2386353d58c599509e8dc3801b0d716" -[[projects]] - branch = "master" - name = "github.com/mitchellh/multistep" - packages = ["."] - revision = "391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d" - [[projects]] branch = "master" name = "github.com/mitchellh/reflectwalk" @@ -182,14 +178,14 @@ [[projects]] name = "github.com/pkg/sftp" packages = ["."] - revision = "49488377fa2f14143ba3067cf7555f60f6c7b550" - version = "1.5.0" + revision = "43ec6c679d353f6e077d3965dc74f6d996eb4a09" + version = "1.5.1" [[projects]] name = "github.com/ugorji/go" packages = ["codec"] - revision = "9831f2c3ac1068a78f50999a30db84270f647af6" - version = "v1.1" + revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab" + version = "v1.1.1" [[projects]] name = "github.com/vmware/govmomi" @@ -226,13 +222,13 @@ "ssh", "ssh/agent" ] - revision = "88942b9c40a4c9d203b82b3731787b672d6e809b" + revision = "d6449816ce06963d9d136eee5a56fca5b0616e7e" [[projects]] branch = "master" name = "golang.org/x/mobile" packages = ["event/key"] - revision = "598bfe4b20d39a660581f014b68e60c5ad425336" + revision = "1f177cbe4ddf911017472e9532c6ca3a99949d53" [[projects]] branch = "master" @@ -240,9 +236,11 @@ packages = [ "html", "html/atom", - "html/charset" + "html/charset", + "internal/socks", + "proxy" ] - revision = "6078986fec03a1dcc236c34816c71b0e05018fda" + revision = "500e7a4f953ddaf55d316b4d3adc516aa0379622" [[projects]] name = "golang.org/x/text" @@ -271,6 +269,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "edb4fc0cd7c29895ef0cb47e8323311bacdba397dd57f12217ac8ea9dce6a31d" + inputs-digest = "20177d3d587549d23b3ddea4eefc1fc03aa3436c372843bc76f98052b25432b7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 188fbe86d..02206ea46 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,6 +1,6 @@ [[constraint]] name = "github.com/hashicorp/packer" - version = "=1.0.2" + version = "=1.2.2" [[override]] name = "github.com/masterzen/azure-sdk-for-go" diff --git a/clone/builder.go b/clone/builder.go index 51b54d3e5..2df7a39f0 100644 --- a/clone/builder.go +++ b/clone/builder.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" ) type Builder struct { diff --git a/clone/step_clone.go b/clone/step_clone.go index 8f216a1fa..303ea93af 100644 --- a/clone/step_clone.go +++ b/clone/step_clone.go @@ -1,11 +1,12 @@ package clone import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "context" ) type CloneConfig struct { @@ -28,7 +29,7 @@ type StepCloneVM struct { config *CloneConfig } -func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) diff --git a/clone/step_hardware.go b/clone/step_hardware.go index 9f61fdf5f..9283a6436 100644 --- a/clone/step_hardware.go +++ b/clone/step_hardware.go @@ -4,14 +4,15 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "context" ) type StepConfigureHardware struct { config *common.HardwareConfig } -func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/check_run_status.go b/common/check_run_status.go index 3d383d9fe..0a00b14ad 100644 --- a/common/check_run_status.go +++ b/common/check_run_status.go @@ -1,7 +1,7 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "errors" ) diff --git a/common/ssh.go b/common/ssh.go index 5ca854068..0eec1f126 100644 --- a/common/ssh.go +++ b/common/ssh.go @@ -5,7 +5,7 @@ import ( "io/ioutil" packerssh "github.com/hashicorp/packer/communicator/ssh" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "golang.org/x/crypto/ssh" "github.com/hashicorp/packer/helper/communicator" ) diff --git a/common/step_connect.go b/common/step_connect.go index ae6b8fbbb..f688eab62 100644 --- a/common/step_connect.go +++ b/common/step_connect.go @@ -1,9 +1,10 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type ConnectConfig struct { @@ -34,8 +35,8 @@ type StepConnect struct { Config *ConnectConfig } -func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction { - d, err := driver.NewDriver(&driver.ConnectConfig{ +func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + d, err := driver.NewDriver(ctx, &driver.ConnectConfig{ VCenterServer: s.Config.VCenterServer, Username: s.Config.Username, Password: s.Config.Password, diff --git a/common/step_run.go b/common/step_run.go index e9ff7c2ee..c7f3bedfa 100644 --- a/common/step_run.go +++ b/common/step_run.go @@ -1,12 +1,13 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "strings" "time" + "context" ) type RunConfig struct { @@ -35,7 +36,7 @@ type StepRun struct { Config *RunConfig } -func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_shutdown.go b/common/step_shutdown.go index 8f9a4f4d2..cc3945c88 100644 --- a/common/step_shutdown.go +++ b/common/step_shutdown.go @@ -1,13 +1,14 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "fmt" "log" "time" "bytes" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type ShutdownConfig struct { @@ -37,7 +38,7 @@ type StepShutdown struct { Config *ShutdownConfig } -func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepShutdown) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) comm := state.Get("communicator").(packer.Communicator) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_snapshot.go b/common/step_snapshot.go index fbf69170c..b69d8a46f 100644 --- a/common/step_snapshot.go +++ b/common/step_snapshot.go @@ -1,16 +1,17 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type StepCreateSnapshot struct{ CreateSnapshot bool } -func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_template.go b/common/step_template.go index e805ea83d..bb2379b44 100644 --- a/common/step_template.go +++ b/common/step_template.go @@ -1,16 +1,17 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" + "context" ) type StepConvertToTemplate struct{ ConvertToTemplate bool } -func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConvertToTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/step_wait_for_ip.go b/common/step_wait_for_ip.go index da33b0b91..a8b0cbfc1 100644 --- a/common/step_wait_for_ip.go +++ b/common/step_wait_for_ip.go @@ -1,16 +1,17 @@ package common import ( - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" "time" + "context" ) type StepWaitForIp struct{} -func (s *StepWaitForIp) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/common/testing/utility.go b/common/testing/utility.go index 8a13bf883..7c72e14a9 100644 --- a/common/testing/utility.go +++ b/common/testing/utility.go @@ -9,6 +9,7 @@ import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" "testing" "github.com/jetbrains-infra/packer-builder-vsphere/common" + "context" ) func NewVMName() string { @@ -34,7 +35,7 @@ func RenderConfig(config map[string]interface{}) string { func TestConn(t *testing.T) *driver.Driver { - d, err := driver.NewDriver(&driver.ConnectConfig{ + d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/driver/driver.go b/driver/driver.go index 30ddcce72..324bcc148 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -28,8 +28,7 @@ type ConnectConfig struct { Datacenter string } -func NewDriver(config *ConnectConfig) (*Driver, error) { - ctx := context.TODO() +func NewDriver(ctx context.Context, config *ConnectConfig) (*Driver, error) { vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer)) if err != nil { diff --git a/driver/driver_test.go b/driver/driver_test.go index e46729ad4..54590f389 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -5,13 +5,14 @@ import ( "testing" "time" "math/rand" + "context" ) // Defines whether acceptance tests should be run const TestHostName = "esxi-1.vsphere65.test" func newTestDriver(t *testing.T) *Driver { - d, err := NewDriver(&ConnectConfig{ + d, err := NewDriver(context.TODO(), &ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/examples/driver/main.go b/examples/driver/main.go index 8136ff3e3..e4d15ec95 100644 --- a/examples/driver/main.go +++ b/examples/driver/main.go @@ -3,10 +3,11 @@ package main import ( "github.com/jetbrains-infra/packer-builder-vsphere/driver" "fmt" + "context" ) func main() { - d, err := driver.NewDriver(&driver.ConnectConfig{ + d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ VCenterServer: "vcenter.vsphere65.test", Username: "root", Password: "jetbrains", diff --git a/iso/builder.go b/iso/builder.go index 412b7035f..7ee7e062d 100644 --- a/iso/builder.go +++ b/iso/builder.go @@ -2,11 +2,11 @@ package iso import ( packerCommon "github.com/hashicorp/packer/common" - "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/helper/communicator" ) type Builder struct { diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index 91fefb0dd..9593046cc 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -1,11 +1,11 @@ package iso import ( - "fmt" - "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "fmt" + "context" ) type CDRomConfig struct { @@ -20,7 +20,7 @@ type StepAddCDRom struct { Config *CDRomConfig } -func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 92a9c002d..c492907f4 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -1,11 +1,11 @@ package iso import ( - "fmt" - + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "fmt" + "context" ) type FloppyConfig struct { @@ -32,7 +32,7 @@ type StepAddFloppy struct { Host string } -func (s *StepAddFloppy) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { err := s.runImpl(state) if err != nil { state.Put("error", fmt.Errorf("error adding floppy: %v", err)) diff --git a/iso/step_boot_command.go b/iso/step_boot_command.go index 715a8d94d..2e86f954b 100644 --- a/iso/step_boot_command.go +++ b/iso/step_boot_command.go @@ -3,7 +3,7 @@ package iso import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" "time" "strings" @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/common" "os" "log" + "context" ) type BootConfig struct { @@ -63,7 +64,7 @@ func init() { } } -func (s *StepBootCommand) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepBootCommand) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_config_params.go b/iso/step_config_params.go index 15449fa70..4bb18ab94 100644 --- a/iso/step_config_params.go +++ b/iso/step_config_params.go @@ -3,8 +3,9 @@ package iso import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "fmt" + "context" ) type ConfigParamsConfig struct { @@ -19,7 +20,7 @@ type StepConfigParams struct { Config *ConfigParamsConfig } -func (s *StepConfigParams) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepConfigParams) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_create.go b/iso/step_create.go index 0d0bbcf3a..6c0eed5fa 100644 --- a/iso/step_create.go +++ b/iso/step_create.go @@ -5,7 +5,8 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" + "context" ) type CreateConfig struct { @@ -55,7 +56,7 @@ type StepCreateVM struct { Config *CreateConfig } -func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) d := state.Get("driver").(*driver.Driver) diff --git a/iso/step_remove_cdrom.go b/iso/step_remove_cdrom.go index 74f1dba91..a8144eb75 100644 --- a/iso/step_remove_cdrom.go +++ b/iso/step_remove_cdrom.go @@ -5,13 +5,14 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/vmware/govmomi/vim25/types" + "context" ) type StepRemoveCDRom struct{} -func (s *StepRemoveCDRom) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) diff --git a/iso/step_remove_floppy.go b/iso/step_remove_floppy.go index 1fc4f07fb..7c32fe6dc 100644 --- a/iso/step_remove_floppy.go +++ b/iso/step_remove_floppy.go @@ -5,8 +5,9 @@ import ( "github.com/hashicorp/packer/packer" "github.com/jetbrains-infra/packer-builder-vsphere/driver" - "github.com/mitchellh/multistep" + "github.com/hashicorp/packer/helper/multistep" "github.com/vmware/govmomi/vim25/types" + "context" ) type StepRemoveFloppy struct { @@ -14,7 +15,7 @@ type StepRemoveFloppy struct { Host string } -func (s *StepRemoveFloppy) Run(state multistep.StateBag) multistep.StepAction { +func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) vm := state.Get("vm").(*driver.VirtualMachine) d := state.Get("driver").(*driver.Driver)