-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PACKER_HTTP_ADDR variable not being set correctly #9973
Comments
Thanks for reaching out. We’ll take a look when we get a chance |
Working around it by using an additional variable for the ip address, the HTTP server seems to be responding to requests just fine, it just sets the wrong value
|
I think I found by myself this bug. Instead of opening a new issue I'll try to contribute here. This is my experience. I have a builder machine with 3 different NICs. One of them is connected to my workstation, another to the VMware VCenter network and the last one is exposed to the VM to be packed. I noticed that in this comment the code is supposed to put the address used to bind the web server inside the state. There is only a reference to the port, though. I tried to add a line like this Should I propose a PR or will it be addressed by the maintainers? |
I would suggest proposing a PR, will make life easier for the maintainers, so the chance of it being fixed in an upcoming version will be higher. |
@redgryphon I'm running into this issue as well. Thanks for working on the PR. |
@redgryphon Same issue too. If you need someone for testing your pr, just ask :) |
when a packer server has more then one NIC, Packer can often select the wrong http server using {{ .HTTPIP }}. We extend the variables file to include an http_server_address which can be set to the IP address of the correct NIC. This configuration propagates down to the http_bind_address directive of the builder and the boot_command entered on the guest VM. Adding 0.0.0.0 as a reasonable default as it preserves comptability with packers default behavior. This commit was required to get Packer to build the ubuntu guest successfully in our environment Additional Reading: hashicorp/packer#9973 https://www.packer.io/docs/builders/vmware/vsphere-iso#http-directory-configuration
This issue has been automatically migrated to hashicorp/packer-plugin-vsphere#10 because it looks like an issue with that plugin. If you believe this is not an issue with the plugin, please reply to hashicorp/packer-plugin-vsphere#10. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Issue;
While trying to use the http_directory directive, packer binds to the correct local interface/address and can be accessed by both Host and guest as expected, however the $env:packer_http_address variable does not get set to the same bind address. It will either get set to an apipa address or pick up an address from a random interface.
Packer: 1.6.2(tried 1.60 with same result)
Builder: vsphere-iso
Host: Wndow 2004 (19041.508)
vCenter: 6.7.0.10000
esxi: 6.7.0, 15018017
Interfaces present - https://gist.github.com/DarrenF-G/8b5c6d010b066bbd79d8460410adb071
Packer log for windows 10 build - https://gist.github.com/DarrenF-G/959bfd8fb7dcb0192d5092d609a4dbba
Packer log for Ubuntu build - https://gist.github.com/DarrenF-G/0b931613860185e43662db2dcaec8f5c
Example json - https://gist.github.com/DarrenF-G/17753bd304235539877c1c423d9cbaad
if I step though the windows post-deployment and and run
cat C:\Windows\Temp\packer-ps-env-vars-5f6341e7-d0d7-b303-d15a-531e95ab11a3.ps1
I get;
$env:PACKER_BUILDER_TYPE="vsphere-iso"; $env:PACKER_BUILD_NAME="vsphere-iso"; $env:PACKER_HTTP_ADDR="172.22.32.1:8067"; $env:PACKER_HTTP_IP="172.22.32.1"; $env:PACKER_HTTP_PORT="8067";
as no http server is binding on 172.22.32.1 i am unable to pull down files using this variable.
Tried to replicate it on another windows host with only one interface and get the same result, it sets the address as 169.* instead of my local IP.
I also tried an ubuntu image too as it uses http.ip and http.port but it also sets the variables to a 169.* address when it should set it to a 10.* address(see the above logs)
Let me know if you need any further information
The text was updated successfully, but these errors were encountered: