@@ -20,6 +20,7 @@ import (
2020 "github.com/IBM/platform-services-go-sdk/resourcemanagerv2"
2121 "github.com/IBM/vpc-go-sdk/vpcv1"
2222 "github.com/pkg/errors"
23+ "github.com/sirupsen/logrus"
2324
2425 configv1 "github.com/openshift/api/config/v1"
2526 "github.com/openshift/installer/pkg/asset/installconfig/ibmcloud/responses"
@@ -581,8 +582,13 @@ func (c *Client) GetVPC(ctx context.Context, vpcID string) (*vpcv1.VPC, error) {
581582 }
582583
583584 if vpc , detailedResponse , err := c .vpcAPI .GetVPC (c .vpcAPI .NewGetVPCOptions (vpcID )); err != nil {
584- if detailedResponse .GetStatusCode () != http .StatusNotFound {
585- return nil , err
585+ if detailedResponse != nil {
586+ // If the response code signifies the VPC was not found, simply move on to the next region; otherwise we log the response
587+ if detailedResponse .GetStatusCode () != http .StatusNotFound {
588+ logrus .Warnf ("Unexpected response while checking VPC %s in %s region: %s" , vpcID , * region .Name , detailedResponse )
589+ }
590+ } else {
591+ logrus .Warnf ("Failure collecting VPC %s in %s: %q" , vpcID , * region .Name , err )
586592 }
587593 } else if vpc != nil {
588594 return vpc , nil
@@ -629,10 +635,14 @@ func (c *Client) GetVPCByName(ctx context.Context, vpcName string) (*vpcv1.VPC,
629635 return nil , fmt .Errorf ("failed to set vpc api service url: %w" , err )
630636 }
631637
632- vpcs , detailedResponse , err := c .vpcAPI .ListVpcsWithContext (ctx , c .vpcAPI .NewListVpcsOptions ())
633- if err != nil {
634- if detailedResponse .GetStatusCode () != http .StatusNotFound {
635- return nil , err
638+ if vpcs , detailedResponse , err := c .vpcAPI .ListVpcsWithContext (ctx , c .vpcAPI .NewListVpcsOptions ()); err != nil {
639+ if detailedResponse != nil {
640+ // If the response code signifies no VPCs were not found, we simply move on to the next region; otherwise log the response
641+ if detailedResponse .GetStatusCode () != http .StatusNotFound {
642+ logrus .Warnf ("Unexpected response while checking %s region: %s" , * region .Name , detailedResponse )
643+ }
644+ } else {
645+ logrus .Warnf ("Failure collecting VPCs in %s: %q" , * region .Name , err )
636646 }
637647 } else {
638648 for _ , vpc := range vpcs .Vpcs {
0 commit comments