Skip to content

Commit

Permalink
Refactorng
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Aug 23, 2017
1 parent de57078 commit ed64f26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions azurerm/resource_arm_app_service_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"log"
"net/http"

"github.com/Azure/azure-sdk-for-go/arm/web"
"github.com/hashicorp/terraform/helper/hashcode"
Expand Down Expand Up @@ -141,7 +140,7 @@ func resourceArmAppServicePlanRead(d *schema.ResourceData, meta interface{}) err

resp, err := AppServicePlanClient.Get(resGroup, name)
if err != nil {
if resp.StatusCode == http.StatusNotFound {
if responseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
11 changes: 7 additions & 4 deletions azurerm/resource_arm_app_service_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ func testCheckAzureRMAppServicePlanDestroy(s *terraform.State) error {
resp, err := conn.Get(resourceGroup, name)

if err != nil {
return nil
}

if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("App Service Plan still exists:\n%#v", resp)
if responseWasNotFound(resp.Response) {
return nil
}

return err
}

return fmt.Errorf("App Service Plan still exists:\n%#v", resp)
}

return nil
Expand Down

0 comments on commit ed64f26

Please sign in to comment.