Skip to content

Commit

Permalink
check whether a network was found
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBurger committed Oct 17, 2024
1 parent ae74b9f commit 8a4b07f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/openstack/helper/error_codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
unauthorizedRegexp = regexp.MustCompile(`(?i)(Unauthorized|SignatureDoesNotMatch|invalid_grant|Authorization Profile was not found|no active subscriptions|not authorized|AccessDenied|PolicyNotAuthorized)`)
quotaExceededRegexp = regexp.MustCompile(`(?i)((?:^|[^t]|(?:[^s]|^)t|(?:[^e]|^)st|(?:[^u]|^)est|(?:[^q]|^)uest|(?:[^e]|^)quest|(?:[^r]|^)equest)LimitExceeded|Quotas|Quota.*exceeded|exceeded quota|Quota has been met|QUOTA_EXCEEDED|Maximum number of ports exceeded|VolumeSizeExceedsAvailableQuota)`)
rateLimitsExceededRegexp = regexp.MustCompile(`(?i)(RequestLimitExceeded|Throttling|Too many requests)`)
dependenciesRegexp = regexp.MustCompile(`(?i)(PendingVerification|Access Not Configured|accessNotConfigured|DependencyViolation|OptInRequired|Conflict|inactive billing state|timeout while waiting for state to become|InvalidCidrBlock|already busy for|internal server error|A resource with the ID|There are not enough hosts available|No Router found)`)
dependenciesRegexp = regexp.MustCompile(`(?i)(PendingVerification|Access Not Configured|accessNotConfigured|DependencyViolation|OptInRequired|Conflict|inactive billing state|timeout while waiting for state to become|InvalidCidrBlock|already busy for|internal server error|A resource with the ID|a network with the ID|There are not enough hosts available|No Router found)`)
retryableDependenciesRegexp = regexp.MustCompile(`(?i)(RetryableError)`)
resourcesDepletedRegexp = regexp.MustCompile(`(?i)(not available in the current hardware cluster|out of stock)`)
configurationProblemRegexp = regexp.MustCompile(`(?i)(not supported in your requested Availability Zone|notFound|Invalid value|violates constraint|no attached internet gateway found|Your query returned no results|invalid VPC attributes|unrecognized feature gate|runtime-config invalid key|strict decoder error|not allowed to configure an unsupported|error during apply of object .* is invalid:|duplicate zones|overlapping zones)`)
Expand Down
8 changes: 6 additions & 2 deletions pkg/controller/infrastructure/infraflow/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,17 @@ func (fctx *FlowContext) ensureNetwork(ctx context.Context) error {
}

func (fctx *FlowContext) ensureConfiguredNetwork(_ context.Context) error {
network, err := fctx.access.GetNetworkByID(*fctx.config.Networks.ID)
networkId := *fctx.config.Networks.ID
network, err := fctx.access.GetNetworkByID(networkId)
if err != nil {
fctx.state.Set(IdentifierNetwork, "")
fctx.state.Set(NameNetwork, "")
return err
}
fctx.state.Set(IdentifierNetwork, *fctx.config.Networks.ID)
if network == nil {
return fmt.Errorf("a network with the ID '%s' was not found", networkId)
}
fctx.state.Set(IdentifierNetwork, networkId)
fctx.state.Set(NameNetwork, network.Name)
return nil
}
Expand Down

0 comments on commit 8a4b07f

Please sign in to comment.