-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add support for IP address changes #62
base: main
Are you sure you want to change the base?
Conversation
JFYI This Merge Request didn't work for me - same issue
|
Thank you for this feedback @sjevs! The PR has worked flawlessly for me. Could you describe in more detail how to reproduce the fault you described? A minimal set of steps to reproduce the issue would be preferable, that way I can start to work on a fix directly. Or if possible, please post the complete Packer HCL file that you are using when this error occurs. Thanks! |
b5fc2d3
to
d25dc0f
Compare
while your'e at it |
d25dc0f
to
01d5455
Compare
@hoerup I could definitely take a look at that. However, I believe that should be a separate issue/pull request, no? If you think it's OK to include it in this PR, I can take care of that! |
01d5455
to
b9d8cb6
Compare
This commit improves upon the existing "Wait for IP step", by continuously checking for changes to the IP address for the VM, even after the IP address has been retrieved. The implementation is using a simple goroutine which encapsulates the existing method used to wait for the IP address. When an IP address has been found, the goroutine will put the IP address directly in the state, which will be queried when the IP address should be retrieved.
b9d8cb6
to
2376943
Compare
} | ||
}(*c, ui, config) | ||
|
||
time.Sleep(500 * time.Millisecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this time.Sleep
?
Predicate: func() (result bool, err error) { | ||
var ok bool | ||
if ip, ok = state.Get("instance_ssh_address").(string); ok && ip != "" { | ||
return true, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the InterruptibleWait
could still return a stale value. I'm wondering if it makes sense to introduce a minimum wait time to prevent the Predicate
from resolving early. This would allow end users to further delay resolving the predicate if the default runtime isn't enough time for their DHCP to converge. I think we could account for the existing time.Sleep
call above as the default for this value.
In addition to that, it looks like the Timeout is hard coded to 300 seconds for the xva builder (source). We should update to be consistent with the iso version so the maximum can be tuned as well.
@Erik142 sorry for the delay. The overall idea sounds good to me. I have a few questions about hardening a bit to make sure if there is still a race with DHCP converging, that it can be tuned appropriately. |
This PR improves upon the existing "Wait for IP step", by continuously checking for changes to the IP address for the VM, even after the IP address has been retrieved.
The implementation is using a simple goroutine which encapsulates the existing method used to wait for the IP address. When an IP address has been found, the goroutine will put the IP address directly in the state, which will be queried when the IP address should be retrieved.
A minor customization has been made to the "SSH port forward step", to retrieve the IP address from the state instead of using a string variable.
Closes #61