Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions builder/openstack/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package openstack

import (
"errors"
"fmt"
"log"
"time"

Expand Down Expand Up @@ -90,21 +89,22 @@ func sshAddrFromPool(s *servers.Server, desired string, sshIPVersion string) str
for _, element := range elements {
var addr string
address := element.(map[string]interface{})
address_value := address["addr"].(string)
if address["OS-EXT-IPS:type"] == "floating" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of this entire if else workflow now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is needed to use the right precedence (ipv6 > ipv4) and also if explicit config option forces use of v4 or v6.

addr = address["addr"].(string)
addr = address_value
} else if sshIPVersion == "4" {
if address["version"].(float64) == 4 {
addr = address["addr"].(string)
addr = address_value
}
} else if sshIPVersion == "6" {
if address["version"].(float64) == 6 {
addr = fmt.Sprintf("[%s]", address["addr"].(string))
addr = address_value
}
} else {
if address["version"].(float64) == 6 {
addr = fmt.Sprintf("[%s]", address["addr"].(string))
addr = address_value
} else {
addr = address["addr"].(string)
addr = address_value
}
}

Expand Down