Fix code regarding to the latest gophercloud code
This commit is contained in:
parent
cfd3329e00
commit
d6733fb379
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/racker/perigee"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls"
|
||||
)
|
||||
|
@ -114,7 +113,7 @@ func resourceFirewallRead(d *schema.ResourceData, meta interface{}) error {
|
|||
|
||||
firewall, err := firewalls.Get(networkingClient, d.Id()).Extract()
|
||||
if err != nil {
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok {
|
||||
return err
|
||||
}
|
||||
|
@ -145,13 +144,11 @@ func resourceFirewallUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
opts := firewalls.UpdateOpts{}
|
||||
|
||||
if d.HasChange("name") {
|
||||
name := d.Get("name").(string)
|
||||
opts.Name = &name
|
||||
opts.Name = d.Get("name").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("description") {
|
||||
description := d.Get("description").(string)
|
||||
opts.Description = &description
|
||||
opts.Description = d.Get("description").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("policy_id") {
|
||||
|
@ -227,7 +224,7 @@ func WaitForFirewallDeletion(networkingClient *gophercloud.ServiceClient, id str
|
|||
log.Printf("[DEBUG] Get firewall %s => %#v", id, fw)
|
||||
|
||||
if err != nil {
|
||||
httpStatus := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpStatus := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
log.Printf("[DEBUG] Get firewall %s status is %d", id, httpStatus.Actual)
|
||||
|
||||
if httpStatus.Actual == 404 {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
"github.com/racker/perigee"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls"
|
||||
)
|
||||
|
||||
|
@ -51,7 +51,7 @@ func testAccCheckOpenstackFirewallDestroy(s *terraform.State) error {
|
|||
if err == nil {
|
||||
return fmt.Errorf("Firewall (%s) still exists.", rs.Primary.ID)
|
||||
}
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 404 {
|
||||
return httpError
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ func testAccCheckFirewallExists(n, expectedName, expectedDescription string, pol
|
|||
// if we get a 404 error. Fail on any other error.
|
||||
found, err = firewalls.Get(networkingClient, rs.Primary.ID).Extract()
|
||||
if err != nil {
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 404 {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/racker/perigee"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies"
|
||||
)
|
||||
|
||||
|
@ -119,7 +119,7 @@ func resourceFirewallPolicyRead(d *schema.ResourceData, meta interface{}) error
|
|||
policy, err := policies.Get(networkingClient, d.Id()).Extract()
|
||||
|
||||
if err != nil {
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok {
|
||||
return err
|
||||
}
|
||||
|
@ -150,13 +150,11 @@ func resourceFirewallPolicyUpdate(d *schema.ResourceData, meta interface{}) erro
|
|||
opts := policies.UpdateOpts{}
|
||||
|
||||
if d.HasChange("name") {
|
||||
name := d.Get("name").(string)
|
||||
opts.Name = &name
|
||||
opts.Name = d.Get("name").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("description") {
|
||||
description := d.Get("description").(string)
|
||||
opts.Description = &description
|
||||
opts.Description = d.Get("description").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("rules") {
|
||||
|
@ -193,7 +191,7 @@ func resourceFirewallPolicyDelete(d *schema.ResourceData, meta interface{}) erro
|
|||
break
|
||||
}
|
||||
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 409 {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
"github.com/racker/perigee"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies"
|
||||
)
|
||||
|
||||
|
@ -70,7 +70,7 @@ func testAccCheckOpenstackFirewallPolicyDestroy(s *terraform.State) error {
|
|||
if err == nil {
|
||||
return fmt.Errorf("Firewall policy (%s) still exists.", rs.Primary.ID)
|
||||
}
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 404 {
|
||||
return httpError
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ func testAccCheckFirewallPolicyExists(n string, expected *policies.Policy) resou
|
|||
// if we get a 404 error. Fail on any other error.
|
||||
found, err = policies.Get(networkingClient, rs.Primary.ID).Extract()
|
||||
if err != nil {
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 404 {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/racker/perigee"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules"
|
||||
)
|
||||
|
||||
|
@ -137,7 +137,7 @@ func resourceFirewallRuleRead(d *schema.ResourceData, meta interface{}) error {
|
|||
rule, err := rules.Get(networkingClient, d.Id()).Extract()
|
||||
|
||||
if err != nil {
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok {
|
||||
return err
|
||||
}
|
||||
|
@ -172,12 +172,10 @@ func resourceFirewallRuleUpdate(d *schema.ResourceData, meta interface{}) error
|
|||
opts := rules.UpdateOpts{}
|
||||
|
||||
if d.HasChange("name") {
|
||||
name := d.Get("name").(string)
|
||||
opts.Name = &name
|
||||
opts.Name = d.Get("name").(string)
|
||||
}
|
||||
if d.HasChange("description") {
|
||||
description := d.Get("description").(string)
|
||||
opts.Description = &description
|
||||
opts.Description = d.Get("description").(string)
|
||||
}
|
||||
if d.HasChange("protocol") {
|
||||
opts.Protocol = d.Get("protocol").(string)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
"github.com/racker/perigee"
|
||||
"github.com/rackspace/gophercloud"
|
||||
"github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules"
|
||||
)
|
||||
|
||||
|
@ -88,7 +88,7 @@ func testAccCheckOpenstackFirewallRuleDestroy(s *terraform.State) error {
|
|||
if err == nil {
|
||||
return fmt.Errorf("Firewall rule (%s) still exists.", rs.Primary.ID)
|
||||
}
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 404 {
|
||||
return httpError
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func testAccCheckFirewallRuleExists(n string, expected *rules.Rule) resource.Tes
|
|||
// if we get a 404 error. Fail on any other error.
|
||||
found, err = rules.Get(networkingClient, rs.Primary.ID).Extract()
|
||||
if err != nil {
|
||||
httpError, ok := err.(*perigee.UnexpectedResponseCodeError)
|
||||
httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError)
|
||||
if !ok || httpError.Actual != 404 {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue