builder/virtualbox,vmware: work if port range for HTTP is 0 [GH-53]
This commit is contained in:
parent
222f47dac8
commit
8aaadf354a
|
@ -4,6 +4,10 @@ BUG FIXES:
|
|||
|
||||
* core: plugins listen explicitly on 127.0.0.1, fixing odd hangs. [GH-37]
|
||||
* virtualbox: `boot_wait` defaults to "10s" rather than 0. [GH-44]
|
||||
* virtualbox: if `http_port_min` and max are the same, it will no longer
|
||||
panic [GH-53]
|
||||
* vmware: if `http_port_min` and max are the same, it will no longer
|
||||
panic [GH-53]
|
||||
|
||||
## 0.1.0 (June 28, 2013)
|
||||
|
||||
|
|
|
@ -38,7 +38,14 @@ func (s *stepHTTPServer) Run(state map[string]interface{}) multistep.StepAction
|
|||
portRange := int(config.HTTPPortMax - config.HTTPPortMin)
|
||||
for {
|
||||
var err error
|
||||
httpPort = uint(rand.Intn(portRange)) + config.HTTPPortMin
|
||||
var offset uint = 0
|
||||
|
||||
if portRange > 0 {
|
||||
// Intn will panic if portRange == 0, so we do a check.
|
||||
offset = uint(rand.Intn(portRange))
|
||||
}
|
||||
|
||||
httpPort = offset + config.HTTPPortMin
|
||||
httpAddr = fmt.Sprintf(":%d", httpPort)
|
||||
log.Printf("Trying port: %d", httpPort)
|
||||
s.l, err = net.Listen("tcp", httpAddr)
|
||||
|
|
|
@ -38,7 +38,14 @@ func (s *stepHTTPServer) Run(state map[string]interface{}) multistep.StepAction
|
|||
portRange := int(config.HTTPPortMax - config.HTTPPortMin)
|
||||
for {
|
||||
var err error
|
||||
httpPort = uint(rand.Intn(portRange)) + config.HTTPPortMin
|
||||
var offset uint = 0
|
||||
|
||||
if portRange > 0 {
|
||||
// Intn will panic if portRange == 0, so we do a check.
|
||||
offset = uint(rand.Intn(portRange))
|
||||
}
|
||||
|
||||
httpPort = offset + config.HTTPPortMin
|
||||
httpAddr = fmt.Sprintf(":%d", httpPort)
|
||||
log.Printf("Trying port: %d", httpPort)
|
||||
s.l, err = net.Listen("tcp", httpAddr)
|
||||
|
|
Loading…
Reference in New Issue