Skip to content

Commit

Permalink
Merge branch 'master' into asql-provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamMortlMicrosoft authored Mar 26, 2020
2 parents 49b951e + dee22f6 commit 4c2e64b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 64 deletions.
16 changes: 2 additions & 14 deletions api/v1alpha1/apimgmt_types.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

package v1alpha1

Expand Down
16 changes: 2 additions & 14 deletions api/v1alpha1/apimgmt_types_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

package v1alpha1

Expand Down
16 changes: 2 additions & 14 deletions controllers/apimgmt_controller.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

package controllers

Expand Down
17 changes: 3 additions & 14 deletions controllers/apimgmt_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
/*
Copyright 2019 Microsoft.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +build all apimgmt

package controllers

import (
Expand Down
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 4c2e64b

Please sign in to comment.