diff --git a/builder/virtualbox/step_upload_version.go b/builder/virtualbox/step_upload_version.go index 5f825aaf9..b99cd7f12 100644 --- a/builder/virtualbox/step_upload_version.go +++ b/builder/virtualbox/step_upload_version.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" + "log" ) // This step uploads a file containing the VirtualBox version, which @@ -17,6 +18,11 @@ func (s *stepUploadVersion) Run(state map[string]interface{}) multistep.StepActi driver := state["driver"].(Driver) ui := state["ui"].(packer.Ui) + if config.VBoxVersionFile == "" { + log.Println("VBoxVersionFile is empty. Not uploading.") + return multistep.ActionContinue + } + version, err := driver.Version() if err != nil { state["error"] = fmt.Errorf("Error reading version for metadata upload: %s", err) diff --git a/website/source/docs/builders/virtualbox.html.markdown b/website/source/docs/builders/virtualbox.html.markdown index e5df5066f..8a1ef1383 100644 --- a/website/source/docs/builders/virtualbox.html.markdown +++ b/website/source/docs/builders/virtualbox.html.markdown @@ -129,6 +129,12 @@ Optional: where the `Name` variable is replaced with the VM name. More details on how to use `VBoxManage` are below. +* `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 upload it into + the home directory. If explicitly empty, the version file won't be uploaded. + * `vm_name` (string) - This is the name of the VMX file for the new virtual machine, without the file extension. By default this is "packer".