handle rg and parent not found errors
@@ -23,6 +23,8 @@ import (
model "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub"
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
+ "github.com/Azure/azure-service-operator/pkg/errhelp"
+ "github.com/Azure/azure-service-operator/pkg/helpers"
"github.com/Azure/azure-service-operator/pkg/resourcemanager"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/config"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/iam"
@@ -213,10 +215,20 @@ func (e *azureEventHubManager) Ensure(ctx context.Context, obj runtime.Object) (
_, err = e.CreateHub(ctx, resourcegroup, eventhubNamespace, eventhubName, messageRetentionInDays, partitionCount, capturePtr)
if err != nil {
+ catch := []string{
+ errhelp.ResourceGroupNotFoundErrorCode,
+ errhelp.ParentNotFoundErrorCode,
+ errhelp.AsyncOpIncompleteError,
+ }
+ azerr := errhelp.NewAzureErrorAzureError(err)
+ if helpers.ContainsString(catch, azerr.Type) {
+ instance.Status.Message = err.Error()
+ return false, nil
+ } else {
instance.Status.Provisioning = false
return false, err
}
-
+ }
err = e.createOrUpdateAccessPolicyEventHub(resourcegroup, eventhubNamespace, eventhubName, instance)
if err != nil {
return false, err
