apply gofmt

This commit is contained in:
Michael Kuzmin 2018-11-01 00:42:24 +03:00
parent 6bfb34e0ab
commit a3f0f15ffd
35 changed files with 124 additions and 129 deletions

View File

@ -2,11 +2,11 @@ package clone
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/helper/communicator"
) )
type Builder struct { type Builder struct {
@ -51,7 +51,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
if b.config.Comm.Type != "none" { if b.config.Comm.Type != "none" {
steps = append(steps, steps = append(steps,
&common.StepRun{ &common.StepRun{
Config: &b.config.RunConfig, Config: &b.config.RunConfig,
SetOrder: false, SetOrder: false,
}, },
&common.StepWaitForIp{}, &common.StepWaitForIp{},

View File

@ -2,12 +2,11 @@ package clone
import ( import (
builderT "github.com/hashicorp/packer/helper/builder/testing" builderT "github.com/hashicorp/packer/helper/builder/testing"
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common"
commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing" commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing"
"os" "os"
"github.com/hashicorp/packer/packer"
"testing" "testing"
"github.com/jetbrains-infra/packer-builder-vsphere/common"
) )
func TestCloneBuilderAcc_default(t *testing.T) { func TestCloneBuilderAcc_default(t *testing.T) {
@ -429,7 +428,7 @@ func TestCloneBuilderAcc_sshPassword(t *testing.T) {
builderT.Test(t, builderT.TestCase{ builderT.Test(t, builderT.TestCase{
Builder: &Builder{}, Builder: &Builder{},
Template: sshPasswordConfig(), Template: sshPasswordConfig(),
Check: checkDefaultBootOrder(t), Check: checkDefaultBootOrder(t),
}) })
} }

View File

@ -3,10 +3,10 @@ package clone
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/hashicorp/packer/helper/config"
) )
type Config struct { type Config struct {
@ -18,9 +18,9 @@ type Config struct {
common.HardwareConfig `mapstructure:",squash"` common.HardwareConfig `mapstructure:",squash"`
common.ConfigParamsConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"`
common.RunConfig `mapstructure:",squash"` common.RunConfig `mapstructure:",squash"`
Comm communicator.Config `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"`
common.ShutdownConfig `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"`
CreateSnapshot bool `mapstructure:"create_snapshot"` CreateSnapshot bool `mapstructure:"create_snapshot"`
ConvertToTemplate bool `mapstructure:"convert_to_template"` ConvertToTemplate bool `mapstructure:"convert_to_template"`

View File

@ -25,7 +25,7 @@ func TestCloneConfig_Timeout(t *testing.T) {
raw["shutdown_timeout"] = "3m" raw["shutdown_timeout"] = "3m"
conf, warns, err := NewConfig(raw) conf, warns, err := NewConfig(raw)
testConfigOk(t, warns, err) testConfigOk(t, warns, err)
if conf.ShutdownConfig.Timeout != 3 * time.Minute { if conf.ShutdownConfig.Timeout != 3*time.Minute {
t.Fatalf("shutdown_timeout sould be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout) t.Fatalf("shutdown_timeout sould be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout)
} }
} }
@ -41,13 +41,13 @@ func TestCloneConfig_RAMReservation(t *testing.T) {
func minimalConfig() map[string]interface{} { func minimalConfig() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"vcenter_server": "vcenter.domain.local", "vcenter_server": "vcenter.domain.local",
"username": "root", "username": "root",
"password": "vmware", "password": "vmware",
"template": "ubuntu", "template": "ubuntu",
"vm_name": "vm1", "vm_name": "vm1",
"host": "esxi1.domain.local", "host": "esxi1.domain.local",
"ssh_username": "root", "ssh_username": "root",
"ssh_password": "secret", "ssh_password": "secret",
} }
} }

View File

@ -1,12 +1,12 @@
package clone package clone
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"fmt"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"context" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
type CloneConfig struct { type CloneConfig struct {

View File

@ -2,12 +2,11 @@ package common
import ( import (
"fmt" "fmt"
"io/ioutil"
packerssh "github.com/hashicorp/packer/communicator/ssh" packerssh "github.com/hashicorp/packer/communicator/ssh"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
"github.com/hashicorp/packer/helper/communicator" "io/ioutil"
) )
func CommHost(state multistep.StateBag) (string, error) { func CommHost(state multistep.StateBag) (string, error) {

View File

@ -1,11 +1,11 @@
package common package common
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"context"
) )
type ConfigParamsConfig struct { type ConfigParamsConfig struct {

View File

@ -1,10 +1,10 @@
package common package common
import ( import (
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context" "context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
type ConnectConfig struct { type ConnectConfig struct {

View File

@ -1,25 +1,25 @@
package common package common
import ( import (
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"context" "context"
"fmt" "fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
type HardwareConfig struct { type HardwareConfig struct {
CPUs int32 `mapstructure:"CPUs"` CPUs int32 `mapstructure:"CPUs"`
CPUReservation int64 `mapstructure:"CPU_reservation"` CPUReservation int64 `mapstructure:"CPU_reservation"`
CPULimit int64 `mapstructure:"CPU_limit"` CPULimit int64 `mapstructure:"CPU_limit"`
CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"` CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"`
RAM int64 `mapstructure:"RAM"` RAM int64 `mapstructure:"RAM"`
RAMReservation int64 `mapstructure:"RAM_reservation"` RAMReservation int64 `mapstructure:"RAM_reservation"`
RAMReserveAll bool `mapstructure:"RAM_reserve_all"` RAMReserveAll bool `mapstructure:"RAM_reserve_all"`
MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"` MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"`
NestedHV bool `mapstructure:"NestedHV"` NestedHV bool `mapstructure:"NestedHV"`
} }
func (c *HardwareConfig) Prepare() []error { func (c *HardwareConfig) Prepare() []error {

View File

@ -1,11 +1,11 @@
package common package common
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"strings" "strings"
"context"
) )
type RunConfig struct { type RunConfig struct {
@ -13,7 +13,7 @@ type RunConfig struct {
} }
type StepRun struct { type StepRun struct {
Config *RunConfig Config *RunConfig
SetOrder bool SetOrder bool
} }
@ -41,7 +41,7 @@ func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.Ste
ui.Say("Power on VM...") ui.Say("Power on VM...")
err := vm.PowerOn() err := vm.PowerOn()
if err != nil { if err != nil {
state.Put("error",err) state.Put("error", err)
return multistep.ActionHalt return multistep.ActionHalt
} }

View File

@ -1,21 +1,21 @@
package common package common
import ( import (
"bytes"
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"fmt" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"log" "log"
"time" "time"
"bytes"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context"
) )
type ShutdownConfig struct { type ShutdownConfig struct {
Command string `mapstructure:"shutdown_command"` Command string `mapstructure:"shutdown_command"`
RawTimeout string `mapstructure:"shutdown_timeout"` RawTimeout string `mapstructure:"shutdown_timeout"`
Timeout time.Duration Timeout time.Duration
} }
func (c *ShutdownConfig) Prepare() []error { func (c *ShutdownConfig) Prepare() []error {

View File

@ -1,13 +1,13 @@
package common package common
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context"
) )
type StepCreateSnapshot struct{ type StepCreateSnapshot struct {
CreateSnapshot bool CreateSnapshot bool
} }

View File

@ -1,13 +1,13 @@
package common package common
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"context"
) )
type StepConvertToTemplate struct{ type StepConvertToTemplate struct {
ConvertToTemplate bool ConvertToTemplate bool
} }

View File

@ -1,12 +1,12 @@
package common package common
import ( import (
"github.com/hashicorp/packer/helper/multistep" "context"
"fmt" "fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"time" "time"
"context"
) )
type StepWaitForIp struct{} type StepWaitForIp struct{}

View File

@ -1,14 +1,14 @@
package testing package testing
import ( import (
"fmt"
"math/rand"
"time"
"encoding/json" "encoding/json"
"fmt"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"testing"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"math/rand"
"testing"
"time"
) )
func NewVMName() string { func NewVMName() string {
@ -32,7 +32,6 @@ func RenderConfig(config map[string]interface{}) string {
return string(j) return string(j)
} }
func TestConn(t *testing.T) *driver.Driver { func TestConn(t *testing.T) *driver.Driver {
d, err := driver.NewDriver(&driver.ConnectConfig{ d, err := driver.NewDriver(&driver.ConnectConfig{
VCenterServer: "vcenter.vsphere65.test", VCenterServer: "vcenter.vsphere65.test",
@ -57,4 +56,3 @@ func GetVM(t *testing.T, d *driver.Driver, artifacts []packer.Artifact) *driver.
return vm return vm
} }

View File

@ -1,11 +1,11 @@
package driver package driver
import ( import (
"fmt"
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/soap" "github.com/vmware/govmomi/vim25/soap"
"fmt" "github.com/vmware/govmomi/vim25/types"
) )
type Datastore struct { type Datastore struct {

View File

@ -1,16 +1,16 @@
package driver package driver
import ( import (
"context"
"fmt"
"github.com/vmware/govmomi" "github.com/vmware/govmomi"
"github.com/vmware/govmomi/find" "github.com/vmware/govmomi/find"
"context"
"net/url"
"fmt"
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"time"
"github.com/vmware/govmomi/session" "github.com/vmware/govmomi/session"
"github.com/vmware/govmomi/vim25/soap"
"github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/soap"
"net/url"
"time"
) )
type Driver struct { type Driver struct {

View File

@ -2,10 +2,10 @@ package driver
import ( import (
"fmt" "fmt"
"math/rand"
"os" "os"
"testing" "testing"
"time" "time"
"math/rand"
) )
// Defines whether acceptance tests should be run // Defines whether acceptance tests should be run

View File

@ -1,10 +1,10 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo"
"fmt" "fmt"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
) )
type Folder struct { type Folder struct {

View File

@ -2,18 +2,18 @@ package driver
import ( import (
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
) )
type Host struct { type Host struct {
driver *Driver driver *Driver
host *object.HostSystem host *object.HostSystem
} }
func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host { func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host {
return &Host{ return &Host{
host: object.NewHostSystem(d.client.Client, *ref), host: object.NewHostSystem(d.client.Client, *ref),
driver: d, driver: d,
} }
} }
@ -29,7 +29,7 @@ func (d *Driver) FindHost(name string) (*Host, error) {
}, nil }, nil
} }
func (h *Host) Info(params ...string) (*mo.HostSystem, error){ func (h *Host) Info(params ...string) (*mo.HostSystem, error) {
var p []string var p []string
if len(params) == 0 { if len(params) == 0 {
p = []string{"*"} p = []string{"*"}

View File

@ -1,10 +1,10 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/mo"
"fmt" "fmt"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
) )
type ResourcePool struct { type ResourcePool struct {
@ -32,7 +32,7 @@ func (d *Driver) FindResourcePool(cluster string, host string, name string) (*Re
return nil, err return nil, err
} }
return &ResourcePool{ return &ResourcePool{
pool: p, pool: p,
driver: d, driver: d,
}, nil }, nil
} }

View File

@ -4,7 +4,7 @@ import "testing"
func TestResourcePoolAcc(t *testing.T) { func TestResourcePoolAcc(t *testing.T) {
d := newTestDriver(t) d := newTestDriver(t)
p, err := d.FindResourcePool("","esxi-1.vsphere65.test", "pool1/pool2") p, err := d.FindResourcePool("", "esxi-1.vsphere65.test", "pool1/pool2")
if err != nil { if err != nil {
t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err)
} }

View File

@ -1,14 +1,14 @@
package driver package driver
import ( import (
"context"
"errors" "errors"
"fmt" "fmt"
"github.com/vmware/govmomi/object" "github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/types"
"time"
"strings" "strings"
"context" "time"
) )
type VirtualMachine struct { type VirtualMachine struct {
@ -54,7 +54,7 @@ type CreateConfig struct {
Network string // "" for default network Network string // "" for default network
NetworkCard string // example: vmxnet3 NetworkCard string // example: vmxnet3
USBController bool USBController bool
Version uint // example: 10 Version uint // example: 10
Firmware string // efi or bios Firmware string // efi or bios
} }

View File

@ -1,8 +1,8 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/vim25/types"
"errors" "errors"
"github.com/vmware/govmomi/vim25/types"
) )
func (vm *VirtualMachine) AddSATAController() error { func (vm *VirtualMachine) AddSATAController() error {

View File

@ -1,11 +1,11 @@
package driver package driver
import ( import (
"context"
"log" "log"
"net" "net"
"testing" "testing"
"time" "time"
"context"
) )
func TestVMAcc_clone(t *testing.T) { func TestVMAcc_clone(t *testing.T) {
@ -168,7 +168,7 @@ func configureCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) {
func configureRAMReserveAllCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) { func configureRAMReserveAllCheck(t *testing.T, vm *VirtualMachine, _ *CloneConfig) {
log.Printf("[DEBUG] Configuring the vm") log.Printf("[DEBUG] Configuring the vm")
vm.Configure(&HardwareConfig{ RAMReserveAll: true }) vm.Configure(&HardwareConfig{RAMReserveAll: true})
log.Printf("[DEBUG] Running checks") log.Printf("[DEBUG] Running checks")
vmInfo, err := vm.Info("config") vmInfo, err := vm.Info("config")
@ -237,7 +237,7 @@ func startAndStopCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) {
vm.StartShutdown() vm.StartShutdown()
log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete")
vm.WaitForShutdown(context.TODO(), 1 * time.Minute) vm.WaitForShutdown(context.TODO(), 1*time.Minute)
} }
func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) { func snapshotCheck(t *testing.T, vm *VirtualMachine, config *CloneConfig) {

View File

@ -1,11 +1,11 @@
package driver package driver
import ( import (
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/mobile/event/key"
"strings" "strings"
"unicode" "unicode"
"github.com/vmware/govmomi/vim25/types"
"github.com/vmware/govmomi/vim25/methods"
"golang.org/x/mobile/event/key"
) )
type KeyInput struct { type KeyInput struct {
@ -26,9 +26,9 @@ func init() {
scancodeIndex["!@#$%^&*()"] = key.Code1 scancodeIndex["!@#$%^&*()"] = key.Code1
scancodeIndex[" "] = key.CodeSpacebar scancodeIndex[" "] = key.CodeSpacebar
scancodeIndex["-=[]\\"] = key.CodeHyphenMinus scancodeIndex["-=[]\\"] = key.CodeHyphenMinus
scancodeIndex["_+{}|" ] = key.CodeHyphenMinus scancodeIndex["_+{}|"] = key.CodeHyphenMinus
scancodeIndex[ ";'`,./" ] = key.CodeSemicolon scancodeIndex[";'`,./"] = key.CodeSemicolon
scancodeIndex[":\"~<>?" ] = key.CodeSemicolon scancodeIndex[":\"~<>?"] = key.CodeSemicolon
for chars, start := range scancodeIndex { for chars, start := range scancodeIndex {
for i, r := range chars { for i, r := range chars {

View File

@ -1,13 +1,12 @@
package main package main
import ( import (
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
"fmt" "fmt"
"context" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
) )
func main() { func main() {
d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{ d, err := driver.NewDriver(&driver.ConnectConfig{
VCenterServer: "vcenter.vsphere65.test", VCenterServer: "vcenter.vsphere65.test",
Username: "root", Username: "root",
Password: "jetbrains", Password: "jetbrains",

View File

@ -2,11 +2,11 @@ package iso
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/helper/communicator"
) )
type Builder struct { type Builder struct {
@ -63,7 +63,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Host: b.config.Host, Host: b.config.Host,
}, },
&common.StepRun{ &common.StepRun{
Config: &b.config.RunConfig, Config: &b.config.RunConfig,
SetOrder: true, SetOrder: true,
}, },
&StepBootCommand{ &StepBootCommand{

View File

@ -3,10 +3,10 @@ package iso
import ( import (
packerCommon "github.com/hashicorp/packer/common" packerCommon "github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/hashicorp/packer/helper/config"
) )
type Config struct { type Config struct {
@ -18,12 +18,12 @@ type Config struct {
common.HardwareConfig `mapstructure:",squash"` common.HardwareConfig `mapstructure:",squash"`
common.ConfigParamsConfig `mapstructure:",squash"` common.ConfigParamsConfig `mapstructure:",squash"`
CDRomConfig `mapstructure:",squash"` CDRomConfig `mapstructure:",squash"`
FloppyConfig `mapstructure:",squash"` FloppyConfig `mapstructure:",squash"`
common.RunConfig `mapstructure:",squash"` common.RunConfig `mapstructure:",squash"`
BootConfig `mapstructure:",squash"` BootConfig `mapstructure:",squash"`
Comm communicator.Config `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"`
common.ShutdownConfig `mapstructure:",squash"` common.ShutdownConfig `mapstructure:",squash"`
CreateSnapshot bool `mapstructure:"create_snapshot"` CreateSnapshot bool `mapstructure:"create_snapshot"`
ConvertToTemplate bool `mapstructure:"convert_to_template"` ConvertToTemplate bool `mapstructure:"convert_to_template"`

View File

@ -1,16 +1,16 @@
package iso package iso
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"context"
) )
type CDRomConfig struct { type CDRomConfig struct {
CdromType string `mapstructure:"cdrom_type"` CdromType string `mapstructure:"cdrom_type"`
ISOPaths []string `mapstructure:"iso_paths"` ISOPaths []string `mapstructure:"iso_paths"`
} }
type StepAddCDRom struct { type StepAddCDRom struct {
@ -20,7 +20,7 @@ type StepAddCDRom struct {
func (c *CDRomConfig) Prepare() []error { func (c *CDRomConfig) Prepare() []error {
var errs []error var errs []error
if (c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata") { if c.CdromType != "" && c.CdromType != "ide" && c.CdromType != "sata" {
errs = append(errs, fmt.Errorf("'cdrom_type' must be 'ide' or 'sata'")) errs = append(errs, fmt.Errorf("'cdrom_type' must be 'ide' or 'sata'"))
} }

View File

@ -1,11 +1,11 @@
package iso package iso
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"fmt"
"context"
) )
type FloppyConfig struct { type FloppyConfig struct {

View File

@ -1,18 +1,18 @@
package iso package iso
import ( import (
"context"
"fmt"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"fmt"
"time"
"strings"
"golang.org/x/mobile/event/key" "golang.org/x/mobile/event/key"
"unicode/utf8"
"github.com/hashicorp/packer/common"
"os"
"log" "log"
"context" "os"
"strings"
"time"
"unicode/utf8"
) )
type BootConfig struct { type BootConfig struct {

View File

@ -1,12 +1,12 @@
package iso package iso
import ( import (
"context"
"fmt" "fmt"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/common" "github.com/jetbrains-infra/packer-builder-vsphere/common"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"context"
) )
type CreateConfig struct { type CreateConfig struct {
@ -34,7 +34,7 @@ func (c *CreateConfig) Prepare() []error {
c.GuestOSType = "otherGuest" c.GuestOSType = "otherGuest"
} }
if (c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi") { if c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi" {
errs = append(errs, fmt.Errorf("'firmware' must be 'bios' or 'efi'")) errs = append(errs, fmt.Errorf("'firmware' must be 'bios' or 'efi'"))
} }

View File

@ -1,10 +1,10 @@
package iso package iso
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"context"
) )
type StepRemoveCDRom struct{} type StepRemoveCDRom struct{}

View File

@ -1,11 +1,11 @@
package iso package iso
import ( import (
"context"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
"github.com/jetbrains-infra/packer-builder-vsphere/driver" "github.com/jetbrains-infra/packer-builder-vsphere/driver"
"github.com/hashicorp/packer/helper/multistep"
"github.com/vmware/govmomi/vim25/types" "github.com/vmware/govmomi/vim25/types"
"context"
) )
type StepRemoveFloppy struct { type StepRemoveFloppy struct {