update client methods
This commit is contained in:
parent
6b2f2df042
commit
b9395b36d2
|
@ -7,8 +7,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
|
||||||
"github.com/rackspace/gophercloud"
|
|
||||||
"github.com/rackspace/gophercloud/openstack"
|
|
||||||
"github.com/rackspace/gophercloud/openstack/compute/v2/servers"
|
"github.com/rackspace/gophercloud/openstack/compute/v2/servers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33,9 +31,7 @@ func TestAccComputeV2Instance_basic(t *testing.T) {
|
||||||
|
|
||||||
func testAccCheckComputeV2InstanceDestroy(s *terraform.State) error {
|
func testAccCheckComputeV2InstanceDestroy(s *terraform.State) error {
|
||||||
config := testAccProvider.Meta().(*Config)
|
config := testAccProvider.Meta().(*Config)
|
||||||
computeClient, err := openstack.NewComputeV2(config.osClient, gophercloud.EndpointOpts{
|
computeClient, err := config.computeV2Client(OS_REGION_NAME)
|
||||||
Region: OS_REGION_NAME,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("(testAccCheckComputeV2InstanceDestroy) Error creating OpenStack compute client: %s", err)
|
return fmt.Errorf("(testAccCheckComputeV2InstanceDestroy) Error creating OpenStack compute client: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -65,10 +61,8 @@ func testAccCheckComputeV2InstanceExists(t *testing.T, n string, instance *serve
|
||||||
return fmt.Errorf("No ID is set")
|
return fmt.Errorf("No ID is set")
|
||||||
}
|
}
|
||||||
|
|
||||||
osClient := testAccProvider.Meta().(*Config).osClient
|
config := testAccProvider.Meta().(*Config)
|
||||||
computeClient, err := openstack.NewComputeV2(osClient, gophercloud.EndpointOpts{
|
computeClient, err := config.computeV2Client(OS_REGION_NAME)
|
||||||
Region: OS_REGION_NAME,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("(testAccCheckComputeV2InstanceExists) Error creating OpenStack compute client: %s", err)
|
return fmt.Errorf("(testAccCheckComputeV2InstanceExists) Error creating OpenStack compute client: %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
|
||||||
"github.com/rackspace/gophercloud"
|
|
||||||
"github.com/rackspace/gophercloud/openstack"
|
|
||||||
"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs"
|
"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,9 +30,7 @@ func TestAccComputeV2Keypair_basic(t *testing.T) {
|
||||||
|
|
||||||
func testAccCheckComputeV2KeypairDestroy(s *terraform.State) error {
|
func testAccCheckComputeV2KeypairDestroy(s *terraform.State) error {
|
||||||
config := testAccProvider.Meta().(*Config)
|
config := testAccProvider.Meta().(*Config)
|
||||||
computeClient, err := openstack.NewComputeV2(config.osClient, gophercloud.EndpointOpts{
|
computeClient, err := config.computeV2Client(OS_REGION_NAME)
|
||||||
Region: OS_REGION_NAME,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("(testAccCheckComputeV2KeypairDestroy) Error creating OpenStack compute client: %s", err)
|
return fmt.Errorf("(testAccCheckComputeV2KeypairDestroy) Error creating OpenStack compute client: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -64,10 +60,8 @@ func testAccCheckComputeV2KeypairExists(t *testing.T, n string, kp *keypairs.Key
|
||||||
return fmt.Errorf("No ID is set")
|
return fmt.Errorf("No ID is set")
|
||||||
}
|
}
|
||||||
|
|
||||||
osClient := testAccProvider.Meta().(*Config).osClient
|
config := testAccProvider.Meta().(*Config)
|
||||||
computeClient, err := openstack.NewComputeV2(osClient, gophercloud.EndpointOpts{
|
computeClient, err := config.computeV2Client(OS_REGION_NAME)
|
||||||
Region: OS_REGION_NAME,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("(testAccCheckComputeV2KeypairExists) Error creating OpenStack compute client: %s", err)
|
return fmt.Errorf("(testAccCheckComputeV2KeypairExists) Error creating OpenStack compute client: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue