Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle bad location for resource groups #821

Merged
merged 2 commits into from
Mar 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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