adding additional azure error checks
@@ -24,7 +24,6 @@ import (
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"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
@@ -49,9 +48,18 @@ func (rc *AzureRedisCacheManager) Ensure(ctx context.Context, obj runtime.Object
if err != nil {
catch := []string{
errhelp.ResourceGroupNotFoundErrorCode,
+ errhelp.AlreadyExists,
+ errhelp.InvalidServerName,
}
azerr := errhelp.NewAzureErrorAzureError(err)
if helpers.ContainsString(catch, azerr.Type) {
+ if azerr.Type == errhelp.AlreadyExists {
+ // do something
+ // do get
+ }
+ if azerr.Type == errhelp.InvalidServerName {
+ // do something
+ }
instance.Status.Message = err.Error()
return false, nil
}
