fix sql server crash that crashes operator
@@ -54,7 +54,8 @@ func (s *AzureSqlServerManager) Ensure(ctx context.Context, obj runtime.Object,
}
// Assure that the requested name is available and assume the secret exists
- checkNameResult, _ := CheckNameAvailability(ctx, instance.Name)
+ checkNameResult, err := CheckNameAvailability(ctx, instance.Name)
+ if err == nil {
if *checkNameResult.Available != true {
instance.Status.Provisioning = false
if _, err := s.GetServer(ctx, instance.Spec.ResourceGroup, instance.Name); err != nil {
@@ -71,6 +72,7 @@ func (s *AzureSqlServerManager) Ensure(ctx context.Context, obj runtime.Object,
return false, nil
}
+ }
secret, err = NewSecret(instance.Name)
if err != nil {
