From 16658a9f47c79a07d9984a6030209725f9893a61 Mon Sep 17 00:00:00 2001 From: Sylvia Moss Date: Fri, 16 Apr 2021 17:38:02 +0200 Subject: [PATCH] Extract virtualbox plugin (#10910) --- builder/virtualbox/common/artifact_test.go | 47 --- builder/virtualbox/common/comm_config_test.go | 178 --------- builder/virtualbox/common/driver_4_2_test.go | 9 - .../virtualbox/common/export_config_test.go | 51 --- .../common/guest_additions_config_test.go | 16 - builder/virtualbox/common/hw_config_test.go | 22 -- .../virtualbox/common/output_config_test.go | 47 --- builder/virtualbox/common/run_config_test.go | 31 -- .../virtualbox/common/shutdown_config_test.go | 90 ----- builder/virtualbox/common/snapshot_test.go | 143 ------- .../common/step_attach_floppy_test.go | 79 ---- builder/virtualbox/common/step_export_test.go | 114 ------ .../common/step_http_ip_discover_test.go | 26 -- .../common/step_remove_devices_test.go | 135 ------- .../virtualbox/common/step_shutdown_test.go | 172 -------- .../common/step_suppress_messages_test.go | 52 --- builder/virtualbox/common/step_test.go | 19 - .../common/step_upload_version_test.go | 63 --- .../common/vbox_version_config_test.go | 78 ---- .../common/vboxbundle_config_test.go | 37 -- .../common/vboxmanage_config_test.go | 70 ---- .../iso/acceptance/builder_acceptance.go | 45 --- .../acceptance/test-fixtures/http/preseed.cfg | 42 -- .../test-fixtures/virtualbox-iso.txt | 43 -- builder/virtualbox/iso/builder_acc_test.go | 22 -- builder/virtualbox/iso/builder_test.go | 369 ----------------- .../virtualbox/iso/testdata/http/preseed.cfg | 42 -- builder/virtualbox/iso/testdata/minimal.json | 45 --- builder/virtualbox/ovf/config_test.go | 148 ------- builder/virtualbox/ovf/step_import_test.go | 71 ---- builder/virtualbox/ovf/step_test.go | 20 - builder/virtualbox/version/version.go | 13 - command/plugin.go | 6 - command/vendored_plugins.go | 6 + go.mod | 4 +- go.sum | 7 +- .../hashicorp/go-version/.travis.yml | 13 - .../hashicorp/go-version/CHANGELOG.md | 25 ++ .../github.com/hashicorp/go-version/README.md | 3 +- .../hashicorp/go-version/version.go | 16 +- .../packer-plugin-virtualbox/LICENSE | 373 ++++++++++++++++++ .../builder}/virtualbox/common/artifact.go | 0 .../builder}/virtualbox/common/comm.go | 0 .../builder}/virtualbox/common/comm_config.go | 0 .../builder}/virtualbox/common/driver.go | 0 .../builder}/virtualbox/common/driver_4_2.go | 0 .../builder}/virtualbox/common/driver_mock.go | 0 .../virtualbox/common/export_config.go | 0 .../common/guest_additions_config.go | 0 .../builder}/virtualbox/common/hw_config.go | 0 .../virtualbox/common/output_config.go | 0 .../builder}/virtualbox/common/run_config.go | 0 .../virtualbox/common/shutdown_config.go | 0 .../builder}/virtualbox/common/snapshot.go | 0 .../virtualbox/common/step_attach_floppy.go | 0 .../virtualbox/common/step_attach_isos.go | 0 .../virtualbox/common/step_configure_vrdp.go | 0 .../common/step_download_guest_additions.go | 0 .../builder}/virtualbox/common/step_export.go | 0 .../common/step_http_ip_discover.go | 0 .../virtualbox/common/step_port_forwarding.go | 0 .../virtualbox/common/step_remove_devices.go | 0 .../builder}/virtualbox/common/step_run.go | 0 .../virtualbox/common/step_shutdown.go | 0 .../virtualbox/common/step_ssh_key_pair.go | 0 .../common/step_suppress_messages.go | 0 .../common/step_type_boot_command.go | 0 .../common/step_upload_guest_additions.go | 0 .../virtualbox/common/step_upload_version.go | 0 .../virtualbox/common/step_vboxmanage.go | 0 .../virtualbox/common/vbox_version_config.go | 0 .../virtualbox/common/vboxbundle_config.go | 0 .../virtualbox/common/vboxmanage_config.go | 0 .../builder}/virtualbox/iso/builder.go | 2 +- .../virtualbox/iso/builder.hcl2spec.go | 0 .../virtualbox/iso/step_create_disk.go | 2 +- .../builder}/virtualbox/iso/step_create_vm.go | 2 +- .../builder}/virtualbox/ovf/builder.go | 2 +- .../builder}/virtualbox/ovf/config.go | 2 +- .../virtualbox/ovf/config.hcl2spec.go | 0 .../builder}/virtualbox/ovf/step_import.go | 2 +- .../builder}/virtualbox/vm/builder.go | 2 +- .../builder}/virtualbox/vm/config.go | 2 +- .../builder}/virtualbox/vm/config.hcl2spec.go | 0 .../virtualbox/vm/step_create_snapshot.go | 2 +- .../builder}/virtualbox/vm/step_import.go | 0 .../virtualbox/vm/step_set_snapshot.go | 2 +- vendor/modules.txt | 9 +- .../docs/builders/virtualbox/index.mdx | 37 -- .../content/docs/builders/virtualbox/iso.mdx | 279 ------------- .../content/docs/builders/virtualbox/ovf.mdx | 249 ------------ .../content/docs/builders/virtualbox/vm.mdx | 264 ------------- .../common/CommConfig-not-required.mdx | 15 - .../common/ExportConfig-not-required.mdx | 60 --- .../GuestAdditionsConfig-not-required.mdx | 34 -- .../common/HWConfig-not-required.mdx | 16 - .../common/OutputConfig-not-required.mdx | 14 - .../common/RunConfig-not-required.mdx | 19 - .../common/ShutdownConfig-not-required.mdx | 31 -- .../common/VBoxBundleConfig-not-required.mdx | 8 - .../common/VBoxManageConfig-not-required.mdx | 36 -- .../virtualbox/common/VBoxManageConfig.mdx | 9 - .../common/VBoxVersionConfig-not-required.mdx | 10 - .../virtualbox/iso/Config-not-required.mdx | 123 ------ .../virtualbox/ovf/Config-not-required.mdx | 26 -- .../virtualbox/ovf/Config-required.mdx | 27 -- .../builder/virtualbox/ovf/Config.mdx | 5 - .../virtualbox/vm/Config-not-required.mdx | 29 -- .../builder/virtualbox/vm/Config-required.mdx | 6 - .../partials/builder/virtualbox/vm/Config.mdx | 5 - .../builders/virtualbox-ssh-key-pair.mdx | 70 ---- website/data/docs-nav-data.json | 21 - website/data/docs-remote-plugins.json | 6 + 113 files changed, 451 insertions(+), 3769 deletions(-) delete mode 100644 builder/virtualbox/common/artifact_test.go delete mode 100644 builder/virtualbox/common/comm_config_test.go delete mode 100644 builder/virtualbox/common/driver_4_2_test.go delete mode 100644 builder/virtualbox/common/export_config_test.go delete mode 100644 builder/virtualbox/common/guest_additions_config_test.go delete mode 100644 builder/virtualbox/common/hw_config_test.go delete mode 100644 builder/virtualbox/common/output_config_test.go delete mode 100644 builder/virtualbox/common/run_config_test.go delete mode 100644 builder/virtualbox/common/shutdown_config_test.go delete mode 100644 builder/virtualbox/common/snapshot_test.go delete mode 100644 builder/virtualbox/common/step_attach_floppy_test.go delete mode 100644 builder/virtualbox/common/step_export_test.go delete mode 100644 builder/virtualbox/common/step_http_ip_discover_test.go delete mode 100644 builder/virtualbox/common/step_remove_devices_test.go delete mode 100644 builder/virtualbox/common/step_shutdown_test.go delete mode 100644 builder/virtualbox/common/step_suppress_messages_test.go delete mode 100644 builder/virtualbox/common/step_test.go delete mode 100644 builder/virtualbox/common/step_upload_version_test.go delete mode 100644 builder/virtualbox/common/vbox_version_config_test.go delete mode 100644 builder/virtualbox/common/vboxbundle_config_test.go delete mode 100644 builder/virtualbox/common/vboxmanage_config_test.go delete mode 100644 builder/virtualbox/iso/acceptance/builder_acceptance.go delete mode 100644 builder/virtualbox/iso/acceptance/test-fixtures/http/preseed.cfg delete mode 100644 builder/virtualbox/iso/acceptance/test-fixtures/virtualbox-iso.txt delete mode 100644 builder/virtualbox/iso/builder_acc_test.go delete mode 100644 builder/virtualbox/iso/builder_test.go delete mode 100644 builder/virtualbox/iso/testdata/http/preseed.cfg delete mode 100644 builder/virtualbox/iso/testdata/minimal.json delete mode 100644 builder/virtualbox/ovf/config_test.go delete mode 100644 builder/virtualbox/ovf/step_import_test.go delete mode 100644 builder/virtualbox/ovf/step_test.go delete mode 100644 builder/virtualbox/version/version.go delete mode 100644 vendor/github.com/hashicorp/go-version/.travis.yml create mode 100644 vendor/github.com/hashicorp/go-version/CHANGELOG.md create mode 100644 vendor/github.com/hashicorp/packer-plugin-virtualbox/LICENSE rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/artifact.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/comm.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/comm_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/driver.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/driver_4_2.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/driver_mock.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/export_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/guest_additions_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/hw_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/output_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/run_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/shutdown_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/snapshot.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_attach_floppy.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_attach_isos.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_configure_vrdp.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_download_guest_additions.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_export.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_http_ip_discover.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_port_forwarding.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_remove_devices.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_run.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_shutdown.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_ssh_key_pair.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_suppress_messages.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_type_boot_command.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_upload_guest_additions.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_upload_version.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/step_vboxmanage.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/vbox_version_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/vboxbundle_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/common/vboxmanage_config.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/iso/builder.go (99%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/iso/builder.hcl2spec.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/iso/step_create_disk.go (98%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/iso/step_create_vm.go (97%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/ovf/builder.go (98%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/ovf/config.go (98%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/ovf/config.hcl2spec.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/ovf/step_import.go (94%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/vm/builder.go (98%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/vm/config.go (99%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/vm/config.hcl2spec.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/vm/step_create_snapshot.go (96%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/vm/step_import.go (100%) rename {builder => vendor/github.com/hashicorp/packer-plugin-virtualbox/builder}/virtualbox/vm/step_set_snapshot.go (97%) delete mode 100644 website/content/docs/builders/virtualbox/index.mdx delete mode 100644 website/content/docs/builders/virtualbox/iso.mdx delete mode 100644 website/content/docs/builders/virtualbox/ovf.mdx delete mode 100644 website/content/docs/builders/virtualbox/vm.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/CommConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/ExportConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/HWConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/OutputConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/RunConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/VBoxBundleConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/VBoxManageConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/VBoxManageConfig.mdx delete mode 100644 website/content/partials/builder/virtualbox/common/VBoxVersionConfig-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/iso/Config-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/ovf/Config-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/ovf/Config-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/ovf/Config.mdx delete mode 100644 website/content/partials/builder/virtualbox/vm/Config-not-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/vm/Config-required.mdx delete mode 100644 website/content/partials/builder/virtualbox/vm/Config.mdx delete mode 100644 website/content/partials/builders/virtualbox-ssh-key-pair.mdx diff --git a/builder/virtualbox/common/artifact_test.go b/builder/virtualbox/common/artifact_test.go deleted file mode 100644 index e01726ad3..000000000 --- a/builder/virtualbox/common/artifact_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package common - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" - - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" -) - -func TestArtifact_impl(t *testing.T) { - var _ packersdk.Artifact = new(artifact) -} - -func TestNewArtifact(t *testing.T) { - td, err := ioutil.TempDir("", "packer") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.RemoveAll(td) - - err = ioutil.WriteFile(filepath.Join(td, "a"), []byte("foo"), 0644) - if err != nil { - t.Fatalf("err: %s", err) - } - - if err := os.Mkdir(filepath.Join(td, "b"), 0755); err != nil { - t.Fatalf("err: %s", err) - } - - generatedData := map[string]interface{}{"generated_data": "data"} - a, err := NewArtifact(td, generatedData) - if err != nil { - t.Fatalf("err: %s", err) - } - - if a.BuilderId() != BuilderId { - t.Fatalf("bad: %#v", a.BuilderId()) - } - if len(a.Files()) != 1 { - t.Fatalf("should length 1: %d", len(a.Files())) - } - if a.State("generated_data") != "data" { - t.Fatalf("bad: should length have generated_data: %s", a.State("generated_data")) - } -} diff --git a/builder/virtualbox/common/comm_config_test.go b/builder/virtualbox/common/comm_config_test.go deleted file mode 100644 index 4a292cfab..000000000 --- a/builder/virtualbox/common/comm_config_test.go +++ /dev/null @@ -1,178 +0,0 @@ -package common - -import ( - "io/ioutil" - "os" - "testing" - "time" - - "github.com/hashicorp/packer-plugin-sdk/communicator" - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func testCommConfig() *CommConfig { - return &CommConfig{ - Comm: communicator.Config{ - SSH: communicator.SSH{ - SSHUsername: "foo", - }, - }, - } -} - -func TestCommConfigPrepare(t *testing.T) { - c := testCommConfig() - errs := c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if c.HostPortMin != 2222 { - t.Errorf("bad min communicator host port: %d", c.HostPortMin) - } - - if c.HostPortMax != 4444 { - t.Errorf("bad max communicator host port: %d", c.HostPortMax) - } - - if c.Comm.SSHPort != 22 { - t.Errorf("bad communicator port: %d", c.Comm.SSHPort) - } -} - -func TestCommConfigPrepare_SSHHostPort(t *testing.T) { - var c *CommConfig - var errs []error - - // Bad - c = testCommConfig() - c.HostPortMin = 1000 - c.HostPortMax = 500 - errs = c.Prepare(interpolate.NewContext()) - if len(errs) == 0 { - t.Fatalf("bad: %#v", errs) - } - - // Good - c = testCommConfig() - c.HostPortMin = 50 - c.HostPortMax = 500 - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } -} - -func TestCommConfigPrepare_SSHPrivateKey(t *testing.T) { - var c *CommConfig - var errs []error - - c = testCommConfig() - c.Comm.SSHPrivateKeyFile = "" - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %#v", errs) - } - - c = testCommConfig() - c.Comm.SSHPrivateKeyFile = "/i/dont/exist" - errs = c.Prepare(interpolate.NewContext()) - if len(errs) == 0 { - t.Fatal("should have error") - } - - // Test bad contents - tf, err := ioutil.TempFile("", "packer") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.Remove(tf.Name()) - defer tf.Close() - - if _, err := tf.Write([]byte("HELLO!")); err != nil { - t.Fatalf("err: %s", err) - } - - c = testCommConfig() - c.Comm.SSHPrivateKeyFile = tf.Name() - errs = c.Prepare(interpolate.NewContext()) - if len(errs) == 0 { - t.Fatal("should have error") - } - - // Test good contents - tf.Seek(0, 0) - tf.Truncate(0) - tf.Write([]byte(testPem)) - c = testCommConfig() - c.Comm.SSHPrivateKeyFile = tf.Name() - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %#v", errs) - } -} - -func TestCommConfigPrepare_BackwardsCompatibility(t *testing.T) { - var c *CommConfig - hostPortMin := 1234 - hostPortMax := 4321 - skipNatMapping := true - sshTimeout := 2 * time.Minute - - c = testCommConfig() - c.SSHHostPortMin = hostPortMin - c.SSHHostPortMax = hostPortMax - c.SSHSkipNatMapping = skipNatMapping - c.Comm.SSHWaitTimeout = sshTimeout - - err := c.Prepare(interpolate.NewContext()) - if err != nil { - t.Fatalf("err: %s", err) - } - - if c.HostPortMin != hostPortMin { - t.Fatalf("HostPortMin should be %d for backwards compatibility, but it was %d", hostPortMin, c.HostPortMin) - } - - if c.HostPortMax != hostPortMax { - t.Fatalf("HostPortMax should be %d for backwards compatibility, but it was %d", hostPortMax, c.HostPortMax) - } - - if c.SkipNatMapping != skipNatMapping { - t.Fatalf("SkipNatMapping should be %t for backwards compatibility, but it was %t", skipNatMapping, c.SkipNatMapping) - } - - if c.Comm.SSHTimeout != sshTimeout { - t.Fatalf("SSHTimeout should be %s for backwards compatibility, but it was %s", sshTimeout.String(), c.Comm.SSHTimeout.String()) - } -} - -const testPem = ` ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAxd4iamvrwRJvtNDGQSIbNvvIQN8imXTRWlRY62EvKov60vqu -hh+rDzFYAIIzlmrJopvOe0clqmi3mIP9dtkjPFrYflq52a2CF5q+BdwsJXuRHbJW -LmStZUwW1khSz93DhvhmK50nIaczW63u4EO/jJb3xj+wxR1Nkk9bxi3DDsYFt8SN -AzYx9kjlEYQ/+sI4/ATfmdV9h78SVotjScupd9KFzzi76gWq9gwyCBLRynTUWlyD -2UOfJRkOvhN6/jKzvYfVVwjPSfA9IMuooHdScmC4F6KBKJl/zf/zETM0XyzIDNmH -uOPbCiljq2WoRM+rY6ET84EO0kVXbfx8uxUsqQIDAQABAoIBAQCkPj9TF0IagbM3 -5BSs/CKbAWS4dH/D4bPlxx4IRCNirc8GUg+MRb04Xz0tLuajdQDqeWpr6iLZ0RKV -BvreLF+TOdV7DNQ4XE4gSdJyCtCaTHeort/aordL3l0WgfI7mVk0L/yfN1PEG4YG -E9q1TYcyrB3/8d5JwIkjabxERLglCcP+geOEJp+QijbvFIaZR/n2irlKW4gSy6ko -9B0fgUnhkHysSg49ChHQBPQ+o5BbpuLrPDFMiTPTPhdfsvGGcyCGeqfBA56oHcSF -K02Fg8OM+Bd1lb48LAN9nWWY4WbwV+9bkN3Ym8hO4c3a/Dxf2N7LtAQqWZzFjvM3 -/AaDvAgBAoGBAPLD+Xn1IYQPMB2XXCXfOuJewRY7RzoVWvMffJPDfm16O7wOiW5+ -2FmvxUDayk4PZy6wQMzGeGKnhcMMZTyaq2g/QtGfrvy7q1Lw2fB1VFlVblvqhoJa -nMJojjC4zgjBkXMHsRLeTmgUKyGs+fdFbfI6uejBnnf+eMVUMIdJ+6I9AoGBANCn -kWO9640dttyXURxNJ3lBr2H3dJOkmD6XS+u+LWqCSKQe691Y/fZ/ZL0Oc4Mhy7I6 -hsy3kDQ5k2V0fkaNODQIFJvUqXw2pMewUk8hHc9403f4fe9cPrL12rQ8WlQw4yoC -v2B61vNczCCUDtGxlAaw8jzSRaSI5s6ax3K7enbdAoGBAJB1WYDfA2CoAQO6y9Sl -b07A/7kQ8SN5DbPaqrDrBdJziBQxukoMJQXJeGFNUFD/DXFU5Fp2R7C86vXT7HIR -v6m66zH+CYzOx/YE6EsUJms6UP9VIVF0Rg/RU7teXQwM01ZV32LQ8mswhTH20o/3 -uqMHmxUMEhZpUMhrfq0isyApAoGAe1UxGTXfj9AqkIVYylPIq2HqGww7+jFmVEj1 -9Wi6S6Sq72ffnzzFEPkIQL/UA4TsdHMnzsYKFPSbbXLIWUeMGyVTmTDA5c0e5XIR -lPhMOKCAzv8w4VUzMnEkTzkFY5JqFCD/ojW57KvDdNZPVB+VEcdxyAW6aKELXMAc -eHLc1nkCgYEApm/motCTPN32nINZ+Vvywbv64ZD+gtpeMNP3CLrbe1X9O+H52AXa -1jCoOldWR8i2bs2NVPcKZgdo6fFULqE4dBX7Te/uYEIuuZhYLNzRO1IKU/YaqsXG -3bfQ8hKYcSnTfE0gPtLDnqCIxTocaGLSHeG3TH9fTw+dA8FvWpUztI4= ------END RSA PRIVATE KEY----- -` diff --git a/builder/virtualbox/common/driver_4_2_test.go b/builder/virtualbox/common/driver_4_2_test.go deleted file mode 100644 index dc92ddd7c..000000000 --- a/builder/virtualbox/common/driver_4_2_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package common - -import ( - "testing" -) - -func TestVBox42Driver_impl(t *testing.T) { - var _ Driver = new(VBox42Driver) -} diff --git a/builder/virtualbox/common/export_config_test.go b/builder/virtualbox/common/export_config_test.go deleted file mode 100644 index cf6a056c6..000000000 --- a/builder/virtualbox/common/export_config_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package common - -import ( - "testing" - - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func TestExportConfigPrepare_BootWait(t *testing.T) { - var c *ExportConfig - var errs []error - - // Bad - c = new(ExportConfig) - c.Format = "illegal" - errs = c.Prepare(interpolate.NewContext()) - if len(errs) == 0 { - t.Fatalf("bad: %#v", errs) - } - - // Good - c = new(ExportConfig) - c.Format = "ova" - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } - - // Good - c = new(ExportConfig) - c.Format = "ovf" - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } -} - -func TestExportConfigPrepare_Opts(t *testing.T) { - var c *ExportConfig - var errs []error - - // Good - c = new(ExportConfig) - c.ExportOpts = []string{ - "--options", - } - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } -} diff --git a/builder/virtualbox/common/guest_additions_config_test.go b/builder/virtualbox/common/guest_additions_config_test.go deleted file mode 100644 index 900b4e83e..000000000 --- a/builder/virtualbox/common/guest_additions_config_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package common - -import ( - "testing" -) - -func TestGuestAdditionsConfigPrepare(t *testing.T) { - c := new(GuestAdditionsConfig) - var errs []error - - c.GuestAdditionsMode = "disable" - errs = c.Prepare("none") - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } -} diff --git a/builder/virtualbox/common/hw_config_test.go b/builder/virtualbox/common/hw_config_test.go deleted file mode 100644 index 5d1b15e9f..000000000 --- a/builder/virtualbox/common/hw_config_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package common - -import ( - "testing" - - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func TestHWConfigPrepare(t *testing.T) { - c := new(HWConfig) - if errs := c.Prepare(interpolate.NewContext()); len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if c.CpuCount < 1 { - t.Errorf("bad cpu count: %d", c.CpuCount) - } - - if c.MemorySize < 64 { - t.Errorf("bad memory size: %d", c.MemorySize) - } -} diff --git a/builder/virtualbox/common/output_config_test.go b/builder/virtualbox/common/output_config_test.go deleted file mode 100644 index 0e1567629..000000000 --- a/builder/virtualbox/common/output_config_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package common - -import ( - "io/ioutil" - "os" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/common" - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func TestOutputConfigPrepare(t *testing.T) { - c := new(OutputConfig) - if c.OutputDir != "" { - t.Fatalf("what: %s", c.OutputDir) - } - - pc := &common.PackerConfig{PackerBuildName: "foo"} - errs := c.Prepare(interpolate.NewContext(), pc) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if c.OutputDir == "" { - t.Fatal("should have output dir") - } -} - -func TestOutputConfigPrepare_exists(t *testing.T) { - td, err := ioutil.TempDir("", "packer") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.RemoveAll(td) - - c := new(OutputConfig) - c.OutputDir = td - - pc := &common.PackerConfig{ - PackerBuildName: "foo", - PackerForce: false, - } - errs := c.Prepare(interpolate.NewContext(), pc) - if len(errs) != 0 { - t.Fatal("should not have errors") - } -} diff --git a/builder/virtualbox/common/run_config_test.go b/builder/virtualbox/common/run_config_test.go deleted file mode 100644 index 574e59528..000000000 --- a/builder/virtualbox/common/run_config_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package common - -import ( - "testing" - - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func TestRunConfigPrepare_VRDPBindAddress(t *testing.T) { - var c *RunConfig - var errs []error - - // Test a default VRDPBindAddress - c = new(RunConfig) - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } - - if c.VRDPBindAddress != "127.0.0.1" { - t.Fatalf("bad value: %s", c.VRDPBindAddress) - } - - // Test with a good one - c = new(RunConfig) - c.VRDPBindAddress = "192.168.0.1" - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } -} diff --git a/builder/virtualbox/common/shutdown_config_test.go b/builder/virtualbox/common/shutdown_config_test.go deleted file mode 100644 index 116ff33e6..000000000 --- a/builder/virtualbox/common/shutdown_config_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package common - -import ( - "testing" - "time" - - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func testShutdownConfig() *ShutdownConfig { - return &ShutdownConfig{} -} - -func TestShutdownConfigPrepare_ShutdownCommand(t *testing.T) { - var c *ShutdownConfig - var errs []error - - c = testShutdownConfig() - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } -} - -func TestShutdownConfigPrepare_ShutdownTimeout(t *testing.T) { - var c *ShutdownConfig - var errs []error - - // Test with a good one - c = testShutdownConfig() - c.ShutdownTimeout = 5 * time.Second - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - if c.ShutdownTimeout != 5*time.Second { - t.Fatalf("bad: %s", c.ShutdownTimeout) - } -} - -func TestShutdownConfigPrepare_PostShutdownDelay(t *testing.T) { - var c *ShutdownConfig - var errs []error - - // Test with default value - c = testShutdownConfig() - c.PostShutdownDelay = 0 - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - if c.PostShutdownDelay != 2*time.Second { - t.Fatalf("bad: PostShutdownDelay should be 2 seconds but was %s", c.PostShutdownDelay) - } - - // Test with a good one - c = testShutdownConfig() - c.PostShutdownDelay = 5 * time.Millisecond - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - if c.PostShutdownDelay != 5*time.Millisecond { - t.Fatalf("bad: %s", c.PostShutdownDelay) - } -} - -func TestShutdownConfigPrepare_DisableShutdown(t *testing.T) { - var c *ShutdownConfig - var errs []error - - // Test with default value - c = testShutdownConfig() - c.DisableShutdown = false - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - // Test with a good one - c = testShutdownConfig() - c.DisableShutdown = true - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - if !c.DisableShutdown { - t.Fatalf("bad: %t", c.DisableShutdown) - } -} diff --git a/builder/virtualbox/common/snapshot_test.go b/builder/virtualbox/common/snapshot_test.go deleted file mode 100644 index 96ea6703e..000000000 --- a/builder/virtualbox/common/snapshot_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package common - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func getTestData() string { - return `SnapshotName="Imported" -SnapshotUUID="7e5b4165-91ec-4091-a74c-a5709d584530" -SnapshotName-1="Snapshot 1" -SnapshotUUID-1="5fc461ec-da7a-40a8-a168-03134d7cdf5c" -SnapshotName-1-1="Snapshot 2" -SnapshotUUID-1-1="8e12833b-c6b5-4cbd-b42b-09eff8ffc173" -SnapshotName-1-1-1="Snapshot 3" -SnapshotUUID-1-1-1="eb342b39-b4bd-47b0-afd8-dcd1cc5c5929" -SnapshotName-1-1-2="Snapshot 4" -SnapshotUUID-1-1-2="17df1668-e79a-4ed6-a86b-713913699846" -SnapshotName-1-2="Snapshot-Export" -SnapshotUUID-1-2="c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4" -CurrentSnapshotName="Snapshot-Export" -CurrentSnapshotUUID="c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4" -CurrentSnapshotNode="SnapshotName-1-2" -SnapshotName-2="Snapshot 5" -SnapshotUUID-2="85646c6a-fb86-4112-b15e-cab090670778" -SnapshotName-2-1="Snapshot 2" -SnapshotUUID-2-1="7b093686-2981-4ada-8b0f-4c03ae23cd1a" -SnapshotName-3="Snapshot 7" -SnapshotUUID-3="0d977a1f-c9ef-412c-a08d-7c0707b3b18f" -SnapshotName-3-1="Snapshot 8" -SnapshotUUID-3-1="f4ed75b3-afc1-42d4-9e02-8df6f053d07e" -SnapshotName-3-2="Snapshot 9" -SnapshotUUID-3-2="a5903505-9261-4bd3-9972-bacd0064d667"` -} - -func TestSnapshot_ParseFullTree(t *testing.T) { - rootNode, err := ParseSnapshotData(getTestData()) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - assert.Equal(t, rootNode.Name, "Imported") - assert.Equal(t, rootNode.UUID, "7e5b4165-91ec-4091-a74c-a5709d584530") - assert.Equal(t, 3, len(rootNode.Children)) - assert.Nil(t, rootNode.Parent) -} - -func TestSnapshot_FindCurrent(t *testing.T) { - rootNode, err := ParseSnapshotData(getTestData()) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - - current := rootNode.GetCurrentSnapshot() - assert.NotNil(t, current) - assert.Equal(t, current.UUID, "c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4") - assert.Equal(t, current.Name, "Snapshot-Export") - assert.NotNil(t, current.Parent) - assert.Equal(t, current.Parent.UUID, "5fc461ec-da7a-40a8-a168-03134d7cdf5c") - assert.Equal(t, current.Parent.Name, "Snapshot 1") -} - -func TestSnapshot_FindNodeByUUID(t *testing.T) { - rootNode, err := ParseSnapshotData(getTestData()) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - - node := rootNode.GetSnapshotByUUID("7b093686-2981-4ada-8b0f-4c03ae23cd1a") - assert.NotNil(t, node) - assert.Equal(t, "Snapshot 2", node.Name) - assert.Equal(t, "7b093686-2981-4ada-8b0f-4c03ae23cd1a", node.UUID) - assert.Equal(t, 0, len(node.Children)) - assert.Nil(t, rootNode.Parent) - - otherNode := rootNode.GetSnapshotByUUID("f4ed75b3-afc1-42d4-9e02-8df6f053d07e") - assert.NotNil(t, otherNode) - assert.True(t, otherNode.IsChildOf(rootNode)) - assert.False(t, node.IsChildOf(otherNode)) - assert.False(t, otherNode.IsChildOf(node)) -} - -func TestSnapshot_FindNodesByName(t *testing.T) { - rootNode, err := ParseSnapshotData(getTestData()) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - - nodes := rootNode.GetSnapshotsByName("Snapshot 2") - assert.NotNil(t, nodes) - assert.Equal(t, 2, len(nodes)) -} - -func TestSnapshot_IsChildOf(t *testing.T) { - rootNode, err := ParseSnapshotData(getTestData()) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - - child := rootNode.GetSnapshotByUUID("c857d1b8-4fd6-4044-9d2c-c6e465b3cdd4") - assert.NotNil(t, child) - assert.True(t, child.IsChildOf(rootNode)) - assert.True(t, child.IsChildOf(child.Parent)) - assert.PanicsWithValue(t, "Missing parameter value: candidate", func() { child.IsChildOf(nil) }) -} - -func TestSnapshot_SingleSnapshot(t *testing.T) { - snapData := `SnapshotName="Imported" - SnapshotUUID="7e5b4165-91ec-4091-a74c-a5709d584530"` - - rootNode, err := ParseSnapshotData(snapData) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - - assert.Equal(t, rootNode.Name, "Imported") - assert.Equal(t, rootNode.UUID, "7e5b4165-91ec-4091-a74c-a5709d584530") - assert.Equal(t, len(rootNode.Children), 0) - assert.Nil(t, rootNode.Parent) -} - -func TestSnapshot_EmptySnapshotData(t *testing.T) { - snapData := `` - - rootNode, err := ParseSnapshotData(snapData) - assert.NoError(t, err) - assert.Nil(t, rootNode) -} - -func TestSnapshot_EnsureParents(t *testing.T) { - rootNode, err := ParseSnapshotData(getTestData()) - assert.NoError(t, err) - assert.NotNil(t, rootNode) - - for _, snapshot := range rootNode.GetSnapshots() { - if snapshot == rootNode { - assert.Nil(t, snapshot.Parent) - } else { - assert.NotNil(t, snapshot.Parent) - } - } -} - -func TestSnapshot_WrongSnapshot(t *testing.T) { - rootNode, err := ParseSnapshotData(`Potato= - `) - assert.Nil(t, err) - assert.Nil(t, rootNode) -} diff --git a/builder/virtualbox/common/step_attach_floppy_test.go b/builder/virtualbox/common/step_attach_floppy_test.go deleted file mode 100644 index ffd1cb757..000000000 --- a/builder/virtualbox/common/step_attach_floppy_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package common - -import ( - "context" - "io/ioutil" - "os" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" -) - -func TestStepAttachFloppy_impl(t *testing.T) { - var _ multistep.Step = new(StepAttachFloppy) -} - -func TestStepAttachFloppy(t *testing.T) { - state := testState(t) - step := new(StepAttachFloppy) - - // Create a temporary file for our floppy file - tf, err := ioutil.TempFile("", "packer") - if err != nil { - t.Fatalf("err: %s", err) - } - tf.Close() - defer os.Remove(tf.Name()) - - state.Put("floppy_path", tf.Name()) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - if driver.RemoveFloppyControllersVM == "" { - t.Fatal("RemoveFloppyControllers was not called") - } - - if len(driver.VBoxManageCalls) != 2 { - t.Fatal("not enough calls to VBoxManage") - } - if driver.VBoxManageCalls[0][0] != "storagectl" { - t.Fatal("bad call") - } - if driver.VBoxManageCalls[1][0] != "storageattach" { - t.Fatal("bad call") - } - - // Test the cleanup - step.Cleanup(state) - if driver.VBoxManageCalls[2][0] != "storageattach" { - t.Fatal("bad call") - } -} - -func TestStepAttachFloppy_noFloppy(t *testing.T) { - state := testState(t) - step := new(StepAttachFloppy) - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - if len(driver.VBoxManageCalls) > 0 { - t.Fatal("should not call vboxmanage") - } -} diff --git a/builder/virtualbox/common/step_export_test.go b/builder/virtualbox/common/step_export_test.go deleted file mode 100644 index ab1857203..000000000 --- a/builder/virtualbox/common/step_export_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package common - -import ( - "context" - "path/filepath" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" -) - -func TestStepExport_impl(t *testing.T) { - var _ multistep.Step = new(StepExport) -} - -func TestStepExport(t *testing.T) { - state := testState(t) - step := new(StepExport) - - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test output state - if _, ok := state.GetOk("exportPath"); !ok { - t.Fatal("should set exportPath") - } - - // Test driver - if len(driver.VBoxManageCalls) != 2 { - t.Fatal("should call vboxmanage") - } - if driver.VBoxManageCalls[0][0] != "modifyvm" { - t.Fatal("bad") - } - if driver.VBoxManageCalls[1][0] != "export" { - t.Fatal("bad") - } -} - -func TestStepExport_OutputPath(t *testing.T) { - type testCase struct { - Step *StepExport - Expected string - Reason string - } - tcs := []testCase{ - { - Step: &StepExport{ - Format: "ova", - OutputDir: "output-dir", - OutputFilename: "output-filename", - }, - Expected: filepath.Join("output-dir", "output-filename.ova"), - Reason: "output_filename should not be vmName if set.", - }, - { - Step: &StepExport{ - Format: "ovf", - OutputDir: "output-dir", - OutputFilename: "", - }, - Expected: filepath.Join("output-dir", "foo.ovf"), - Reason: "output_filename should default to vmName.", - }, - } - for _, tc := range tcs { - state := testState(t) - state.Put("vmName", "foo") - - // Test the run - if action := tc.Step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - - // Test output state - path, ok := state.GetOk("exportPath") - if !ok { - t.Fatal("should set exportPath") - } - if path != tc.Expected { - t.Fatalf("Expected %s didn't match received %s: %s", tc.Expected, path, tc.Reason) - } - } -} - -func TestStepExport_SkipExport(t *testing.T) { - state := testState(t) - step := StepExport{SkipExport: true} - - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - // Test driver - if len(driver.VBoxManageCalls) != 0 { - t.Fatal("shouldn't have called vboxmanage; skip_export was set.") - } - -} diff --git a/builder/virtualbox/common/step_http_ip_discover_test.go b/builder/virtualbox/common/step_http_ip_discover_test.go deleted file mode 100644 index 97d4e8629..000000000 --- a/builder/virtualbox/common/step_http_ip_discover_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package common - -import ( - "context" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" -) - -func TestStepHTTPIPDiscover_Run(t *testing.T) { - state := new(multistep.BasicStateBag) - step := new(StepHTTPIPDiscover) - hostIp := "10.0.2.2" - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - httpIp := state.Get("http_ip").(string) - if httpIp != hostIp { - t.Fatalf("bad: Http ip is %s but was supposed to be %s", httpIp, hostIp) - } -} diff --git a/builder/virtualbox/common/step_remove_devices_test.go b/builder/virtualbox/common/step_remove_devices_test.go deleted file mode 100644 index 6db937aab..000000000 --- a/builder/virtualbox/common/step_remove_devices_test.go +++ /dev/null @@ -1,135 +0,0 @@ -package common - -import ( - "context" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" -) - -func TestStepRemoveDevices_impl(t *testing.T) { - var _ multistep.Step = new(StepRemoveDevices) -} - -func TestStepRemoveDevices(t *testing.T) { - state := testState(t) - step := new(StepRemoveDevices) - - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that ISO was removed - if len(driver.VBoxManageCalls) != 0 { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } -} - -func TestStepRemoveDevices_attachedIso(t *testing.T) { - state := testState(t) - step := new(StepRemoveDevices) - - diskUnmountCommands := map[string][]string{ - "boot_iso": []string{ - "storageattach", "myvm", - "--storagectl", "IDE Controller", - "--port", "0", - "--device", "1", - "--type", "dvddrive", - "--medium", "none", - }, - } - state.Put("disk_unmount_commands", diskUnmountCommands) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that ISO was removed - if len(driver.VBoxManageCalls) != 1 { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } - if driver.VBoxManageCalls[0][3] != "IDE Controller" { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } -} - -func TestStepRemoveDevices_attachedIsoOnSata(t *testing.T) { - state := testState(t) - step := new(StepRemoveDevices) - - diskUnmountCommands := map[string][]string{ - "boot_iso": []string{ - "storageattach", "myvm", - "--storagectl", "SATA Controller", - "--port", "0", - "--device", "1", - "--type", "dvddrive", - "--medium", "none", - }, - } - state.Put("disk_unmount_commands", diskUnmountCommands) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that ISO was removed - if len(driver.VBoxManageCalls) != 1 { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } - if driver.VBoxManageCalls[0][3] != "SATA Controller" { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } -} - -func TestStepRemoveDevices_floppyPath(t *testing.T) { - state := testState(t) - step := new(StepRemoveDevices) - - state.Put("floppy_path", "foo") - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that both were removed - if len(driver.VBoxManageCalls) != 2 { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } - if driver.VBoxManageCalls[0][3] != "Floppy Controller" { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } - if driver.VBoxManageCalls[1][3] != "Floppy Controller" { - t.Fatalf("bad: %#v", driver.VBoxManageCalls) - } -} diff --git a/builder/virtualbox/common/step_shutdown_test.go b/builder/virtualbox/common/step_shutdown_test.go deleted file mode 100644 index ed3eecea1..000000000 --- a/builder/virtualbox/common/step_shutdown_test.go +++ /dev/null @@ -1,172 +0,0 @@ -package common - -import ( - "context" - "testing" - "time" - - "github.com/hashicorp/packer-plugin-sdk/multistep" - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" -) - -func TestStepShutdown_impl(t *testing.T) { - var _ multistep.Step = new(StepShutdown) -} - -func TestStepShutdown_noShutdownCommand(t *testing.T) { - state := testState(t) - step := new(StepShutdown) - step.DisableShutdown = false - step.ACPIShutdown = false - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that Stop was just called - if driver.StopName != "foo" { - t.Fatal("should call stop") - } - if comm.StartCalled { - t.Fatal("comm start should not be called") - } -} - -func TestStepShutdown_shutdownCommand(t *testing.T) { - state := testState(t) - step := new(StepShutdown) - step.Command = "poweroff" - step.Timeout = 1 * time.Second - step.DisableShutdown = false - step.ACPIShutdown = false - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - driver.IsRunningReturn = true - - go func() { - time.Sleep(10 * time.Millisecond) - driver.Lock() - defer driver.Unlock() - driver.IsRunningReturn = false - }() - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that Stop was just called - if driver.StopName != "" { - t.Fatal("should not call stop") - } - if comm.StartCmd.Command != step.Command { - t.Fatal("comm start should be called") - } -} - -func TestStepShutdown_shutdownTimeout(t *testing.T) { - state := testState(t) - step := new(StepShutdown) - step.Command = "poweroff" - step.Timeout = 1 * time.Second - step.DisableShutdown = false - step.ACPIShutdown = false - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - driver.IsRunningReturn = true - - go func() { - time.Sleep(2 * time.Second) - driver.Lock() - defer driver.Unlock() - driver.IsRunningReturn = false - }() - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionHalt { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); !ok { - t.Fatal("should have error") - } -} - -func TestStepShutdown_DisableShutdown(t *testing.T) { - state := testState(t) - step := new(StepShutdown) - step.DisableShutdown = true - step.ACPIShutdown = false - step.Timeout = 2 * time.Second - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - driver.IsRunningReturn = true - - go func() { - time.Sleep(1 * time.Second) - driver.Lock() - defer driver.Unlock() - driver.IsRunningReturn = false - }() - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } -} - -func TestStepShutdown_ACPIShutdown(t *testing.T) { - state := testState(t) - step := new(StepShutdown) - step.ACPIShutdown = true - step.Timeout = 2 * time.Second - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - state.Put("vmName", "foo") - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test that Stop was just called - if driver.StopViaACPIName != "foo" { - t.Fatal("should call stop via ACPI") - } - if comm.StartCalled { - t.Fatal("comm start should not be called") - } -} diff --git a/builder/virtualbox/common/step_suppress_messages_test.go b/builder/virtualbox/common/step_suppress_messages_test.go deleted file mode 100644 index 1af0eb10d..000000000 --- a/builder/virtualbox/common/step_suppress_messages_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package common - -import ( - "context" - "errors" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" -) - -func TestStepSuppressMessages_impl(t *testing.T) { - var _ multistep.Step = new(StepSuppressMessages) -} - -func TestStepSuppressMessages(t *testing.T) { - state := testState(t) - step := new(StepSuppressMessages) - - driver := state.Get("driver").(*DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - if !driver.SuppressMessagesCalled { - t.Fatal("should call suppressmessages") - } -} - -func TestStepSuppressMessages_error(t *testing.T) { - state := testState(t) - step := new(StepSuppressMessages) - - driver := state.Get("driver").(*DriverMock) - driver.SuppressMessagesErr = errors.New("foo") - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionHalt { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); !ok { - t.Fatal("should have error") - } - - if !driver.SuppressMessagesCalled { - t.Fatal("should call suppressmessages") - } -} diff --git a/builder/virtualbox/common/step_test.go b/builder/virtualbox/common/step_test.go deleted file mode 100644 index 52ddc3285..000000000 --- a/builder/virtualbox/common/step_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package common - -import ( - "bytes" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" -) - -func testState(t *testing.T) multistep.StateBag { - state := new(multistep.BasicStateBag) - state.Put("driver", new(DriverMock)) - state.Put("ui", &packersdk.BasicUi{ - Reader: new(bytes.Buffer), - Writer: new(bytes.Buffer), - }) - return state -} diff --git a/builder/virtualbox/common/step_upload_version_test.go b/builder/virtualbox/common/step_upload_version_test.go deleted file mode 100644 index c97f22fda..000000000 --- a/builder/virtualbox/common/step_upload_version_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package common - -import ( - "context" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" -) - -func TestStepUploadVersion_impl(t *testing.T) { - var _ multistep.Step = new(StepUploadVersion) -} - -func TestStepUploadVersion(t *testing.T) { - state := testState(t) - step := new(StepUploadVersion) - step.Path = "foopath" - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - - driver := state.Get("driver").(*DriverMock) - driver.VersionResult = "foo" - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Verify - if comm.UploadPath != "foopath" { - t.Fatalf("bad: %#v", comm.UploadPath) - } - if comm.UploadData != "foo" { - t.Fatalf("upload data bad: %#v", comm.UploadData) - } -} - -func TestStepUploadVersion_noPath(t *testing.T) { - state := testState(t) - step := new(StepUploadVersion) - step.Path = "" - - comm := new(packersdk.MockCommunicator) - state.Put("communicator", comm) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Verify - if comm.UploadCalled { - t.Fatal("bad") - } -} diff --git a/builder/virtualbox/common/vbox_version_config_test.go b/builder/virtualbox/common/vbox_version_config_test.go deleted file mode 100644 index 3f2e8fefb..000000000 --- a/builder/virtualbox/common/vbox_version_config_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package common - -import ( - "testing" -) - -func TestVBoxVersionConfigPrepare_BootWait(t *testing.T) { - var c *VBoxVersionConfig - var errs []error - - // Test empty - c = new(VBoxVersionConfig) - errs = c.Prepare("ssh") - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } - - if *c.VBoxVersionFile != ".vbox_version" { - t.Fatalf("bad value: %s", *c.VBoxVersionFile) - } - - // Test with a good one - c = new(VBoxVersionConfig) - filename := "foo" - c.VBoxVersionFile = &filename - errs = c.Prepare("ssh") - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } - - if *c.VBoxVersionFile != "foo" { - t.Fatalf("bad value: %s", *c.VBoxVersionFile) - } -} - -func TestVBoxVersionConfigPrepare_empty(t *testing.T) { - var c *VBoxVersionConfig - var errs []error - - // Test with nil value - c = new(VBoxVersionConfig) - c.VBoxVersionFile = nil - errs = c.Prepare("ssh") - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } - - if *c.VBoxVersionFile != ".vbox_version" { - t.Fatalf("bad value: %s", *c.VBoxVersionFile) - } - - // Test with empty name - c = new(VBoxVersionConfig) - filename := "" - c.VBoxVersionFile = &filename - errs = c.Prepare("ssh") - if len(errs) > 0 { - t.Fatalf("should not have error: %s", errs) - } - - if *c.VBoxVersionFile != "" { - t.Fatalf("bad value: %s", *c.VBoxVersionFile) - } -} - -func TestVBoxVersionConfigPrepare_communicator(t *testing.T) { - var c *VBoxVersionConfig - var errs []error - - // Test with 'none' communicator and non-empty virtualbox_version_file - c = new(VBoxVersionConfig) - filename := "test" - c.VBoxVersionFile = &filename - errs = c.Prepare("none") - if len(errs) == 0 { - t.Fatalf("should have an error") - } -} diff --git a/builder/virtualbox/common/vboxbundle_config_test.go b/builder/virtualbox/common/vboxbundle_config_test.go deleted file mode 100644 index df2d75716..000000000 --- a/builder/virtualbox/common/vboxbundle_config_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package common - -import ( - "reflect" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func TestVBoxBundleConfigPrepare_VBoxBundle(t *testing.T) { - // Test with empty - c := new(VBoxBundleConfig) - errs := c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if !reflect.DeepEqual(*c, VBoxBundleConfig{BundleISO: false}) { - t.Fatalf("bad: %#v", c) - } - - // Test with a good one - c = new(VBoxBundleConfig) - c.BundleISO = true - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - expected := VBoxBundleConfig{ - BundleISO: true, - } - - if !reflect.DeepEqual(*c, expected) { - t.Fatalf("bad: %#v", c) - } -} diff --git a/builder/virtualbox/common/vboxmanage_config_test.go b/builder/virtualbox/common/vboxmanage_config_test.go deleted file mode 100644 index 0a557aa24..000000000 --- a/builder/virtualbox/common/vboxmanage_config_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package common - -import ( - "reflect" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" -) - -func TestVBoxManageConfigPrepare_VBoxManage(t *testing.T) { - // Test with empty - c := new(VBoxManageConfig) - errs := c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if !reflect.DeepEqual(c.VBoxManage, [][]string{}) { - t.Fatalf("bad: %#v", c.VBoxManage) - } - - // Test with a good one - c = new(VBoxManageConfig) - c.VBoxManage = [][]string{ - {"foo", "bar", "baz"}, - } - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - expected := [][]string{ - {"foo", "bar", "baz"}, - } - - if !reflect.DeepEqual(c.VBoxManage, expected) { - t.Fatalf("bad: %#v", c.VBoxManage) - } -} - -func TestVBoxManageConfigPrepare_PostVBoxManage(t *testing.T) { - // Test with empty - c := new(VBoxManageConfig) - errs := c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - if !reflect.DeepEqual(c.VBoxManagePost, [][]string{}) { - t.Fatalf("bad: %#v", c.VBoxManagePost) - } - - // Test with a good one - c = new(VBoxManageConfig) - c.VBoxManagePost = [][]string{ - {"foo", "bar", "baz"}, - } - errs = c.Prepare(interpolate.NewContext()) - if len(errs) > 0 { - t.Fatalf("err: %#v", errs) - } - - expected := [][]string{ - {"foo", "bar", "baz"}, - } - - if !reflect.DeepEqual(c.VBoxManagePost, expected) { - t.Fatalf("bad: %#v", c.VBoxManagePost) - } -} diff --git a/builder/virtualbox/iso/acceptance/builder_acceptance.go b/builder/virtualbox/iso/acceptance/builder_acceptance.go deleted file mode 100644 index c27555802..000000000 --- a/builder/virtualbox/iso/acceptance/builder_acceptance.go +++ /dev/null @@ -1,45 +0,0 @@ -package virtualbox_acc - -// This is the code necessary for running the provisioner acceptance tests. -// It provides the builder config and cleans up created resource. - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - - "github.com/hashicorp/packer/builder/virtualbox/iso" - - "github.com/hashicorp/packer-plugin-sdk/acctest/testutils" - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" -) - -type VirtualBoxISOAccTest struct{} - -func (v *VirtualBoxISOAccTest) GetConfigs() (map[string]string, error) { - filePath := filepath.Join("../../builder/virtualbox/iso/acceptance/test-fixtures/", "virtualbox-iso.txt") - config, err := os.Open(filePath) - if err != nil { - return nil, fmt.Errorf("Expected to find %s", filePath) - } - defer config.Close() - - file, err := ioutil.ReadAll(config) - if err != nil { - return nil, fmt.Errorf("Unable to read %s", filePath) - } - return map[string]string{"linux": string(file)}, nil -} - -func (v *VirtualBoxISOAccTest) CleanUp() error { - testutils.CleanupFiles("virtualbox-iso-packer-acc-test") - testutils.CleanupFiles("packer_cache") - return nil -} - -func (v *VirtualBoxISOAccTest) GetBuilderStore() packersdk.MapOfBuilder { - return packersdk.MapOfBuilder{ - "virtualbox-iso": func() (packersdk.Builder, error) { return &iso.Builder{}, nil }, - } -} diff --git a/builder/virtualbox/iso/acceptance/test-fixtures/http/preseed.cfg b/builder/virtualbox/iso/acceptance/test-fixtures/http/preseed.cfg deleted file mode 100644 index 57885df31..000000000 --- a/builder/virtualbox/iso/acceptance/test-fixtures/http/preseed.cfg +++ /dev/null @@ -1,42 +0,0 @@ -# Preseeding only locale sets language, country and locale. -d-i debian-installer/locale string en_US - -# Keyboard selection. -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/xkb-keymap select us - -choose-mirror-bin mirror/http/proxy string -d-i base-installer/kernel/override-image string linux-server -d-i clock-setup/utc boolean true -d-i clock-setup/utc-auto boolean true -d-i finish-install/reboot_in_progress note -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true -d-i mirror/country string manual -d-i mirror/http/directory string /ubuntu/ -d-i mirror/http/hostname string archive.ubuntu.com -d-i mirror/http/proxy string -d-i partman-auto-lvm/guided_size string max -d-i partman-auto/choose_recipe select atomic -d-i partman-auto/method string lvm -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-lvm/device_remove_lvm boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true -d-i partman/confirm_write_new_label boolean true -d-i passwd/user-fullname string vagrant -d-i passwd/user-uid string 1000 -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -d-i passwd/username string vagrant -d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-kernel-server nfs-common linux-headers-$(uname -r) perl -d-i pkgsel/install-language-support boolean false -d-i pkgsel/update-policy select none -d-i pkgsel/upgrade select full-upgrade -d-i time/zone string UTC -d-i user-setup/allow-password-weak boolean true -d-i user-setup/encrypt-home boolean false -tasksel tasksel/first multiselect standard, server diff --git a/builder/virtualbox/iso/acceptance/test-fixtures/virtualbox-iso.txt b/builder/virtualbox/iso/acceptance/test-fixtures/virtualbox-iso.txt deleted file mode 100644 index ba41daa0e..000000000 --- a/builder/virtualbox/iso/acceptance/test-fixtures/virtualbox-iso.txt +++ /dev/null @@ -1,43 +0,0 @@ -{ - "type": "virtualbox-iso", - "iso_checksum": "sha256:946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2", - "iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso", - "disk_size": "40960", - "guest_os_type": "Ubuntu_64", - "headless" : "true", - - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "ssh_wait_timeout": "10000s", - - "http_directory": "../../builder/virtualbox/iso/acceptance/test-fixtures/http", - "boot_wait": "10s", - "boot_command": [ - "", - "", - "", - "/install/vmlinuz", - " auto", - " console-setup/ask_detect=false", - " console-setup/layoutcode=us", - " console-setup/modelcode=pc105", - " debconf/frontend=noninteractive", - " debian-installer=en_US.UTF-8", - " fb=false", - " initrd=/install/initrd.gz", - " kbd-chooser/method=us", - " keyboard-configuration/layout=USA", - " keyboard-configuration/variant=USA", - " locale=en_US.UTF-8", - " netcfg/get_domain=vm", - " netcfg/get_hostname=vagrant", - " noapic", - " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", - " -- ", - "" - ], - - "output_directory": "virtualbox-iso-packer-acc-test", - "shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now", - "post_shutdown_delay": "60s" -} \ No newline at end of file diff --git a/builder/virtualbox/iso/builder_acc_test.go b/builder/virtualbox/iso/builder_acc_test.go deleted file mode 100644 index 61c163d58..000000000 --- a/builder/virtualbox/iso/builder_acc_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package iso - -import ( - "io/ioutil" - "path/filepath" - "testing" - - builderT "github.com/hashicorp/packer/acctest" -) - -func TestBuilderAcc_basic(t *testing.T) { - templatePath := filepath.Join("testdata", "minimal.json") - bytes, err := ioutil.ReadFile(templatePath) - if err != nil { - t.Fatalf("failed to load template file %s", templatePath) - } - - builderT.Test(t, builderT.TestCase{ - Builder: &Builder{}, - Template: string(bytes), - }) -} diff --git a/builder/virtualbox/iso/builder_test.go b/builder/virtualbox/iso/builder_test.go deleted file mode 100644 index f5be5225a..000000000 --- a/builder/virtualbox/iso/builder_test.go +++ /dev/null @@ -1,369 +0,0 @@ -package iso - -import ( - "fmt" - "reflect" - "testing" - - packercommon "github.com/hashicorp/packer-plugin-sdk/common" - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - "github.com/hashicorp/packer/builder/virtualbox/common" -) - -func testConfig() map[string]interface{} { - return map[string]interface{}{ - "iso_checksum": "md5:0B0F137F17AC10944716020B018F8126", - "iso_url": "http://www.google.com/", - "shutdown_command": "yes", - "ssh_username": "foo", - - packercommon.BuildNameConfigKey: "foo", - } -} - -func TestBuilder_ImplementsBuilder(t *testing.T) { - var raw interface{} - raw = &Builder{} - if _, ok := raw.(packersdk.Builder); !ok { - t.Error("Builder must implement builder.") - } -} - -func TestBuilderPrepare_Defaults(t *testing.T) { - var b Builder - config := testConfig() - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } - - if b.config.GuestAdditionsMode != common.GuestAdditionsModeUpload { - t.Errorf("bad guest additions mode: %s", b.config.GuestAdditionsMode) - } - - if b.config.GuestOSType != "Other" { - t.Errorf("bad guest OS type: %s", b.config.GuestOSType) - } - - if b.config.VMName == "" { - t.Errorf("bad vm name: %s", b.config.VMName) - } - - if b.config.Format != "ovf" { - t.Errorf("bad format: %s", b.config.Format) - } -} - -func TestBuilderPrepare_DiskSize(t *testing.T) { - var b Builder - config := testConfig() - - delete(config, "disk_size") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad err: %s", err) - } - - if b.config.DiskSize != 40000 { - t.Fatalf("bad size: %d", b.config.DiskSize) - } - - config["disk_size"] = 60000 - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } - - if b.config.DiskSize != 60000 { - t.Fatalf("bad size: %d", b.config.DiskSize) - } -} - -func TestBuilderPrepare_FloppyFiles(t *testing.T) { - var b Builder - config := testConfig() - - delete(config, "floppy_files") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad err: %s", err) - } - - if len(b.config.FloppyFiles) != 0 { - t.Fatalf("bad: %#v", b.config.FloppyFiles) - } - - floppies_path := "../../test-fixtures/floppies" - config["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } - - expected := []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} - if !reflect.DeepEqual(b.config.FloppyFiles, expected) { - t.Fatalf("bad: %#v", b.config.FloppyFiles) - } -} - -func TestBuilderPrepare_InvalidFloppies(t *testing.T) { - var b Builder - config := testConfig() - config["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"} - b = Builder{} - _, _, errs := b.Prepare(config) - if errs == nil { - t.Fatalf("Nonexistent floppies should trigger multierror") - } - - if len(errs.(*packersdk.MultiError).Errors) != 2 { - t.Fatalf("Multierror should work and report 2 errors") - } -} - -func TestBuilderPrepare_GuestAdditionsMode(t *testing.T) { - var b Builder - config := testConfig() - - // test default mode - delete(config, "guest_additions_mode") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad err: %s", err) - } - - // Test another mode - config["guest_additions_mode"] = "attach" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } - - if b.config.GuestAdditionsMode != common.GuestAdditionsModeAttach { - t.Fatalf("bad: %s", b.config.GuestAdditionsMode) - } - - // Test bad mode - config["guest_additions_mode"] = "teleport" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err == nil { - t.Fatal("should error") - } -} - -func TestBuilderPrepare_GuestAdditionsPath(t *testing.T) { - var b Builder - config := testConfig() - - delete(config, "guest_additions_path") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad err: %s", err) - } - - if b.config.GuestAdditionsPath != "VBoxGuestAdditions.iso" { - t.Fatalf("bad: %s", b.config.GuestAdditionsPath) - } - - config["guest_additions_path"] = "foo" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } - - if b.config.GuestAdditionsPath != "foo" { - t.Fatalf("bad size: %s", b.config.GuestAdditionsPath) - } -} - -func TestBuilderPrepare_GuestAdditionsSHA256(t *testing.T) { - var b Builder - config := testConfig() - - delete(config, "guest_additions_sha256") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad err: %s", err) - } - - if b.config.GuestAdditionsSHA256 != "" { - t.Fatalf("bad: %s", b.config.GuestAdditionsSHA256) - } - - config["guest_additions_sha256"] = "FOO" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } - - if b.config.GuestAdditionsSHA256 != "foo" { - t.Fatalf("bad size: %s", b.config.GuestAdditionsSHA256) - } -} - -func TestBuilderPrepare_GuestAdditionsURL(t *testing.T) { - var b Builder - config := testConfig() - - config["guest_additions_url"] = "" - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("err: %s", err) - } - - if b.config.GuestAdditionsURL != "" { - t.Fatalf("should be empty: %s", b.config.GuestAdditionsURL) - } - - config["guest_additions_url"] = "http://www.packer.io" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Errorf("should not have error: %s", err) - } -} - -func TestBuilderPrepare_HardDriveInterface(t *testing.T) { - var b Builder - config := testConfig() - - // Test a default boot_wait - delete(config, "hard_drive_interface") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("err: %s", err) - } - - if b.config.HardDriveInterface != "ide" { - t.Fatalf("bad: %s", b.config.HardDriveInterface) - } - - // Test with a bad - config["hard_drive_interface"] = "fake" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err == nil { - t.Fatal("should have error") - } - - // Test with a good - config["hard_drive_interface"] = "sata" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } -} - -func TestBuilderPrepare_InvalidKey(t *testing.T) { - var b Builder - config := testConfig() - - // Add a random key - config["i_should_not_be_valid"] = true - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err == nil { - t.Fatal("should have error") - } -} - -func TestBuilderPrepare_ISOInterface(t *testing.T) { - var b Builder - config := testConfig() - - // Test a default boot_wait - delete(config, "iso_interface") - _, warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("err: %s", err) - } - - if b.config.ISOInterface != "ide" { - t.Fatalf("bad: %s", b.config.ISOInterface) - } - - // Test with a bad - config["iso_interface"] = "fake" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err == nil { - t.Fatal("should have error") - } - - // Test with a good - config["iso_interface"] = "sata" - b = Builder{} - _, warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("should not have error: %s", err) - } -} diff --git a/builder/virtualbox/iso/testdata/http/preseed.cfg b/builder/virtualbox/iso/testdata/http/preseed.cfg deleted file mode 100644 index 57885df31..000000000 --- a/builder/virtualbox/iso/testdata/http/preseed.cfg +++ /dev/null @@ -1,42 +0,0 @@ -# Preseeding only locale sets language, country and locale. -d-i debian-installer/locale string en_US - -# Keyboard selection. -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/xkb-keymap select us - -choose-mirror-bin mirror/http/proxy string -d-i base-installer/kernel/override-image string linux-server -d-i clock-setup/utc boolean true -d-i clock-setup/utc-auto boolean true -d-i finish-install/reboot_in_progress note -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true -d-i mirror/country string manual -d-i mirror/http/directory string /ubuntu/ -d-i mirror/http/hostname string archive.ubuntu.com -d-i mirror/http/proxy string -d-i partman-auto-lvm/guided_size string max -d-i partman-auto/choose_recipe select atomic -d-i partman-auto/method string lvm -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-lvm/device_remove_lvm boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true -d-i partman/confirm_write_new_label boolean true -d-i passwd/user-fullname string vagrant -d-i passwd/user-uid string 1000 -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -d-i passwd/username string vagrant -d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-kernel-server nfs-common linux-headers-$(uname -r) perl -d-i pkgsel/install-language-support boolean false -d-i pkgsel/update-policy select none -d-i pkgsel/upgrade select full-upgrade -d-i time/zone string UTC -d-i user-setup/allow-password-weak boolean true -d-i user-setup/encrypt-home boolean false -tasksel tasksel/first multiselect standard, server diff --git a/builder/virtualbox/iso/testdata/minimal.json b/builder/virtualbox/iso/testdata/minimal.json deleted file mode 100644 index 46a6f2dd6..000000000 --- a/builder/virtualbox/iso/testdata/minimal.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "builders": [ - { - "type": "test", - "iso_checksum": "sha256:946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2", - "iso_url": "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso", - "disk_size": "40960", - "guest_os_type": "Ubuntu_64", - - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "ssh_wait_timeout": "10000s", - - "http_directory": "./testdata/http", - "boot_wait": "10s", - "boot_command": [ - "", - "", - "", - "/install/vmlinuz", - " auto", - " console-setup/ask_detect=false", - " console-setup/layoutcode=us", - " console-setup/modelcode=pc105", - " debconf/frontend=noninteractive", - " debian-installer=en_US.UTF-8", - " fb=false", - " initrd=/install/initrd.gz", - " kbd-chooser/method=us", - " keyboard-configuration/layout=USA", - " keyboard-configuration/variant=USA", - " locale=en_US.UTF-8", - " netcfg/get_domain=vm", - " netcfg/get_hostname=vagrant", - " noapic", - " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", - " -- ", - "" - ], - - "shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now", - "post_shutdown_delay": "60s" - } - ] -} diff --git a/builder/virtualbox/ovf/config_test.go b/builder/virtualbox/ovf/config_test.go deleted file mode 100644 index 18d134259..000000000 --- a/builder/virtualbox/ovf/config_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package ovf - -import ( - "fmt" - "io/ioutil" - "os" - "testing" - - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" -) - -func testConfig(t *testing.T) map[string]interface{} { - return map[string]interface{}{ - "ssh_username": "foo", - "shutdown_command": "foo", - "source_path": "config_test.go", - } -} - -func getTempFile(t *testing.T) *os.File { - tf, err := ioutil.TempFile("", "packer") - if err != nil { - t.Fatalf("err: %s", err) - } - tf.Close() - - // don't forget to cleanup the file downstream: - // defer os.Remove(tf.Name()) - - return tf -} - -func TestNewConfig_FloppyFiles(t *testing.T) { - cfg := testConfig(t) - floppies_path := "../../test-fixtures/floppies" - cfg["floppy_files"] = []string{fmt.Sprintf("%s/bar.bat", floppies_path), fmt.Sprintf("%s/foo.ps1", floppies_path)} - var c Config - _, err := c.Prepare(cfg) - if err != nil { - t.Fatalf("should not have error: %s", err) - } -} - -func TestNewConfig_InvalidFloppies(t *testing.T) { - cfg := testConfig(t) - cfg["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"} - var c Config - _, errs := c.Prepare(cfg) - if errs == nil { - t.Fatalf("Nonexistent floppies should trigger multierror") - } - - if len(errs.(*packersdk.MultiError).Errors) != 2 { - t.Fatalf("Multierror should work and report 2 errors") - } -} - -func TestNewConfig_sourcePath(t *testing.T) { - // Okay, because it gets caught during download - cfg := testConfig(t) - delete(cfg, "source_path") - var c Config - warns, err := c.Prepare(cfg) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err == nil { - t.Fatalf("should error with empty `source_path`") - } - - // Good - tf := getTempFile(t) - defer os.Remove(tf.Name()) - - cfg = testConfig(t) - cfg["source_path"] = tf.Name() - warns, err = c.Prepare(cfg) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad: %s", err) - } -} - -func TestNewConfig_shutdown_timeout(t *testing.T) { - cfg := testConfig(t) - tf := getTempFile(t) - defer os.Remove(tf.Name()) - - // Expect this to fail - cfg["source_path"] = tf.Name() - cfg["shutdown_timeout"] = "NaN" - var c Config - warns, err := c.Prepare(cfg) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err == nil { - t.Fatal("should error") - } - - // Passes when given a valid time duration - cfg["shutdown_timeout"] = "10s" - warns, err = c.Prepare(cfg) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("bad: %s", err) - } -} - -// TestChecksumFileNameMixedCaseBug reproduces Github issue #9049: -// https://github.com/hashicorp/packer/issues/9049 -func TestChecksumFileNameMixedCaseBug(t *testing.T) { - tt := []struct { - Name string - ChecksumPath string - }{ - {"Lowercase", "file:/tmp/random/file.md5"}, - {"MiXeDcAsE", "file:/tmp/RaNdOm/FiLe.Md5"}, - } - - for _, tc := range tt { - - cfg := testConfig(t) - cfg["source_path"] = "bug.ovf" - cfg["checksum"] = tc.ChecksumPath - cfg["type"] = "virtualbox-ovf" - cfg["guest_additions_mode"] = "disable" - cfg["headless"] = false - - var c Config - warns, err := c.Prepare(cfg) - if err != nil { - t.Errorf("config failed to Prepare, %s", err.Error()) - } - - if len(warns) != 0 { - t.Errorf("Encountered warnings during config preparation: %s", warns) - } - - if c.Checksum != tc.ChecksumPath { - t.Errorf("%s test failed, Checksum and ChecksumPath are expected to be equal, expected: %s, got: %s", tc.Name, tc.ChecksumPath, c.Checksum) - } - } -} diff --git a/builder/virtualbox/ovf/step_import_test.go b/builder/virtualbox/ovf/step_import_test.go deleted file mode 100644 index ee16ad634..000000000 --- a/builder/virtualbox/ovf/step_import_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package ovf - -import ( - "context" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" -) - -func TestStepImport_impl(t *testing.T) { - var _ multistep.Step = new(StepImport) -} - -func TestStepImport(t *testing.T) { - state := testState(t) - state.Put("vm_path", "foo") - - step := new(StepImport) - step.Name = "bar" - - driver := state.Get("driver").(*vboxcommon.DriverMock) - - // Test the run - if action := step.Run(context.Background(), state); action != multistep.ActionContinue { - t.Fatalf("bad action: %#v", action) - } - if _, ok := state.GetOk("error"); ok { - t.Fatal("should NOT have error") - } - - // Test driver - if !driver.ImportCalled { - t.Fatal("import should be called") - } - if driver.ImportName != step.Name { - t.Fatalf("bad: %#v", driver.ImportName) - } - - // Test output state - if name, ok := state.GetOk("vmName"); !ok { - t.Fatal("vmName should be set") - } else if name != "bar" { - t.Fatalf("bad: %#v", name) - } -} - -func TestStepImport_Cleanup(t *testing.T) { - state := testState(t) - state.Put("vm_path", "foo") - - step := new(StepImport) - step.vmName = "bar" - - driver := state.Get("driver").(*vboxcommon.DriverMock) - - step.KeepRegistered = true - step.Cleanup(state) - if driver.DeleteCalled { - t.Fatal("delete should not be called") - } - - state.Put(multistep.StateHalted, true) - step.Cleanup(state) - if !driver.DeleteCalled { - t.Fatal("delete should be called") - } - if driver.DeleteName != "bar" { - t.Fatalf("bad: %#v", driver.DeleteName) - } -} diff --git a/builder/virtualbox/ovf/step_test.go b/builder/virtualbox/ovf/step_test.go deleted file mode 100644 index c32256c3b..000000000 --- a/builder/virtualbox/ovf/step_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package ovf - -import ( - "bytes" - "testing" - - "github.com/hashicorp/packer-plugin-sdk/multistep" - packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" -) - -func testState(t *testing.T) multistep.StateBag { - state := new(multistep.BasicStateBag) - state.Put("driver", new(vboxcommon.DriverMock)) - state.Put("ui", &packersdk.BasicUi{ - Reader: new(bytes.Buffer), - Writer: new(bytes.Buffer), - }) - return state -} diff --git a/builder/virtualbox/version/version.go b/builder/virtualbox/version/version.go deleted file mode 100644 index dfbfcd622..000000000 --- a/builder/virtualbox/version/version.go +++ /dev/null @@ -1,13 +0,0 @@ -package version - -import ( - "github.com/hashicorp/packer-plugin-sdk/version" - packerVersion "github.com/hashicorp/packer/version" -) - -var VirtualboxPluginVersion *version.PluginVersion - -func init() { - VirtualboxPluginVersion = version.InitializePluginVersion( - packerVersion.Version, packerVersion.VersionPrerelease) -} diff --git a/command/plugin.go b/command/plugin.go index 1614f9375..f45300f74 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -51,9 +51,6 @@ import ( tritonbuilder "github.com/hashicorp/packer/builder/triton" uclouduhostbuilder "github.com/hashicorp/packer/builder/ucloud/uhost" vagrantbuilder "github.com/hashicorp/packer/builder/vagrant" - virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso" - virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf" - virtualboxvmbuilder "github.com/hashicorp/packer/builder/virtualbox/vm" vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso" vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx" yandexbuilder "github.com/hashicorp/packer/builder/yandex" @@ -132,9 +129,6 @@ var Builders = map[string]packersdk.Builder{ "triton": new(tritonbuilder.Builder), "ucloud-uhost": new(uclouduhostbuilder.Builder), "vagrant": new(vagrantbuilder.Builder), - "virtualbox-iso": new(virtualboxisobuilder.Builder), - "virtualbox-ovf": new(virtualboxovfbuilder.Builder), - "virtualbox-vm": new(virtualboxvmbuilder.Builder), "vmware-iso": new(vmwareisobuilder.Builder), "vmware-vmx": new(vmwarevmxbuilder.Builder), "yandex": new(yandexbuilder.Builder), diff --git a/command/vendored_plugins.go b/command/vendored_plugins.go index 5cd42931a..74f47019b 100644 --- a/command/vendored_plugins.go +++ b/command/vendored_plugins.go @@ -22,6 +22,9 @@ import ( dockerpushpostprocessor "github.com/hashicorp/packer-plugin-docker/post-processor/docker-push" dockersavepostprocessor "github.com/hashicorp/packer-plugin-docker/post-processor/docker-save" dockertagpostprocessor "github.com/hashicorp/packer-plugin-docker/post-processor/docker-tag" + virtualboxisobuilder "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso" + virtualboxovfbuilder "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf" + virtualboxvmbuilder "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm" vsphereclonebuilder "github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/clone" vsphereisobuilder "github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/iso" vspherepostprocessor "github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere" @@ -46,6 +49,9 @@ var VendoredBuilders = map[string]packersdk.Builder{ "amazon-instance": new(amazoninstancebuilder.Builder), "vsphere-clone": new(vsphereclonebuilder.Builder), "vsphere-iso": new(vsphereisobuilder.Builder), + "virtualbox-iso": new(virtualboxisobuilder.Builder), + "virtualbox-ovf": new(virtualboxovfbuilder.Builder), + "virtualbox-vm": new(virtualboxvmbuilder.Builder), } // VendoredProvisioners are provisioner components that were once bundled with the diff --git a/go.mod b/go.mod index 068c38d6f..34423c327 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,6 @@ require ( github.com/go-ini/ini v1.25.4 github.com/go-resty/resty/v2 v2.3.0 github.com/gobwas/glob v0.2.3 - github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/google/go-cmp v0.5.5 github.com/google/go-github/v33 v33.0.1-0.20210113204525-9318e629ec69 github.com/google/uuid v1.1.2 @@ -46,12 +45,13 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-oracle-terraform v0.0.0-20181016190316-007121241b79 github.com/hashicorp/go-uuid v1.0.2 - github.com/hashicorp/go-version v1.2.0 + github.com/hashicorp/go-version v1.3.0 github.com/hashicorp/hcl/v2 v2.9.1 github.com/hashicorp/packer-plugin-amazon v0.0.1 github.com/hashicorp/packer-plugin-ansible v0.0.2 github.com/hashicorp/packer-plugin-docker v0.0.7 github.com/hashicorp/packer-plugin-sdk v0.1.3 + github.com/hashicorp/packer-plugin-virtualbox v0.0.1 github.com/hashicorp/packer-plugin-vsphere v0.0.0-20210415100050-d0269b5646e6 github.com/hashicorp/vault/api v1.0.4 github.com/hetznercloud/hcloud-go v1.15.1 diff --git a/go.sum b/go.sum index c8460acf8..2f91e3c92 100644 --- a/go.sum +++ b/go.sum @@ -402,8 +402,9 @@ github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2I github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= +github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -451,6 +452,10 @@ github.com/hashicorp/packer-plugin-sdk v0.1.2/go.mod h1:KRjczE1/c9NV5Re+PXt3myJs github.com/hashicorp/packer-plugin-sdk v0.1.3-0.20210407232143-c217d82aefb6/go.mod h1:xePpgQgQYv/bamiypx3hH9ukidxDdcN8q0R0wLi8IEQ= github.com/hashicorp/packer-plugin-sdk v0.1.3 h1:oHTVlgoX2piUzL54+LBo9uIMfW+L/kY7or83dDStdIY= github.com/hashicorp/packer-plugin-sdk v0.1.3/go.mod h1:xePpgQgQYv/bamiypx3hH9ukidxDdcN8q0R0wLi8IEQ= +github.com/hashicorp/packer-plugin-virtualbox v0.0.0-20210415132603-5d753f7335b4 h1:AQk/P0QydTRFda9br8Dv3DDv7DCjGLHwfLjXmudA900= +github.com/hashicorp/packer-plugin-virtualbox v0.0.0-20210415132603-5d753f7335b4/go.mod h1:OOGNMK8Y8zjsYngesZH5kCbH0Fj8PKvhqPp8w1ejM3Y= +github.com/hashicorp/packer-plugin-virtualbox v0.0.1 h1:vTfy7a10RUVMdNnDLo0EQrCVbAG4rGWkaDTMC7MVBi4= +github.com/hashicorp/packer-plugin-virtualbox v0.0.1/go.mod h1:OOGNMK8Y8zjsYngesZH5kCbH0Fj8PKvhqPp8w1ejM3Y= github.com/hashicorp/packer-plugin-vsphere v0.0.0-20210415100050-d0269b5646e6 h1:pOv7Apd4P3KEpNBHLV4E7tKlwHoInCU/bnPVadGSDxY= github.com/hashicorp/packer-plugin-vsphere v0.0.0-20210415100050-d0269b5646e6/go.mod h1:XMhsLDDT7sD2BWaruLvGPynnn4IqdbrfvuKhb1GK1RI= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= diff --git a/vendor/github.com/hashicorp/go-version/.travis.yml b/vendor/github.com/hashicorp/go-version/.travis.yml deleted file mode 100644 index 01c5dc219..000000000 --- a/vendor/github.com/hashicorp/go-version/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - 1.2 - - 1.3 - - 1.4 - - 1.9 - - "1.10" - - 1.11 - - 1.12 - -script: - - go test diff --git a/vendor/github.com/hashicorp/go-version/CHANGELOG.md b/vendor/github.com/hashicorp/go-version/CHANGELOG.md new file mode 100644 index 000000000..dbae7f7be --- /dev/null +++ b/vendor/github.com/hashicorp/go-version/CHANGELOG.md @@ -0,0 +1,25 @@ +# 1.3.0 (March 31, 2021) + +Please note that CHANGELOG.md does not exist in the source code prior to this release. + +FEATURES: + - Add `Core` function to return a version without prerelease or metadata ([#85](https://github.com/hashicorp/go-version/pull/85)) + +# 1.2.1 (June 17, 2020) + +BUG FIXES: + - Prevent `Version.Equal` method from panicking on `nil` encounter ([#73](https://github.com/hashicorp/go-version/pull/73)) + +# 1.2.0 (April 23, 2019) + +FEATURES: + - Add `GreaterThanOrEqual` and `LessThanOrEqual` helper methods ([#53](https://github.com/hashicorp/go-version/pull/53)) + +# 1.1.0 (Jan 07, 2019) + +FEATURES: + - Add `NewSemver` constructor ([#45](https://github.com/hashicorp/go-version/pull/45)) + +# 1.0.0 (August 24, 2018) + +Initial release. diff --git a/vendor/github.com/hashicorp/go-version/README.md b/vendor/github.com/hashicorp/go-version/README.md index 6f3a15ce7..851a337be 100644 --- a/vendor/github.com/hashicorp/go-version/README.md +++ b/vendor/github.com/hashicorp/go-version/README.md @@ -1,5 +1,6 @@ # Versioning Library for Go -[![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version) +[![Build Status](https://circleci.com/gh/hashicorp/go-version/tree/master.svg?style=svg)](https://circleci.com/gh/hashicorp/go-version/tree/master) +[![GoDoc](https://godoc.org/github.com/hashicorp/go-version?status.svg)](https://godoc.org/github.com/hashicorp/go-version) go-version is a library for parsing versions and version constraints, and verifying versions against a set of constraints. go-version diff --git a/vendor/github.com/hashicorp/go-version/version.go b/vendor/github.com/hashicorp/go-version/version.go index 1032c5606..8068834ec 100644 --- a/vendor/github.com/hashicorp/go-version/version.go +++ b/vendor/github.com/hashicorp/go-version/version.go @@ -278,8 +278,20 @@ func comparePrereleases(v string, other string) int { return 0 } +// Core returns a new version constructed from only the MAJOR.MINOR.PATCH +// segments of the version, without prerelease or metadata. +func (v *Version) Core() *Version { + segments := v.Segments64() + segmentsOnly := fmt.Sprintf("%d.%d.%d", segments[0], segments[1], segments[2]) + return Must(NewVersion(segmentsOnly)) +} + // Equal tests if two versions are equal. func (v *Version) Equal(o *Version) bool { + if v == nil || o == nil { + return v == o + } + return v.Compare(o) == 0 } @@ -288,7 +300,7 @@ func (v *Version) GreaterThan(o *Version) bool { return v.Compare(o) > 0 } -// GreaterThanOrEqualTo tests if this version is greater than or equal to another version. +// GreaterThanOrEqual tests if this version is greater than or equal to another version. func (v *Version) GreaterThanOrEqual(o *Version) bool { return v.Compare(o) >= 0 } @@ -298,7 +310,7 @@ func (v *Version) LessThan(o *Version) bool { return v.Compare(o) < 0 } -// LessThanOrEqualTo tests if this version is less than or equal to another version. +// LessThanOrEqual tests if this version is less than or equal to another version. func (v *Version) LessThanOrEqual(o *Version) bool { return v.Compare(o) <= 0 } diff --git a/vendor/github.com/hashicorp/packer-plugin-virtualbox/LICENSE b/vendor/github.com/hashicorp/packer-plugin-virtualbox/LICENSE new file mode 100644 index 000000000..a612ad981 --- /dev/null +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/builder/virtualbox/common/artifact.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/artifact.go similarity index 100% rename from builder/virtualbox/common/artifact.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/artifact.go diff --git a/builder/virtualbox/common/comm.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/comm.go similarity index 100% rename from builder/virtualbox/common/comm.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/comm.go diff --git a/builder/virtualbox/common/comm_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/comm_config.go similarity index 100% rename from builder/virtualbox/common/comm_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/comm_config.go diff --git a/builder/virtualbox/common/driver.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/driver.go similarity index 100% rename from builder/virtualbox/common/driver.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/driver.go diff --git a/builder/virtualbox/common/driver_4_2.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/driver_4_2.go similarity index 100% rename from builder/virtualbox/common/driver_4_2.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/driver_4_2.go diff --git a/builder/virtualbox/common/driver_mock.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/driver_mock.go similarity index 100% rename from builder/virtualbox/common/driver_mock.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/driver_mock.go diff --git a/builder/virtualbox/common/export_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/export_config.go similarity index 100% rename from builder/virtualbox/common/export_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/export_config.go diff --git a/builder/virtualbox/common/guest_additions_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/guest_additions_config.go similarity index 100% rename from builder/virtualbox/common/guest_additions_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/guest_additions_config.go diff --git a/builder/virtualbox/common/hw_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/hw_config.go similarity index 100% rename from builder/virtualbox/common/hw_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/hw_config.go diff --git a/builder/virtualbox/common/output_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/output_config.go similarity index 100% rename from builder/virtualbox/common/output_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/output_config.go diff --git a/builder/virtualbox/common/run_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/run_config.go similarity index 100% rename from builder/virtualbox/common/run_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/run_config.go diff --git a/builder/virtualbox/common/shutdown_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/shutdown_config.go similarity index 100% rename from builder/virtualbox/common/shutdown_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/shutdown_config.go diff --git a/builder/virtualbox/common/snapshot.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/snapshot.go similarity index 100% rename from builder/virtualbox/common/snapshot.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/snapshot.go diff --git a/builder/virtualbox/common/step_attach_floppy.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_attach_floppy.go similarity index 100% rename from builder/virtualbox/common/step_attach_floppy.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_attach_floppy.go diff --git a/builder/virtualbox/common/step_attach_isos.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_attach_isos.go similarity index 100% rename from builder/virtualbox/common/step_attach_isos.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_attach_isos.go diff --git a/builder/virtualbox/common/step_configure_vrdp.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_configure_vrdp.go similarity index 100% rename from builder/virtualbox/common/step_configure_vrdp.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_configure_vrdp.go diff --git a/builder/virtualbox/common/step_download_guest_additions.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_download_guest_additions.go similarity index 100% rename from builder/virtualbox/common/step_download_guest_additions.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_download_guest_additions.go diff --git a/builder/virtualbox/common/step_export.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_export.go similarity index 100% rename from builder/virtualbox/common/step_export.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_export.go diff --git a/builder/virtualbox/common/step_http_ip_discover.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_http_ip_discover.go similarity index 100% rename from builder/virtualbox/common/step_http_ip_discover.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_http_ip_discover.go diff --git a/builder/virtualbox/common/step_port_forwarding.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_port_forwarding.go similarity index 100% rename from builder/virtualbox/common/step_port_forwarding.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_port_forwarding.go diff --git a/builder/virtualbox/common/step_remove_devices.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_remove_devices.go similarity index 100% rename from builder/virtualbox/common/step_remove_devices.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_remove_devices.go diff --git a/builder/virtualbox/common/step_run.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_run.go similarity index 100% rename from builder/virtualbox/common/step_run.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_run.go diff --git a/builder/virtualbox/common/step_shutdown.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_shutdown.go similarity index 100% rename from builder/virtualbox/common/step_shutdown.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_shutdown.go diff --git a/builder/virtualbox/common/step_ssh_key_pair.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_ssh_key_pair.go similarity index 100% rename from builder/virtualbox/common/step_ssh_key_pair.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_ssh_key_pair.go diff --git a/builder/virtualbox/common/step_suppress_messages.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_suppress_messages.go similarity index 100% rename from builder/virtualbox/common/step_suppress_messages.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_suppress_messages.go diff --git a/builder/virtualbox/common/step_type_boot_command.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_type_boot_command.go similarity index 100% rename from builder/virtualbox/common/step_type_boot_command.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_type_boot_command.go diff --git a/builder/virtualbox/common/step_upload_guest_additions.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_upload_guest_additions.go similarity index 100% rename from builder/virtualbox/common/step_upload_guest_additions.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_upload_guest_additions.go diff --git a/builder/virtualbox/common/step_upload_version.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_upload_version.go similarity index 100% rename from builder/virtualbox/common/step_upload_version.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_upload_version.go diff --git a/builder/virtualbox/common/step_vboxmanage.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_vboxmanage.go similarity index 100% rename from builder/virtualbox/common/step_vboxmanage.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/step_vboxmanage.go diff --git a/builder/virtualbox/common/vbox_version_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/vbox_version_config.go similarity index 100% rename from builder/virtualbox/common/vbox_version_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/vbox_version_config.go diff --git a/builder/virtualbox/common/vboxbundle_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/vboxbundle_config.go similarity index 100% rename from builder/virtualbox/common/vboxbundle_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/vboxbundle_config.go diff --git a/builder/virtualbox/common/vboxmanage_config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/vboxmanage_config.go similarity index 100% rename from builder/virtualbox/common/vboxmanage_config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common/vboxmanage_config.go diff --git a/builder/virtualbox/iso/builder.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/builder.go similarity index 99% rename from builder/virtualbox/iso/builder.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/builder.go index 98c1f4c69..6550e6bdd 100644 --- a/builder/virtualbox/iso/builder.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/builder.go @@ -18,7 +18,7 @@ import ( packersdk "github.com/hashicorp/packer-plugin-sdk/packer" "github.com/hashicorp/packer-plugin-sdk/template/config" "github.com/hashicorp/packer-plugin-sdk/template/interpolate" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) const BuilderId = "mitchellh.virtualbox" diff --git a/builder/virtualbox/iso/builder.hcl2spec.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/builder.hcl2spec.go similarity index 100% rename from builder/virtualbox/iso/builder.hcl2spec.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/builder.hcl2spec.go diff --git a/builder/virtualbox/iso/step_create_disk.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/step_create_disk.go similarity index 98% rename from builder/virtualbox/iso/step_create_disk.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/step_create_disk.go index fe2582c65..c9aa948b1 100644 --- a/builder/virtualbox/iso/step_create_disk.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/step_create_disk.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" "path/filepath" "strconv" diff --git a/builder/virtualbox/iso/step_create_vm.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/step_create_vm.go similarity index 97% rename from builder/virtualbox/iso/step_create_vm.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/step_create_vm.go index 645d93087..7c7ccd015 100644 --- a/builder/virtualbox/iso/step_create_vm.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso/step_create_vm.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) // This step creates the actual virtual machine. diff --git a/builder/virtualbox/ovf/builder.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/builder.go similarity index 98% rename from builder/virtualbox/ovf/builder.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/builder.go index 7dd1de56c..bcbbb0213 100644 --- a/builder/virtualbox/ovf/builder.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/builder.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" "github.com/hashicorp/packer-plugin-sdk/multistep/commonsteps" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) // Builder implements packersdk.Builder and builds the actual VirtualBox diff --git a/builder/virtualbox/ovf/config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/config.go similarity index 98% rename from builder/virtualbox/ovf/config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/config.go index 772e4cde4..a8b3cd430 100644 --- a/builder/virtualbox/ovf/config.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/config.go @@ -12,7 +12,7 @@ import ( packersdk "github.com/hashicorp/packer-plugin-sdk/packer" "github.com/hashicorp/packer-plugin-sdk/template/config" "github.com/hashicorp/packer-plugin-sdk/template/interpolate" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) // Config is the configuration structure for the builder. diff --git a/builder/virtualbox/ovf/config.hcl2spec.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/config.hcl2spec.go similarity index 100% rename from builder/virtualbox/ovf/config.hcl2spec.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/config.hcl2spec.go diff --git a/builder/virtualbox/ovf/step_import.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/step_import.go similarity index 94% rename from builder/virtualbox/ovf/step_import.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/step_import.go index 41afc156b..c291de0e9 100644 --- a/builder/virtualbox/ovf/step_import.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf/step_import.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) // This step imports an OVF VM into VirtualBox. diff --git a/builder/virtualbox/vm/builder.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/builder.go similarity index 98% rename from builder/virtualbox/vm/builder.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/builder.go index 04be971a3..3dfd84639 100644 --- a/builder/virtualbox/vm/builder.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/builder.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" "github.com/hashicorp/packer-plugin-sdk/multistep/commonsteps" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) // Builder implements packersdk.Builder and builds the actual VirtualBox diff --git a/builder/virtualbox/vm/config.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/config.go similarity index 99% rename from builder/virtualbox/vm/config.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/config.go index 69a671f28..2b57f6dd3 100644 --- a/builder/virtualbox/vm/config.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/config.go @@ -14,7 +14,7 @@ import ( packersdk "github.com/hashicorp/packer-plugin-sdk/packer" "github.com/hashicorp/packer-plugin-sdk/template/config" "github.com/hashicorp/packer-plugin-sdk/template/interpolate" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) // Config is the configuration structure for the builder. diff --git a/builder/virtualbox/vm/config.hcl2spec.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/config.hcl2spec.go similarity index 100% rename from builder/virtualbox/vm/config.hcl2spec.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/config.hcl2spec.go diff --git a/builder/virtualbox/vm/step_create_snapshot.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_create_snapshot.go similarity index 96% rename from builder/virtualbox/vm/step_create_snapshot.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_create_snapshot.go index 354730298..87c32749a 100644 --- a/builder/virtualbox/vm/step_create_snapshot.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_create_snapshot.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) type StepCreateSnapshot struct { diff --git a/builder/virtualbox/vm/step_import.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_import.go similarity index 100% rename from builder/virtualbox/vm/step_import.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_import.go diff --git a/builder/virtualbox/vm/step_set_snapshot.go b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_set_snapshot.go similarity index 97% rename from builder/virtualbox/vm/step_set_snapshot.go rename to vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_set_snapshot.go index b3c9a49c2..4544c0c26 100644 --- a/builder/virtualbox/vm/step_set_snapshot.go +++ b/vendor/github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm/step_set_snapshot.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" - vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common" + vboxcommon "github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common" ) type StepSetSnapshot struct { diff --git a/vendor/modules.txt b/vendor/modules.txt index 1002ef874..d5f894e9b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -336,7 +336,6 @@ github.com/gofrs/flock # github.com/gofrs/uuid v4.0.0+incompatible github.com/gofrs/uuid # github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 -## explicit github.com/golang-collections/collections/stack # github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e github.com/golang/groupcache/lru @@ -467,7 +466,7 @@ github.com/hashicorp/go-sockaddr # github.com/hashicorp/go-uuid v1.0.2 ## explicit github.com/hashicorp/go-uuid -# github.com/hashicorp/go-version v1.2.0 +# github.com/hashicorp/go-version v1.3.0 ## explicit github.com/hashicorp/go-version # github.com/hashicorp/golang-lru v0.5.3 @@ -562,6 +561,12 @@ github.com/hashicorp/packer-plugin-sdk/tmp github.com/hashicorp/packer-plugin-sdk/useragent github.com/hashicorp/packer-plugin-sdk/uuid github.com/hashicorp/packer-plugin-sdk/version +# github.com/hashicorp/packer-plugin-virtualbox v0.0.1 +## explicit +github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/common +github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/iso +github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/ovf +github.com/hashicorp/packer-plugin-virtualbox/builder/virtualbox/vm # github.com/hashicorp/packer-plugin-vsphere v0.0.0-20210415100050-d0269b5646e6 ## explicit github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/clone diff --git a/website/content/docs/builders/virtualbox/index.mdx b/website/content/docs/builders/virtualbox/index.mdx deleted file mode 100644 index 47d5de687..000000000 --- a/website/content/docs/builders/virtualbox/index.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: > - The VirtualBox Packer builder is able to create VirtualBox virtual machines - and - - export them in the OVA or OVF format. -page_title: VirtualBox - Builders ---- - -# VirtualBox Builder - -The VirtualBox Packer builder is able to create -[VirtualBox](https://www.virtualbox.org) virtual machines and export them in -the OVA or OVF format. - -Packer actually comes with multiple builders able to create VirtualBox -machines, depending on the strategy you want to use to build the image. Packer -supports the following VirtualBox builders: - -- [virtualbox-iso](/docs/builders/virtualbox-iso) - Starts from an ISO - file, creates a brand new VirtualBox VM, installs an OS, provisions - software within the OS, then exports that machine to create an image. This - is best for people who want to start from scratch. - -- [virtualbox-ovf](/docs/builders/virtualbox-ovf) - This builder imports - an existing OVF/OVA file, runs provisioners on top of that VM, and exports - that machine to create an image. This is best if you have an existing - VirtualBox VM export you want to use as the source. As an additional - benefit, you can feed the artifact of this builder back into itself to - iterate on a machine. - -- [virtualbox-vm](/docs/builders/virtualbox-vm) - This builder uses an - existing VM to run defined provisioners on top of that VM, and optionally - creates a snapshot to save the changes applied from the provisioners. In - addition the builder is able to export that machine to create an image. The - builder is able to attach to a defined snapshot as a starting point, which - could be defined statically or dynamically via a variable. diff --git a/website/content/docs/builders/virtualbox/iso.mdx b/website/content/docs/builders/virtualbox/iso.mdx deleted file mode 100644 index debd8a1cf..000000000 --- a/website/content/docs/builders/virtualbox/iso.mdx +++ /dev/null @@ -1,279 +0,0 @@ ---- -modeline: | - vim: set ft=pandoc: -description: | - The VirtualBox Packer builder is able to create VirtualBox virtual machines - and export them in the OVF format, starting from an ISO image. -page_title: VirtualBox ISO - Builders ---- - -# VirtualBox Builder (from an ISO) - -Type: `virtualbox-iso` -Artifact BuilderId: `mitchellh.virtualbox` - -The VirtualBox Packer builder is able to create -[VirtualBox](https://www.virtualbox.org/) virtual machines and export them in -the OVF format, starting from an ISO image. - -The builder builds a virtual machine by creating a new virtual machine from -scratch, booting it, installing an OS, provisioning software within the OS, then -shutting it down. The result of the VirtualBox builder is a directory containing -all the files necessary to run the virtual machine portably. - -## Basic Example - -Here is a basic example. This example is not functional. It will start the OS -installer but then fail because we don't provide the preseed file for Ubuntu to -self-install. Still, the example serves to show the basic configuration: - - - - -```json -{ - "type": "virtualbox-iso", - "guest_os_type": "Ubuntu_64", - "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso", - "iso_checksum": "md5:769474248a3897f4865817446f9a4a53", - "ssh_username": "packer", - "ssh_password": "packer", - "shutdown_command": "echo 'packer' | sudo -S shutdown -P now" -} -``` - - - - -```hcl -source "virtualbox-iso" "basic-example" { - guest_os_type = "Ubuntu_64" - iso_url = "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso" - iso_checksum = "md5:769474248a3897f4865817446f9a4a53" - ssh_username = "packer" - ssh_password = "packer" - shutdown_command = "echo 'packer' | sudo -S shutdown -P now" -} - -build { - sources = ["sources.virtualbox-iso.basic-example"] -} -``` - - - - -It is important to add a `shutdown_command`. By default Packer halts the virtual -machine and the file system may not be sync'd. Thus, changes made in a -provisioner might not be saved. - -## VirtualBox-ISO Builder Configuration Reference - -There are many configuration options available for the builder. In addition to -the items listed here, you will want to look at the general configuration -references for [ISO](#iso-configuration), -[HTTP](#http-directory-configuration), -[Floppy](#floppy-configuration), -[Export](#export-configuration), -[Boot](#boot-configuration), -[Shutdown](#shutdown-configuration), -[Run](#run-configuration), -[Communicator](#communicator-configuration) -configuration references, which are -necessary for this build to succeed and can be found further down the page. - -#### Optional: - -@include 'builder/virtualbox/iso/Config-not-required.mdx' - -@include 'builder/virtualbox/common/VBoxVersionConfig-not-required.mdx' - -@include 'builder/virtualbox/common/VBoxBundleConfig-not-required.mdx' - -@include 'builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx' - -### ISO Configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/ISOConfig.mdx' - -#### Required: - -@include 'packer-plugin-sdk/multistep/commonsteps/ISOConfig-required.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/ISOConfig-not-required.mdx' - -### Http directory configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig-not-required.mdx' - -### Floppy configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig-not-required.mdx' - -### CD configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx' - -### Export configuration - -#### Optional: - -@include 'builder/virtualbox/common/ExportConfig-not-required.mdx' - -### Output configuration - -#### Optional: - -@include 'builder/virtualbox/common/OutputConfig-not-required.mdx' - -### Run configuration - -#### Optional: - -@include 'builder/virtualbox/common/RunConfig-not-required.mdx' - -### Shutdown configuration - -#### Optional: - -@include 'builder/virtualbox/common/ShutdownConfig-not-required.mdx' - -### Hardware configuration - -#### Optional: - -@include 'builder/virtualbox/common/HWConfig-not-required.mdx' - -### VBox Manage configuration - -@include 'builder/virtualbox/common/VBoxManageConfig.mdx' - -#### Optional: - -@include 'builder/virtualbox/common/VBoxManageConfig-not-required.mdx' - -### Communicator configuration - -#### Optional common fields: - -@include 'packer-plugin-sdk/communicator/Config-not-required.mdx' - -@include 'builder/virtualbox/common/CommConfig-not-required.mdx' - -#### Optional SSH fields: - -@include 'packer-plugin-sdk/communicator/SSH-not-required.mdx' - -@include 'packer-plugin-sdk/communicator/SSH-Private-Key-File-not-required.mdx' - -@include 'packer-plugin-sdk/communicator/SSH-Agent-Auth-not-required.mdx' - -#### Optional WinRM fields: - -@include 'packer-plugin-sdk/communicator/WinRM-not-required.mdx' - -### Boot Configuration - -@include 'packer-plugin-sdk/bootcommand/BootConfig.mdx' - -Please note that for the Virtuabox builder, the IP address of the HTTP server -Packer launches for you to access files like the preseed file in the example -above (`{{ .HTTPIP }}`) is hardcoded to 10.0.2.2. If you change the network -of your VM you must guarantee that you can still access this HTTP server. - -The boot command is sent to the VM through the `VBoxManage` utility in as few -invocations as possible. We send each character in groups of 25, with a default -delay of 100ms between groups. The delay alleviates issues with latency and CPU -contention. If you notice missing keys, you can tune this delay by specifying -"boot_keygroup_interval" in your Packer template, for example: - - - - -```json -{ - "builders": [ - { - "type": "virtualbox-iso", - "boot_keygroup_interval": "500ms" - ... - } - ] -} -``` - - - - -```hcl -source "virtualbox-iso" "basic-example" { - boot_keygroup_interval = "500ms" - # ... -} -``` - - - - -#### Optional: - -@include 'packer-plugin-sdk/bootcommand/BootConfig-not-required.mdx' - -@include 'builders/virtualbox-ssh-key-pair.mdx' - -## Guest Additions - -Packer will automatically download the proper guest additions for the version of -VirtualBox that is running and upload those guest additions into the virtual -machine so that provisioners can easily install them. - -Packer downloads the guest additions from the official VirtualBox website, and -verifies the file with the official checksums released by VirtualBox. - -After the virtual machine is up and the operating system is installed, Packer -uploads the guest additions into the virtual machine. The path where they are -uploaded is controllable by `guest_additions_path`, and defaults to -"VBoxGuestAdditions.iso". Without an absolute path, it is uploaded to the home -directory of the SSH user. - -## Creating an EFI enabled VM - -If you want to create an EFI enabled VM, make sure you set the `iso_interface` -to "sata". Otherwise your attached drive will not be bootable. Example: - - - - -```json -"iso_interface": "sata", -"vboxmanage": [ - [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ] -] -``` - - - - -```hcl -iso_interface = "sata" -vboxmanage = [ - [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ] -] -``` - - - diff --git a/website/content/docs/builders/virtualbox/ovf.mdx b/website/content/docs/builders/virtualbox/ovf.mdx deleted file mode 100644 index 6c5ceb9dd..000000000 --- a/website/content/docs/builders/virtualbox/ovf.mdx +++ /dev/null @@ -1,249 +0,0 @@ ---- -modeline: | - vim: set ft=pandoc: -description: | - This VirtualBox Packer builder is able to create VirtualBox virtual machines - and export them in the OVF format, starting from an existing OVF/OVA (exported - virtual machine image). -page_title: VirtualBox OVF/OVA - Builders ---- - -# VirtualBox Builder (from an OVF/OVA) - -Type: `virtualbox-ovf` -Artifact BuilderId: `mitchellh.virtualbox` - -This VirtualBox Packer builder is able to create -[VirtualBox](https://www.virtualbox.org/) virtual machines and export them in -the OVF format, starting from an existing OVF/OVA (exported virtual machine -image). - -When exporting from VirtualBox make sure to choose OVF Version 2, since Version -1 is not compatible and will generate errors like this: - -```shell-session -==> virtualbox-ovf: Progress state: VBOX_E_FILE_ERROR -==> virtualbox-ovf: VBoxManage: error: Appliance read failed -==> virtualbox-ovf: VBoxManage: error: Error reading "source.ova": element "Section" has no "type" attribute, line 21 -==> virtualbox-ovf: VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Appliance, interface IAppliance -==> virtualbox-ovf: VBoxManage: error: Context: "int handleImportAppliance(HandlerArg*)" at line 304 of file VBoxManageAppliance.cpp -``` - -The builder builds a virtual machine by importing an existing OVF or OVA file. -It then boots this image, runs provisioners on this new VM, and exports that VM -to create the image. The imported machine is deleted prior to finishing the -build. - -## Basic Example - -Here is a basic example. This example is functional if you have an OVF matching -the settings here. - - - - -```json -{ - "type": "virtualbox-ovf", - "source_path": "source.ovf", - "ssh_username": "packer", - "ssh_password": "packer", - "shutdown_command": "echo 'packer' | sudo -S shutdown -P now" -} -``` - - - - -```hcl -source "virtualbox-ovf" "basic-example" { - source_path = "source.ovf" - ssh_username = "packer" - ssh_password = "packer" - shutdown_command = "echo 'packer' | sudo -S shutdown -P now" -} - -build { - sources = ["sources.virtualbox-ovf.basic-example"] -} -``` - - - - -It is important to add a `shutdown_command`. By default Packer halts the virtual -machine and the file system may not be sync'd. Thus, changes made in a -provisioner might not be saved. - -## Configuration Reference - -There are many configuration options available for the builder. In addition to -the items listed here, you will want to look at the general configuration -references for [ISO](#iso-configuration), -[HTTP](#http-directory-configuration), -[Floppy](#floppy-configuration), -[Export](#export-configuration), -[Boot](#boot-configuration), -[Shutdown](#shutdown-configuration), -[Run](#run-configuration), -[Communicator](#communicator-configuration) -configuration references, which are -necessary for this build to succeed and can be found further down the page. - -### Required: - -@include 'builder/virtualbox/ovf/Config-required.mdx' - -#### Optional: - -@include 'builder/virtualbox/ovf/Config-not-required.mdx' - -@include 'builder/virtualbox/common/VBoxVersionConfig-not-required.mdx' - -@include 'builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx' - -### VBoxManage configuration - -@include 'builder/virtualbox/common/VBoxManageConfig-not-required.mdx' - -### Http directory configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig-not-required.mdx' - -### Floppy configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig-not-required.mdx' - -### CD configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx' - -### Export configuration - -#### Optional: - -@include 'builder/virtualbox/common/ExportConfig-not-required.mdx' - -### Output configuration - -#### Optional: - -@include 'builder/virtualbox/common/OutputConfig-not-required.mdx' - -### Run configuration - -#### Optional: - -@include 'builder/virtualbox/common/RunConfig-not-required.mdx' - -### Shutdown configuration - -#### Optional: - -@include 'builder/virtualbox/common/ShutdownConfig-not-required.mdx' - -### Communicator configuration - -#### Optional common fields: - -@include 'packer-plugin-sdk/communicator/Config-not-required.mdx' - -@include 'builder/virtualbox/common/CommConfig-not-required.mdx' - -#### Optional SSH fields: - -@include 'packer-plugin-sdk/communicator/SSH-not-required.mdx' - -@include 'packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx' - -@include 'packer-plugin-sdk/communicator/SSH-Key-Pair-Name-not-required.mdx' - -@include 'packer-plugin-sdk/communicator/SSH-Private-Key-File-not-required.mdx' - -@include 'packer-plugin-sdk/communicator/SSH-Agent-Auth-not-required.mdx' - -#### Optional WinRM fields: - -@include 'packer-plugin-sdk/communicator/WinRM-not-required.mdx' - -### Boot Configuration - -@include 'packer-plugin-sdk/bootcommand/BootConfig.mdx' - -Please note that for the Virtuabox builder, the IP address of the HTTP server -Packer launches for you to access files like the preseed file in the example -above (`{{ .HTTPIP }}`) is hardcoded to 10.0.2.2. If you change the network -of your VM you must guarantee that you can still access this HTTP server. - -The boot command is sent to the VM through the `VBoxManage` utility in as few -invocations as possible. We send each character in groups of 25, with a default -delay of 100ms between groups. The delay alleviates issues with latency and CPU -contention. If you notice missing keys, you can tune this delay by specifying -"boot_keygroup_interval" in your Packer template, for example: - - - - -```json -{ - "builders": [ - { - "type": "virtualbox-ovf", - "boot_keygroup_interval": "500ms" - ... - } - ] -} -``` - - - - -```hcl -source "virtualbox-ovf" "basic-example" { - boot_keygroup_interval = "500ms" - # ... -} -``` - - - - -#### Optional: - -@include 'packer-plugin-sdk/bootcommand/BootConfig-not-required.mdx' - -@include 'builders/virtualbox-ssh-key-pair.mdx' - -## Guest Additions - -Packer will automatically download the proper guest additions for the version of -VirtualBox that is running and upload those guest additions into the virtual -machine so that provisioners can easily install them. - -Packer downloads the guest additions from the official VirtualBox website, and -verifies the file with the official checksums released by VirtualBox. - -After the virtual machine is up and the operating system is installed, Packer -uploads the guest additions into the virtual machine. The path where they are -uploaded is controllable by `guest_additions_path`, and defaults to -"VBoxGuestAdditions.iso". Without an absolute path, it is uploaded to the home -directory of the SSH user. - -## VBoxManage Commands - -@include 'builder/virtualbox/common/VBoxManageConfig.mdx' - -@include 'builder/virtualbox/common/VBoxManageConfig-not-required.mdx' diff --git a/website/content/docs/builders/virtualbox/vm.mdx b/website/content/docs/builders/virtualbox/vm.mdx deleted file mode 100644 index 34b39133a..000000000 --- a/website/content/docs/builders/virtualbox/vm.mdx +++ /dev/null @@ -1,264 +0,0 @@ ---- -modeline: | - vim: set ft=pandoc: -description: > - The VirtualBox Packer builder is able to create VirtualBox virtual machines - snapshots - - and export them in the OVF format, starting from an ISO image. -page_title: VirtualBox Snapshot - Builders ---- - -# VirtualBox Builder (from an existing VM) - -Type: `virtualbox-vm` -Artifact BuilderId: `mitchellh.virtualbox` - -The VirtualBox Packer builder is able to create -[VirtualBox](https://www.virtualbox.org/) virtual machines snapshots and -(optionally) export them in the OVF format, starting from an **existing** -virtual machine. - -The builder builds a virtual machine snapshot by using an existing virtual -machine, booting it, provisioning software within the OS, then shutting it down. -The result of the VirtualBox builder is a new snapshot persisting all changes -from the applied provisioners. - -## Basic Example - -Here is a basic example. which serves to show the basic configuration: - - - - -```json -{ - "type": "virtualbox-vm", - "communicator": "winrm", - "headless": "{{user `headless`}}", - "winrm_username": "vagrant", - "winrm_password": "vagrant", - "winrm_timeout": "2h", - "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", - "guest_additions_mode": "disable", - "output_directory": "./builds-vm", - "vm_name": "target-vm", - "attach_snapshot": "Snapshot", - "target_snapshot": "Target-Snapshot", - "force_delete_snapshot": "true", - "keep_registered": "false", - "skip_export": "false" -} -``` - - - - -```hcl -source "virtualbox-vm" "basic-example" { - communicator = "winrm" - headless = "{{user `headless`}}" - winrm_username = "vagrant" - winrm_password = "vagrant" - winrm_timeout = "2h" - shutdown_command = "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"" - guest_additions_mode = "disable" - output_directory = "./builds-vm" - vm_name = "target-vm" - attach_snapshot = "Snapshot" - target_snapshot = "Target-Snapshot" - force_delete_snapshot = true - keep_registered = false - skip_export = false -} - -build { - sources = ["sources.virtualbox-vm.basic-example"] -} -``` - - - - -It is important to add a `shutdown_command`. By default Packer halts the virtual -machine and the file system may not be sync'd. Thus, changes made in a -provisioner might not be saved. - -## Configuration Reference - -There are many configuration options available for the builder. In addition to -the items listed here, you will want to look at the general configuration -references for [ISO](#iso-configuration), -[HTTP](#http-directory-configuration), -[Floppy](#floppy-configuration), -[CD](#CD-configuration), -[Export](#export-configuration), -[Boot](#boot-configuration), -[Shutdown](#shutdown-configuration), -[Run](#run-configuration), -[Communicator](#communicator-configuration) -configuration references, which are -necessary for this build to succeed and can be found further down the page. -In addition to the options listed here, a -[communicator](/docs/templates/legacy_json_templates/communicator) can be configured for this -builder. - -### Required: - -@include 'builder/virtualbox/vm/Config-required.mdx' - -### Optional: - -@include 'builder/virtualbox/vm/Config-not-required.mdx' - -@include 'builder/virtualbox/common/VBoxVersionConfig-not-required.mdx' - -#### Optional: - -@include 'builder/virtualbox/common/ShutdownConfig-not-required.mdx' - -### Http directory configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig-not-required.mdx' - -### Floppy configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig-not-required.mdx' - -### CD configuration - -@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig.mdx' - -#### Optional: - -@include 'packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx' - -### Export configuration - -#### Optional: - -@include 'builder/virtualbox/common/ExportConfig-not-required.mdx' - -### Output configuration - -#### Optional: - -@include 'builder/virtualbox/common/OutputConfig-not-required.mdx' - -### Run configuration - -#### Optional: - -@include 'builder/virtualbox/common/RunConfig-not-required.mdx' - -### Shutdown configuration - -#### Optional: - -@include 'builder/virtualbox/common/ShutdownConfig-not-required.mdx' - -### Hardware configuration - -#### Optional: - -@include 'builder/virtualbox/common/HWConfig-not-required.mdx' - -### VBox Manage configuration - -#### Optional: - -@include 'builder/virtualbox/common/VBoxManageConfig-not-required.mdx' - -### Communicator configuration - -#### Optional common fields: - -@include 'packer-plugin-sdk/communicator/Config-not-required.mdx' - -@include 'builder/virtualbox/common/CommConfig-not-required.mdx' - -#### Optional SSH fields: - -@include 'packer-plugin-sdk/communicator/SSH-not-required.mdx' - -#### Optional WinRM fields: - -@include 'packer-plugin-sdk/communicator/WinRM-not-required.mdx' - -### Boot Configuration - -@include 'packer-plugin-sdk/bootcommand/BootConfig.mdx' - -Please note that for the Virtuabox builder, the IP address of the HTTP server -Packer launches for you to access files like the preseed file in the example -above (`{{ .HTTPIP }}`) is hardcoded to 10.0.2.2. If you change the network -of your VM you must guarantee that you can still access this HTTP server. - -The boot command is sent to the VM through the `VBoxManage` utility in as few -invocations as possible. We send each character in groups of 25, with a default -delay of 100ms between groups. The delay alleviates issues with latency and CPU -contention. If you notice missing keys, you can tune this delay by specifying -"boot_keygroup_interval" in your Packer template, for example: - - - - -```json -{ - "builders": [ - { - "type": "virtualbox-vm", - "boot_keygroup_interval": "500ms" - ... - } - ] -} -``` - - - - -```hcl -source "virtualbox-vm" "basic-example" { - boot_keygroup_interval = "500ms" - # ... -} -``` - - - - -#### Optional: - -@include 'packer-plugin-sdk/bootcommand/BootConfig-not-required.mdx' - -@include 'builders/virtualbox-ssh-key-pair.mdx' - -## Guest Additions - -Packer will automatically download the proper guest additions for the version of -VirtualBox that is running and upload those guest additions into the virtual -machine so that provisioners can easily install them. - -Packer downloads the guest additions from the official VirtualBox website, and -verifies the file with the official checksums released by VirtualBox. - -After the virtual machine is up and the operating system is installed, Packer -uploads the guest additions into the virtual machine. The path where they are -uploaded is controllable by `guest_additions_path`, and defaults to -"VBoxGuestAdditions.iso". Without an absolute path, it is uploaded to the home -directory of the SSH user. - -## VBoxManage Commands - -@include 'builder/virtualbox/common/VBoxManageConfig.mdx' - -@include 'builder/virtualbox/common/VBoxManageConfig-not-required.mdx' diff --git a/website/content/partials/builder/virtualbox/common/CommConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/CommConfig-not-required.mdx deleted file mode 100644 index ae818daec..000000000 --- a/website/content/partials/builder/virtualbox/common/CommConfig-not-required.mdx +++ /dev/null @@ -1,15 +0,0 @@ - - -- `host_port_min` (int) - The minimum port to use for the Communicator port on the host machine which is forwarded - to the SSH or WinRM port on the guest machine. By default this is 2222. - -- `host_port_max` (int) - The maximum port to use for the Communicator port on the host machine which is forwarded - to the SSH or WinRM port on the guest machine. Because Packer often runs in parallel, - Packer will choose a randomly available port in this range to use as the - host port. By default this is 4444. - -- `skip_nat_mapping` (bool) - Defaults to false. When enabled, Packer - does not setup forwarded port mapping for communicator (SSH or WinRM) requests and uses ssh_port or winrm_port - on the host to communicate to the virtual machine. - - diff --git a/website/content/partials/builder/virtualbox/common/ExportConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/ExportConfig-not-required.mdx deleted file mode 100644 index 93cfdc727..000000000 --- a/website/content/partials/builder/virtualbox/common/ExportConfig-not-required.mdx +++ /dev/null @@ -1,60 +0,0 @@ - - -- `format` (string) - Either ovf or ova, this specifies the output format - of the exported virtual machine. This defaults to ovf. - -- `export_opts` ([]string) - Additional options to pass to the [VBoxManage - export](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export). - This can be useful for passing product information to include in the - resulting appliance file. Packer JSON configuration file example: - - In JSON: - ```json - { - "type": "virtualbox-iso", - "export_opts": - [ - "--manifest", - "--vsys", "0", - "--description", "{{user `vm_description`}}", - "--version", "{{user `vm_version`}}" - ], - "format": "ova", - } - ``` - - In HCL2: - ```hcl - source "virtualbox-iso" "basic-example" { - export_opts = [ - "--manifest", - "--vsys", "0", - "--description", "{{user `vm_description`}}", - "--version", "{{user `vm_version`}}" - ] - format = "ova" - } - ``` - - A VirtualBox [VM - description](https://www.virtualbox.org/manual/ch09.html#vboxmanage-export-ovf) - may contain arbitrary strings; the GUI interprets HTML formatting. However, - the JSON format does not allow arbitrary newlines within a value. Add a - multi-line description by preparing the string in the shell before the - packer call like this (shell `>` continuation character snipped for easier - copy & paste): - - ```shell - vm_description='some - multiline - description' - - vm_version='0.2.0' - - packer build \ - -var "vm_description=${vm_description}" \ - -var "vm_version=${vm_version}" \ - "packer_conf.json" - ``` - - diff --git a/website/content/partials/builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx deleted file mode 100644 index 47d8467aa..000000000 --- a/website/content/partials/builder/virtualbox/common/GuestAdditionsConfig-not-required.mdx +++ /dev/null @@ -1,34 +0,0 @@ - - -- `guest_additions_mode` (string) - The method by which guest additions are - made available to the guest for installation. Valid options are `upload`, - `attach`, or `disable`. If the mode is `attach` the guest additions ISO will - be attached as a CD device to the virtual machine. If the mode is `upload` - the guest additions ISO will be uploaded to the path specified by - `guest_additions_path`. The default value is `upload`. If `disable` is used, - guest additions won't be downloaded, either. - -- `guest_additions_interface` (string) - The interface type to use to mount guest additions when - guest_additions_mode is set to attach. Will default to the value set in - iso_interface, if iso_interface is set. Will default to "ide", if - iso_interface is not set. Options are "ide" and "sata". - -- `guest_additions_path` (string) - The path on the guest virtual machine - where the VirtualBox guest additions ISO will be uploaded. By default this - is `VBoxGuestAdditions.iso` which should upload into the login directory of - the user. This is a [configuration - template](/docs/templates/legacy_json_templates/engine) where the `Version` - variable is replaced with the VirtualBox version. - -- `guest_additions_sha256` (string) - The SHA256 checksum of the guest - additions ISO that will be uploaded to the guest VM. By default the - checksums will be downloaded from the VirtualBox website, so this only needs - to be set if you want to be explicit about the checksum. - -- `guest_additions_url` (string) - The URL of the guest additions ISO - to upload. This can also be a file URL if the ISO is at a local path. By - default, the VirtualBox builder will attempt to find the guest additions ISO - on the local file system. If it is not available locally, the builder will - download the proper guest additions ISO from the internet. - - diff --git a/website/content/partials/builder/virtualbox/common/HWConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/HWConfig-not-required.mdx deleted file mode 100644 index c00285778..000000000 --- a/website/content/partials/builder/virtualbox/common/HWConfig-not-required.mdx +++ /dev/null @@ -1,16 +0,0 @@ - - -- `cpus` (int) - The number of cpus to use for building the VM. - Defaults to 1. - -- `memory` (int) - The amount of memory to use for building the VM - in megabytes. Defaults to 512 megabytes. - -- `sound` (string) - Defaults to none. The type of audio device to use for - sound when building the VM. Some of the options that are available are - dsound, oss, alsa, pulse, coreaudio, null. - -- `usb` (bool) - Specifies whether or not to enable the USB bus when - building the VM. Defaults to false. - - diff --git a/website/content/partials/builder/virtualbox/common/OutputConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/OutputConfig-not-required.mdx deleted file mode 100644 index b9ee868f5..000000000 --- a/website/content/partials/builder/virtualbox/common/OutputConfig-not-required.mdx +++ /dev/null @@ -1,14 +0,0 @@ - - -- `output_directory` (string) - This is the path to the directory where the - resulting virtual machine will be created. This may be relative or absolute. - If relative, the path is relative to the working directory when packer - is executed. This directory must not exist or be empty prior to running - the builder. By default this is output-BUILDNAME where "BUILDNAME" is the - name of the build. - -- `output_filename` (string) - This is the base name of the file (excluding the file extension) where - the resulting virtual machine will be created. By default this is the - `vm_name`. - - diff --git a/website/content/partials/builder/virtualbox/common/RunConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/RunConfig-not-required.mdx deleted file mode 100644 index 00d6bd41a..000000000 --- a/website/content/partials/builder/virtualbox/common/RunConfig-not-required.mdx +++ /dev/null @@ -1,19 +0,0 @@ - - -- `headless` (bool) - Packer defaults to building VirtualBox virtual - machines by launching a GUI that shows the console of the machine - being built. When this value is set to true, the machine will start - without a console. - -- `vrdp_bind_address` (string) - The IP address that should be - binded to for VRDP. By default packer will use 127.0.0.1 for this. If you - wish to bind to all interfaces use 0.0.0.0. - -- `vrdp_port_min` (int) - The minimum and maximum port - to use for VRDP access to the virtual machine. Packer uses a randomly chosen - port in this range that appears available. By default this is 5900 to - 6000. The minimum and maximum ports are inclusive. - -- `vrdp_port_max` (int) - VRDP Port Max - - diff --git a/website/content/partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx deleted file mode 100644 index 5b1489a2c..000000000 --- a/website/content/partials/builder/virtualbox/common/ShutdownConfig-not-required.mdx +++ /dev/null @@ -1,31 +0,0 @@ - - -- `shutdown_command` (string) - The command to use to gracefully shut down the - machine once all the provisioning is done. By default this is an empty - string, which tells Packer to just forcefully shut down the machine unless a - shutdown command takes place inside script so this may safely be omitted. If - one or more scripts require a reboot it is suggested to leave this blank - since reboots may fail and specify the final shutdown command in your - last script. - -- `shutdown_timeout` (duration string | ex: "1h5m2s") - The amount of time to wait after executing the - shutdown_command for the virtual machine to actually shut down. If it - doesn't shut down in this time, it is an error. By default, the timeout is - 5m or five minutes. - -- `post_shutdown_delay` (duration string | ex: "1h5m2s") - The amount of time to wait after shutting - down the virtual machine. If you get the error - Error removing floppy controller, you might need to set this to 5m - or so. By default, the delay is 0s or disabled. - -- `disable_shutdown` (bool) - Packer normally halts the virtual machine after all provisioners have - run when no `shutdown_command` is defined. If this is set to `true`, Packer - *will not* halt the virtual machine but will assume that you will send the stop - signal yourself through the preseed.cfg or your final provisioner. - Packer will wait for a default of 5 minutes until the virtual machine is shutdown. - The timeout can be changed using `shutdown_timeout` option. - -- `acpi_shutdown` (bool) - If it's set to true, it will shutdown the VM via power button. It could be a good option - when keeping the machine state is necessary after shutting it down. - - diff --git a/website/content/partials/builder/virtualbox/common/VBoxBundleConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/VBoxBundleConfig-not-required.mdx deleted file mode 100644 index 0a243080a..000000000 --- a/website/content/partials/builder/virtualbox/common/VBoxBundleConfig-not-required.mdx +++ /dev/null @@ -1,8 +0,0 @@ - - -- `bundle_iso` (bool) - Defaults to false. When enabled, Packer includes - any attached ISO disc devices into the final virtual machine. Useful for - some live distributions that require installation media to continue to be - attached after installation. - - diff --git a/website/content/partials/builder/virtualbox/common/VBoxManageConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/VBoxManageConfig-not-required.mdx deleted file mode 100644 index 01441878b..000000000 --- a/website/content/partials/builder/virtualbox/common/VBoxManageConfig-not-required.mdx +++ /dev/null @@ -1,36 +0,0 @@ - - -- `vboxmanage` ([][]string) - Custom `VBoxManage` commands to execute in order to further customize - the virtual machine being created. The example shown below sets the memory and number of CPUs - within the virtual machine: - - In JSON: - ```json - "vboxmanage": [ - ["modifyvm", "{{.Name}}", "--memory", "1024"], - ["modifyvm", "{{.Name}}", "--cpus", "2"] - ] - ``` - - In HCL2: - ```hcl - vboxmanage = [ - ["modifyvm", "{{.Name}}", "--memory", "1024"], - ["modifyvm", "{{.Name}}", "--cpus", "2"], - ] - ``` - - The value of `vboxmanage` is an array of commands to execute. These commands are - executed in the order defined. So in the above example, the memory will be set - followed by the CPUs. - Each command itself is an array of strings, where each string is an argument to - `VBoxManage`. Each argument is treated as a [configuration - template](/docs/templates/legacy_json_templates/engine). The only available - variable is `Name` which is replaced with the unique name of the VM, which is - required for many VBoxManage calls. - -- `vboxmanage_post` ([][]string) - Identical to vboxmanage, - except that it is run after the virtual machine is shutdown, and before the - virtual machine is exported. - - diff --git a/website/content/partials/builder/virtualbox/common/VBoxManageConfig.mdx b/website/content/partials/builder/virtualbox/common/VBoxManageConfig.mdx deleted file mode 100644 index d324b7be4..000000000 --- a/website/content/partials/builder/virtualbox/common/VBoxManageConfig.mdx +++ /dev/null @@ -1,9 +0,0 @@ - - -In order to perform extra customization of the virtual machine, a template can -define extra calls to `VBoxManage` to perform. -[VBoxManage](https://www.virtualbox.org/manual/ch09.html) is the command-line -interface to VirtualBox where you can completely control VirtualBox. It can be -used to do things such as set RAM, CPUs, etc. - - diff --git a/website/content/partials/builder/virtualbox/common/VBoxVersionConfig-not-required.mdx b/website/content/partials/builder/virtualbox/common/VBoxVersionConfig-not-required.mdx deleted file mode 100644 index cf1f6d808..000000000 --- a/website/content/partials/builder/virtualbox/common/VBoxVersionConfig-not-required.mdx +++ /dev/null @@ -1,10 +0,0 @@ - - -- `virtualbox_version_file` (\*string) - The path within the virtual machine to - upload a file that contains the VirtualBox version that was used to create - the machine. This information can be useful for provisioning. By default - this is .vbox_version, which will generally be upload it into the - home directory. Set to an empty string to skip uploading this file, which - can be useful when using the none communicator. - - diff --git a/website/content/partials/builder/virtualbox/iso/Config-not-required.mdx b/website/content/partials/builder/virtualbox/iso/Config-not-required.mdx deleted file mode 100644 index 646296d11..000000000 --- a/website/content/partials/builder/virtualbox/iso/Config-not-required.mdx +++ /dev/null @@ -1,123 +0,0 @@ - - -- `chipset` (string) - The chipset to be used: PIIX3 or ICH9. - When set to piix3, the firmare is PIIX3. This is the default. - When set to ich9, the firmare is ICH9. - -- `firmware` (string) - The firmware to be used: BIOS or EFI. - When set to bios, the firmare is BIOS. This is the default. - When set to efi, the firmare is EFI. - -- `nested_virt` (bool) - Nested virtualization: false or true. - When set to true, nested virtualisation (VT-x/AMD-V) is enabled. - When set to false, nested virtualisation is disabled. This is the default. - -- `rtc_time_base` (string) - RTC time base: UTC or local. - When set to true, the RTC is set as UTC time. - When set to false, the RTC is set as local time. This is the default. - -- `disk_size` (uint) - The size, in megabytes, of the hard disk to create for the VM. By - default, this is 40000 (about 40 GB). - -- `nic_type` (string) - The NIC type to be used for the network interfaces. - When set to 82540EM, the NICs are Intel PRO/1000 MT Desktop (82540EM). This is the default. - When set to 82543GC, the NICs are Intel PRO/1000 T Server (82543GC). - When set to 82545EM, the NICs are Intel PRO/1000 MT Server (82545EM). - When set to Am79C970A, the NICs are AMD PCNet-PCI II network card (Am79C970A). - When set to Am79C973, the NICs are AMD PCNet-FAST III network card (Am79C973). - When set to Am79C960, the NICs are AMD PCnet-ISA/NE2100 (Am79C960). - When set to virtio, the NICs are VirtIO. - -- `audio_controller` (string) - The audio controller type to be used. - When set to ac97, the audio controller is ICH AC97. This is the default. - When set to hda, the audio controller is Intel HD Audio. - When set to sb16, the audio controller is SoundBlaster 16. - -- `gfx_controller` (string) - The graphics controller type to be used. - When set to vboxvga, the graphics controller is VirtualBox VGA. This is the default. - When set to vboxsvga, the graphics controller is VirtualBox SVGA. - When set to vmsvga, the graphics controller is VMware SVGA. - When set to none, the graphics controller is disabled. - -- `gfx_vram_size` (uint) - The VRAM size to be used. By default, this is 4 MiB. - -- `gfx_accelerate_3d` (bool) - 3D acceleration: true or false. - When set to true, 3D acceleration is enabled. - When set to false, 3D acceleration is disabled. This is the default. - -- `gfx_efi_resolution` (string) - Screen resolution in EFI mode: WIDTHxHEIGHT. - When set to WIDTHxHEIGHT, it provides the given width and height as screen resolution - to EFI, for example 1920x1080 for Full-HD resolution. By default, no screen resolution - is set. Note, that this option only affects EFI boot, not the (default) BIOS boot. - -- `guest_os_type` (string) - The guest OS type being installed. By default this is other, but you can - get dramatic performance improvements by setting this to the proper - value. To view all available values for this run VBoxManage list - ostypes. Setting the correct value hints to VirtualBox how to optimize - the virtual hardware to work best with that operating system. - -- `hard_drive_discard` (bool) - When this value is set to true, a VDI image will be shrunk in response - to the trim command from the guest OS. The size of the cleared area must - be at least 1MB. Also set hard_drive_nonrotational to true to enable - TRIM support. - -- `hard_drive_interface` (string) - The type of controller that the primary hard drive is attached to, - defaults to ide. When set to sata, the drive is attached to an AHCI SATA - controller. When set to scsi, the drive is attached to an LsiLogic SCSI - controller. When set to pcie, the drive is attached to an NVMe - controller. When set to virtio, the drive is attached to a VirtIO - controller. Please note that when you use "pcie", you'll need to have - Virtualbox 6, install an [extension - pack](https://www.virtualbox.org/wiki/Downloads#VirtualBox6.0.14OracleVMVirtualBoxExtensionPack) - and you will need to enable EFI mode for nvme to work, ex: - - In JSON: - ```json - "vboxmanage": [ - [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ], - ] - ``` - - In HCL2: - ```hcl - vboxmanage = [ - [ "modifyvm", "{{.Name}}", "--firmware", "EFI" ], - ] - ``` - -- `sata_port_count` (int) - The number of ports available on any SATA controller created, defaults - to 1. VirtualBox supports up to 30 ports on a maximum of 1 SATA - controller. Increasing this value can be useful if you want to attach - additional drives. - -- `nvme_port_count` (int) - The number of ports available on any NVMe controller created, defaults - to 1. VirtualBox supports up to 255 ports on a maximum of 1 NVMe - controller. Increasing this value can be useful if you want to attach - additional drives. - -- `hard_drive_nonrotational` (bool) - Forces some guests (i.e. Windows 7+) to treat disks as SSDs and stops - them from performing disk fragmentation. Also set hard_drive_discard to - true to enable TRIM support. - -- `iso_interface` (string) - The type of controller that the ISO is attached to, defaults to ide. - When set to sata, the drive is attached to an AHCI SATA controller. - When set to virtio, the drive is attached to a VirtIO controller. - -- `disk_additional_size` ([]uint) - Additional disks to create. Uses `vm_name` as the disk name template and - appends `-#` where `#` is the position in the array. `#` starts at 1 since 0 - is the default disk. Each value represents the disk image size in MiB. - Each additional disk uses the same disk parameters as the default disk. - Unset by default. - -- `keep_registered` (bool) - Set this to true if you would like to keep the VM registered with - virtualbox. Defaults to false. - -- `skip_export` (bool) - Defaults to false. When enabled, Packer will not export the VM. Useful - if the build output is not the resultant image, but created inside the - VM. - -- `vm_name` (string) - This is the name of the OVF file for the new virtual machine, without - the file extension. By default this is packer-BUILDNAME, where - "BUILDNAME" is the name of the build. - - diff --git a/website/content/partials/builder/virtualbox/ovf/Config-not-required.mdx b/website/content/partials/builder/virtualbox/ovf/Config-not-required.mdx deleted file mode 100644 index 0071a0830..000000000 --- a/website/content/partials/builder/virtualbox/ovf/Config-not-required.mdx +++ /dev/null @@ -1,26 +0,0 @@ - - -- `import_flags` ([]string) - Additional flags to pass to - VBoxManage import. This can be used to add additional command-line flags - such as --eula-accept to accept a EULA in the OVF. - -- `import_opts` (string) - Additional options to pass to the - VBoxManage import. This can be useful for passing keepallmacs or - keepnatmacs options for existing ovf images. - -- `target_path` (string) - The path where the OVA should be saved - after download. By default, it will go in the packer cache, with a hash of - the original filename as its name. - -- `vm_name` (string) - This is the name of the OVF file for the new virtual - machine, without the file extension. By default this is packer-BUILDNAME, - where "BUILDNAME" is the name of the build. - -- `keep_registered` (bool) - Set this to true if you would like to keep - the VM registered with virtualbox. Defaults to false. - -- `skip_export` (bool) - Defaults to false. When enabled, Packer will - not export the VM. Useful if the build output is not the resultant image, - but created inside the VM. - - diff --git a/website/content/partials/builder/virtualbox/ovf/Config-required.mdx b/website/content/partials/builder/virtualbox/ovf/Config-required.mdx deleted file mode 100644 index a52dd56bb..000000000 --- a/website/content/partials/builder/virtualbox/ovf/Config-required.mdx +++ /dev/null @@ -1,27 +0,0 @@ - - -- `checksum` (string) - The checksum for the source_path file. The type of the checksum is - specified within the checksum field as a prefix, ex: "md5:{$checksum}". - The type of the checksum can also be omitted and Packer will try to - infer it based on string length. Valid values are "none", "{$checksum}", - "md5:{$checksum}", "sha1:{$checksum}", "sha256:{$checksum}", - "sha512:{$checksum}" or "file:{$path}". Here is a list of valid checksum - values: - * md5:090992ba9fd140077b0661cb75f7ce13 - * 090992ba9fd140077b0661cb75f7ce13 - * sha1:ebfb681885ddf1234c18094a45bbeafd91467911 - * ebfb681885ddf1234c18094a45bbeafd91467911 - * sha256:ed363350696a726b7932db864dda019bd2017365c9e299627830f06954643f93 - * ed363350696a726b7932db864dda019bd2017365c9e299627830f06954643f93 - * file:http://releases.ubuntu.com/20.04/SHA256SUMS - * file:file://./local/path/file.sum - * file:./local/path/file.sum - * none - Although the checksum will not be verified when it is set to "none", - this is not recommended since these files can be very large and - corruption does happen from time to time. - -- `source_path` (string) - The filepath or URL to an OVF or OVA file that acts as the - source of this build. - - diff --git a/website/content/partials/builder/virtualbox/ovf/Config.mdx b/website/content/partials/builder/virtualbox/ovf/Config.mdx deleted file mode 100644 index bf8ad1a6b..000000000 --- a/website/content/partials/builder/virtualbox/ovf/Config.mdx +++ /dev/null @@ -1,5 +0,0 @@ - - -Config is the configuration structure for the builder. - - diff --git a/website/content/partials/builder/virtualbox/vm/Config-not-required.mdx b/website/content/partials/builder/virtualbox/vm/Config-not-required.mdx deleted file mode 100644 index 3504ad269..000000000 --- a/website/content/partials/builder/virtualbox/vm/Config-not-required.mdx +++ /dev/null @@ -1,29 +0,0 @@ - - -- `attach_snapshot` (string) - Default to `null/empty`. The name of an - **existing** snapshot to which the builder shall attach the VM before - starting it. If no snapshot is specified the builder will simply start the - VM from it's current state i.e. snapshot. - -- `target_snapshot` (string) - Default to `null/empty`. The name of the - snapshot which shall be created after all provisioners has been run by the - builder. If no target snapshot is specified and `keep_registered` is set to - `false` the builder will revert to the snapshot to which the VM was attached - before the builder has been executed, which will revert all changes applied - by the provisioners. This is handy if only an export shall be created and no - further snapshot is required. - -- `force_delete_snapshot` (bool) - Defaults to `false`. If set to `true`, - overwrite an existing `target_snapshot`. Otherwise the builder will yield an - error if the specified target snapshot already exists. - -- `keep_registered` (bool) - Set this to `true` if you would like to keep - the VM attached to the snapshot specified by `attach_snapshot`. Otherwise - the builder will reset the VM to the snapshot to which the VM was attached - before the builder started. Defaults to `false`. - -- `skip_export` (bool) - Defaults to `false`. When enabled, Packer will - not export the VM. Useful if the builder should be applied again on the created - target snapshot. - - diff --git a/website/content/partials/builder/virtualbox/vm/Config-required.mdx b/website/content/partials/builder/virtualbox/vm/Config-required.mdx deleted file mode 100644 index de27938dd..000000000 --- a/website/content/partials/builder/virtualbox/vm/Config-required.mdx +++ /dev/null @@ -1,6 +0,0 @@ - - -- `vm_name` (string) - This is the name of the virtual machine to which the - builder shall attach. - - diff --git a/website/content/partials/builder/virtualbox/vm/Config.mdx b/website/content/partials/builder/virtualbox/vm/Config.mdx deleted file mode 100644 index 46485ac7a..000000000 --- a/website/content/partials/builder/virtualbox/vm/Config.mdx +++ /dev/null @@ -1,5 +0,0 @@ - - -Config is the configuration structure for the builder. - - diff --git a/website/content/partials/builders/virtualbox-ssh-key-pair.mdx b/website/content/partials/builders/virtualbox-ssh-key-pair.mdx deleted file mode 100644 index 543ab686d..000000000 --- a/website/content/partials/builders/virtualbox-ssh-key-pair.mdx +++ /dev/null @@ -1,70 +0,0 @@ -### SSH key pair automation - -The VirtualBox builders can inject the current SSH key pair's public key into -the template using the `SSHPublicKey` template engine. This is the SSH public -key as a line in OpenSSH authorized_keys format. - -When a private key is provided using `ssh_private_key_file`, the key's -corresponding public key can be accessed using the above engine. - -@include 'packer-plugin-sdk/communicator/SSH-Private-Key-File-not-required.mdx' - -If `ssh_password` and `ssh_private_key_file` are not specified, Packer will -automatically generate en ephemeral key pair. The key pair's public key can -be accessed using the template engine. - -For example, the public key can be provided in the boot command as a URL -encoded string by appending `| urlquery` to the variable: - -In JSON: - -```json -"boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}" -] -``` - -In HCL2: - -```hcl -boot_command = [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}" -] -``` - -A kickstart could then leverage those fields from the kernel command line by -decoding the URL-encoded public key: - -```shell -%post - -# Newly created users need the file/folder framework for SSH key authentication. -umask 0077 -mkdir /etc/skel/.ssh -touch /etc/skel/.ssh/authorized_keys - -# Loop over the command line. Set interesting variables. -for x in $(cat /proc/cmdline) -do - case $x in - PACKER_USER=*) - PACKER_USER="${x#*=}" - ;; - PACKER_AUTHORIZED_KEY=*) - # URL decode $encoded into $PACKER_AUTHORIZED_KEY - encoded=$(echo "${x#*=}" | tr '+' ' ') - printf -v PACKER_AUTHORIZED_KEY '%b' "${encoded//%/\\x}" - ;; - esac -done - -# Create/configure packer user, if any. -if [ -n "$PACKER_USER" ] -then - useradd $PACKER_USER - echo "%$PACKER_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$PACKER_USER - [ -n "$PACKER_AUTHORIZED_KEY" ] && echo $PACKER_AUTHORIZED_KEY >> $(eval echo ~"$PACKER_USER")/.ssh/authorized_keys -fi - -%end -``` diff --git a/website/data/docs-nav-data.json b/website/data/docs-nav-data.json index c9b8ca2a2..3aa0624b1 100644 --- a/website/data/docs-nav-data.json +++ b/website/data/docs-nav-data.json @@ -877,27 +877,6 @@ "title": "Vagrant", "path": "builders/vagrant" }, - { - "title": "VirtualBox", - "routes": [ - { - "title": "Overview", - "path": "builders/virtualbox" - }, - { - "title": "ISO", - "path": "builders/virtualbox/iso" - }, - { - "title": "OVF", - "path": "builders/virtualbox/ovf" - }, - { - "title": "VM", - "path": "builders/virtualbox/vm" - } - ] - }, { "title": "VMware", "routes": [ diff --git a/website/data/docs-remote-plugins.json b/website/data/docs-remote-plugins.json index c7f9ea5d2..ac0c531a5 100644 --- a/website/data/docs-remote-plugins.json +++ b/website/data/docs-remote-plugins.json @@ -22,5 +22,11 @@ "path": "ansible", "repo": "hashicorp/packer-plugin-ansible", "version": "latest" + }, + { + "title": "VirtualBox", + "path": "virtualbox", + "repo": "hashicorp/packer-plugin-virtualbox", + "version": "latest" } ]