Skip to content

Commit

Permalink
Merge pull request #821 from frodopwns/issue-7330-rg-loc
Browse files Browse the repository at this point in the history
handle bad location for resource groups
  • Loading branch information
frodopwns authored Mar 26, 2020
2 parents 2a21211 + 865223e commit dee22f6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pkg/resourcemanager/resourcegroups/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package resourcegroups
import (
"context"
"fmt"
"net/http"

"github.com/Azure/azure-service-operator/api/v1alpha1"
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -29,19 +30,22 @@ func (g *AzureResourceGroupManager) Ensure(ctx context.Context, obj runtime.Obje
if err != nil {
instance.Status.Provisioned = false
instance.Status.Message = err.Error()

// handle special cases that won't work without a change to spec
if group.StatusCode == http.StatusBadRequest {
instance.Status.Provisioning = false
return true, nil
}

return false, fmt.Errorf("ResourceGroup create error %v", err)

}
if instance.Status.Provisioning {
instance.Status.Provisioned = true
instance.Status.Provisioning = false
instance.Status.Message = resourcemanager.SuccessMsg
} else {
instance.Status.Provisioned = false
instance.Status.Provisioning = true
}

instance.Status.Provisioned = true
instance.Status.Provisioning = false
instance.Status.Message = resourcemanager.SuccessMsg
instance.Status.ResourceId = *group.ID

return true, nil
}

Expand Down

0 comments on commit dee22f6

Please sign in to comment.