provider/openstack: gophercloud migration: Fix handling of Neutron networking when managing instances.

This commit is contained in:
Gavin Williams 2016-10-06 15:21:21 +01:00 committed by Joe Topjian
parent e36c3e5946
commit a823370a48
1 changed files with 5 additions and 4 deletions

View File

@ -965,18 +965,19 @@ func getInstanceNetworks(computeClient *gophercloud.ServiceClient, d *schema.Res
allPages, err := tenantnetworks.List(computeClient).AllPages() allPages, err := tenantnetworks.List(computeClient).AllPages()
if err != nil { if err != nil {
if _, ok := err.(gophercloud.ErrDefault404); ok { if _, ok := err.(gophercloud.ErrDefault404); ok {
log.Println("[DEBUG] os-tenant-networks disabled")
tenantNetworkExt = false tenantNetworkExt = false
} }
log.Println("[DEBUG] Err looks like: %+v", err)
if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok { if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok {
if errCode.Actual == 403 { if errCode.Actual == 403 {
log.Println("[DEBUG] os-tenant-networks disabled.")
tenantNetworkExt = false tenantNetworkExt = false
} else {
return nil, err
} }
return nil, err
} }
return nil, err
} }
networkID := "" networkID := ""