Removes check for a "public" network

This is only possible if the OpenStack cloud explicitly has a network
called "public".
This commit is contained in:
Joe Topjian 2015-03-21 02:13:07 +00:00
parent 141b40189e
commit d768a01cab
1 changed files with 0 additions and 28 deletions

View File

@ -331,20 +331,6 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err
d.Set("access_ip_v6", server.AccessIPv6) d.Set("access_ip_v6", server.AccessIPv6)
hostv4 := server.AccessIPv4 hostv4 := server.AccessIPv4
if hostv4 == "" {
if publicAddressesRaw, ok := server.Addresses["public"]; ok {
publicAddresses := publicAddressesRaw.([]interface{})
for _, paRaw := range publicAddresses {
pa := paRaw.(map[string]interface{})
if pa["version"].(float64) == 4 {
hostv4 = pa["addr"].(string)
break
}
}
}
}
// If no host found, just get the first IPv4 we find
if hostv4 == "" { if hostv4 == "" {
for _, networkAddresses := range server.Addresses { for _, networkAddresses := range server.Addresses {
for _, element := range networkAddresses.([]interface{}) { for _, element := range networkAddresses.([]interface{}) {
@ -360,20 +346,6 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err
log.Printf("hostv4: %s", hostv4) log.Printf("hostv4: %s", hostv4)
hostv6 := server.AccessIPv6 hostv6 := server.AccessIPv6
if hostv6 == "" {
if publicAddressesRaw, ok := server.Addresses["public"]; ok {
publicAddresses := publicAddressesRaw.([]interface{})
for _, paRaw := range publicAddresses {
pa := paRaw.(map[string]interface{})
if pa["version"].(float64) == 6 {
hostv6 = fmt.Sprintf("[%s]", pa["addr"].(string))
break
}
}
}
}
// If no hostv6 found, just get the first IPv6 we find
if hostv6 == "" { if hostv6 == "" {
for _, networkAddresses := range server.Addresses { for _, networkAddresses := range server.Addresses {
for _, element := range networkAddresses.([]interface{}) { for _, element := range networkAddresses.([]interface{}) {