hashicorp / packer-plugin-virtualbox

Packer plugin for VritualBox Builder
https://www.packer.io/docs/builders/virtualbox
Mozilla Public License 2.0
22 stars 36 forks source link

step_port_forward: add access to localhost if necessary #122

Closed pdietl closed 6 months ago

pdietl commented 8 months ago

Closes #104

For Virtualbox versions >= 7.0, access to the host's network (via 10.0.2.2) is blocked by default unless the --nat-localhostreachableN=on option is used.

hashicorp-cla commented 8 months ago

CLA assistant check
All committers have signed the CLA.

pdietl commented 7 months ago

@nywilken could you take a look at this?

pdietl commented 6 months ago

@lbajolet-hashicorp I believe I addressed all of your comments.

pdietl commented 6 months ago

@lbajolet-hashicorp I can also add unit tests if you'd like.

lbajolet-hashicorp commented 6 months ago

@lbajolet-hashicorp I can also add unit tests if you'd like.

If you have time for them, this would definitely be appreciated, thanks!

pdietl commented 6 months ago

@lbajolet-hashicorp I added unit tests, formatted, and fixed compilation errors. Here is some output of it working locally for me:

2024/02/28 17:41:17 packer-plugin-virtualbox plugin: 2024/02/28 17:41:17 VBoxManage --version output: 7.0.15r161716
2024/02/28 17:41:17 packer-plugin-virtualbox plugin: 2024/02/28 17:41:17 VirtualBox version: 7.0.15
2024/02/28 17:41:17 packer-plugin-virtualbox plugin: 2024/02/28 17:41:17 Executing VBoxManage: []string{"modifyvm", "packer-virtualbox-1709170875", "--nat-localhostreachable1", "on"}
2024/02/28 17:41:17 packer-plugin-virtualbox plugin: 2024/02/28 17:41:17 stdout:
2024/02/28 17:41:17 packer-plugin-virtualbox plugin: 2024/02/28 17:41:17 stderr:
2024/02/28 17:41:17 packer-plugin-virtualbox plugin: 2024/02/28 17:41:17 [TRACE] VirtualBox's version ("v7.0.15") is >= "v7.0.0", setting --nat-localhostreachable1 on
pdietl commented 6 months ago

Also, I would appreciate it if you could release a new version after accepting this. :)