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

provider/openstack: Gophercloud Migration #9407

Merged
merged 48 commits into from
Oct 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
74f990f
provider/openstack: gophercloud migration: Removing APIKey Attribute
jtopjian Sep 3, 2016
e677eaa
provider/openstack: gophercloud migration: util
jtopjian Sep 4, 2016
bb8c5ce
provider/openstack: gophercloud migration: blockstorage
jtopjian Sep 4, 2016
c8aee91
provider/openstack: gophercloud migration: compute floatingip
jtopjian Sep 4, 2016
a332567
provider/openstack: gophercloud migration: compute instance
jtopjian Sep 4, 2016
50855b3
provider/openstack: gophercloud migration: compute keypair
jtopjian Sep 4, 2016
b9f7d11
provider/openstack: gophercloud migration: compute secgroup
jtopjian Sep 4, 2016
8b6c3a1
provider/openstack: gophercloud migration: compute servergroup
jtopjian Sep 4, 2016
a1d76c8
provider/openstack: gophercloud migration: fwaas
jtopjian Sep 4, 2016
e252600
provider/openstack: gophercloud migration: lbaas v1
jtopjian Sep 4, 2016
d04cfb1
provider/openstack: gophercloud migration: lbaas v2
jtopjian Sep 4, 2016
cc86b91
provider/openstack: gophercloud migration: networking floatingip
jtopjian Sep 4, 2016
68c4956
provider/openstack: gophercloud migration: networking network
jtopjian Sep 4, 2016
53bb318
provider/openstack: gophercloud migration: networking port
jtopjian Sep 4, 2016
2f957e2
provider/openstack: gophercloud migration: networking router
jtopjian Sep 4, 2016
f2ba380
provider/openstack: gophercloud migration: networking secgroup
jtopjian Sep 4, 2016
d5bf019
provider/openstack: gophercloud migration: networking subnet
jtopjian Sep 4, 2016
9ffef95
provider/openstack: gophercloud migration: objectstorage
jtopjian Sep 4, 2016
c11a4ef
provider/openstack: gophercloud migration: updating error responses
jtopjian Sep 4, 2016
8f21117
provider/openstack: gophercloud migration: fwaas policy response erro…
jtopjian Sep 5, 2016
8371d20
provider/openstack: gophercloud migration: router interface error res…
jtopjian Sep 5, 2016
27b86ac
provider/openstack: gophercloud migration: metadata update
jtopjian Sep 18, 2016
d4722ae
provider/openstack: gophercloud migration: initial work on types.go
jtopjian Sep 27, 2016
e36c3e5
provider/openstack: gophercloud migration: Continued removal of APIKey
jtopjian Sep 29, 2016
a823370
provider/openstack: gophercloud migration: Fix handling of Neutron ne…
fatmcgav Oct 6, 2016
edf80d2
provider/openstack: gophercloud migration: Use 'log.Printf' rather th…
fatmcgav Oct 6, 2016
1eab212
provider/openstack: gophercloud migration: Add a BuildRequest functio…
fatmcgav Oct 3, 2016
796e076
provider/openstack: gophercloud migration: Use 'value_specs' from con…
fatmcgav Oct 4, 2016
ffd5370
provider/openstack: gophercloud migration: Add a 'MapValueSpecs' func…
fatmcgav Oct 5, 2016
56cc232
provider/openstack: gophercloud migration: Refactor existing resource…
fatmcgav Oct 5, 2016
58c3c4e
provider/openstack: gophercloud migration: Migrate RouterCreateOpts t…
fatmcgav Oct 6, 2016
bfab530
provider/openstack: gophercloud migration: Migrate NetworkCreateOpts …
fatmcgav Oct 6, 2016
e7ef8bb
provider/openstack: gophercloud migration: Ordering tweak in types.go…
fatmcgav Oct 6, 2016
9c856a8
provider/openstack: gophercloud migration: Removed unused import from…
fatmcgav Oct 6, 2016
8405a9f
provider/openstack: gophercloud migration: Update openstack_networkin…
fatmcgav Oct 7, 2016
28466f5
provider/openstack: gophercloud migration: Only set 'gateway_ip' to "…
fatmcgav Oct 7, 2016
520b3dd
provider/openstack: gophercloud migration: Spelling correction
jtopjian Oct 11, 2016
ed0fe74
provider/openstack: gophercloud migration: Making GatewayIP computed
jtopjian Oct 11, 2016
c3679d6
provider/openstack: gophercloud migration: Fixing subnet test
jtopjian Oct 11, 2016
7df2a66
provider/openstack: gophercloud migration: Allow Firewall v1 Policy t…
jtopjian Oct 12, 2016
394c26c
provider/openstack: gophercloud migration: Account for router interfa…
jtopjian Oct 12, 2016
ea4209c
provider/openstack: gophercloud migration: Account for subnets and ne…
jtopjian Oct 12, 2016
fbcd8f1
provider/openstack: gophercloud migration: boot from volume updates
jtopjian Oct 14, 2016
1fce3ed
provider/openstack: gophercloud migration: Fixing persistence update …
jtopjian Oct 16, 2016
0253dbe
provider/openstack: gophercloud migration: Accounting for 409 errors …
jtopjian Oct 16, 2016
1c6b69e
provider/openstack: gophercloud migration: Make PortID a *string
jtopjian Oct 16, 2016
17b1787
provider/openstack: gophercloud migration: fixing dhcp and gateway co…
jtopjian Oct 17, 2016
27c59bf
vendor: adding github.com/gophercloud/gophercloud
jtopjian Oct 16, 2016
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
6 changes: 2 additions & 4 deletions builtin/providers/openstack/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ import (
"io/ioutil"
"net/http"

"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack"
)

type Config struct {
Username string
UserID string
Password string
Token string
APIKey string
IdentityEndpoint string
TenantID string
TenantName string
Expand Down Expand Up @@ -45,7 +44,6 @@ func (c *Config) loadAndValidate() error {
UserID: c.UserID,
Password: c.Password,
TokenID: c.Token,
APIKey: c.APIKey,
IdentityEndpoint: c.IdentityEndpoint,
TenantID: c.TenantID,
TenantName: c.TenantName,
Expand Down
6 changes: 0 additions & 6 deletions builtin/providers/openstack/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ func Provider() terraform.ResourceProvider {
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("OS_AUTH_TOKEN", ""),
},
"api_key": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("OS_API_KEY", ""),
},
"domain_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -133,7 +128,6 @@ func configureProvider(d *schema.ResourceData) (interface{}, error) {
UserID: d.Get("user_id").(string),
Password: d.Get("password").(string),
Token: d.Get("token").(string),
APIKey: d.Get("api_key").(string),
TenantID: d.Get("tenant_id").(string),
TenantName: d.Get("tenant_name").(string),
DomainID: d.Get("domain_id").(string),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"log"
"time"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach"
)

func resourceBlockStorageVolumeV1() *schema.Resource {
Expand Down Expand Up @@ -169,7 +169,7 @@ func resourceBlockStorageVolumeV1Read(d *schema.ResourceData, meta interface{})
return CheckDeleted(d, err, "volume")
}

log.Printf("[DEBUG] Retreived volume %s: %+v", d.Id(), v)
log.Printf("[DEBUG] Retrieved volume %s: %+v", d.Id(), v)

d.Set("size", v.Size)
d.Set("description", v.Description)
Expand Down Expand Up @@ -306,11 +306,7 @@ func VolumeV1StateRefreshFunc(client *gophercloud.ServiceClient, volumeID string
return func() (interface{}, string, error) {
v, err := volumes.Get(client, volumeID).Extract()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return nil, "", err
}
if errCode.Actual == 404 {
if _, ok := err.(gophercloud.ErrDefault404); ok {
return v, "deleted", nil
}
return nil, "", err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"

"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
)

func TestAccBlockStorageV1Volume_basic(t *testing.T) {
Expand Down Expand Up @@ -117,13 +117,10 @@ func testAccCheckBlockStorageV1VolumeDoesNotExist(t *testing.T, n string, volume

_, err = volumes.Get(blockStorageClient, volume.ID).Extract()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return err
}
if errCode.Actual == 404 {
if _, ok := err.(gophercloud.ErrDefault404); ok {
return nil
}

return err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"log"
"time"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/blockstorage/v2/volumes"
"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/volumeattach"
)

func resourceBlockStorageVolumeV2() *schema.Resource {
Expand Down Expand Up @@ -181,7 +181,7 @@ func resourceBlockStorageVolumeV2Read(d *schema.ResourceData, meta interface{})
return CheckDeleted(d, err, "volume")
}

log.Printf("[DEBUG] Retreived volume %s: %+v", d.Id(), v)
log.Printf("[DEBUG] Retrieved volume %s: %+v", d.Id(), v)

d.Set("size", v.Size)
d.Set("description", v.Description)
Expand All @@ -195,9 +195,9 @@ func resourceBlockStorageVolumeV2Read(d *schema.ResourceData, meta interface{})
attachments := make([]map[string]interface{}, len(v.Attachments))
for i, attachment := range v.Attachments {
attachments[i] = make(map[string]interface{})
attachments[i]["id"] = attachment["id"]
attachments[i]["instance_id"] = attachment["server_id"]
attachments[i]["device"] = attachment["device"]
attachments[i]["id"] = attachment.ID
attachments[i]["instance_id"] = attachment.ServerID
attachments[i]["device"] = attachment.Device
log.Printf("[DEBUG] attachment: %v", attachment)
}
d.Set("attachment", attachments)
Expand Down Expand Up @@ -249,7 +249,7 @@ func resourceBlockStorageVolumeV2Delete(d *schema.ResourceData, meta interface{}
} else {
for _, volumeAttachment := range v.Attachments {
log.Printf("[DEBUG] Attachment: %v", volumeAttachment)
if err := volumeattach.Delete(computeClient, volumeAttachment["server_id"].(string), volumeAttachment["id"].(string)).ExtractErr(); err != nil {
if err := volumeattach.Delete(computeClient, volumeAttachment.ServerID, volumeAttachment.ID).ExtractErr(); err != nil {
return err
}
}
Expand Down Expand Up @@ -318,11 +318,7 @@ func VolumeV2StateRefreshFunc(client *gophercloud.ServiceClient, volumeID string
return func() (interface{}, string, error) {
v, err := volumes.Get(client, volumeID).Extract()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return nil, "", err
}
if errCode.Actual == 404 {
if _, ok := err.(gophercloud.ErrDefault404); ok {
return v, "deleted", nil
}
return nil, "", err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"

"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/blockstorage/v2/volumes"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes"
)

func TestAccBlockStorageV2Volume_basic(t *testing.T) {
Expand Down Expand Up @@ -130,11 +130,7 @@ func testAccCheckBlockStorageV2VolumeDoesNotExist(t *testing.T, n string, volume

_, err = volumes.Get(blockStorageClient, volume.ID).Extract()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return err
}
if errCode.Actual == 404 {
if _, ok := err.(gophercloud.ErrDefault404); ok {
return nil
}
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"log"

"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
"github.com/hashicorp/terraform/helper/schema"
"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip"
)

func resourceComputeFloatingIPV2() *schema.Resource {
Expand Down Expand Up @@ -58,11 +58,11 @@ func resourceComputeFloatingIPV2Create(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
}

createOpts := &floatingip.CreateOpts{
createOpts := &floatingips.CreateOpts{
Pool: d.Get("pool").(string),
}
log.Printf("[DEBUG] Create Options: %#v", createOpts)
newFip, err := floatingip.Create(computeClient, createOpts).Extract()
newFip, err := floatingips.Create(computeClient, createOpts).Extract()
if err != nil {
return fmt.Errorf("Error creating Floating IP: %s", err)
}
Expand All @@ -79,7 +79,7 @@ func resourceComputeFloatingIPV2Read(d *schema.ResourceData, meta interface{}) e
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
}

fip, err := floatingip.Get(computeClient, d.Id()).Extract()
fip, err := floatingips.Get(computeClient, d.Id()).Extract()
if err != nil {
return CheckDeleted(d, err, "floating ip")
}
Expand All @@ -102,7 +102,7 @@ func resourceComputeFloatingIPV2Delete(d *schema.ResourceData, meta interface{})
}

log.Printf("[DEBUG] Deleting Floating IP %s", d.Id())
if err := floatingip.Delete(computeClient, d.Id()).ExtractErr(); err != nil {
if err := floatingips.Delete(computeClient, d.Id()).ExtractErr(); err != nil {
return fmt.Errorf("Error deleting Floating IP: %s", err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"

"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/floatingip"
"github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
)

func TestAccComputeV2FloatingIP_basic(t *testing.T) {
var floatingIP floatingip.FloatingIP
var floatingIP floatingips.FloatingIP

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -32,7 +32,7 @@ func TestAccComputeV2FloatingIP_basic(t *testing.T) {

func TestAccComputeV2FloatingIP_attach(t *testing.T) {
var instance servers.Server
var fip floatingip.FloatingIP
var fip floatingips.FloatingIP
var testAccComputeV2FloatingIP_attach = fmt.Sprintf(`
resource "openstack_compute_floatingip_v2" "myip" {
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func testAccCheckComputeV2FloatingIPDestroy(s *terraform.State) error {
continue
}

_, err := floatingip.Get(computeClient, rs.Primary.ID).Extract()
_, err := floatingips.Get(computeClient, rs.Primary.ID).Extract()
if err == nil {
return fmt.Errorf("FloatingIP still exists")
}
Expand All @@ -86,7 +86,7 @@ func testAccCheckComputeV2FloatingIPDestroy(s *terraform.State) error {
return nil
}

func testAccCheckComputeV2FloatingIPExists(t *testing.T, n string, kp *floatingip.FloatingIP) resource.TestCheckFunc {
func testAccCheckComputeV2FloatingIPExists(t *testing.T, n string, kp *floatingips.FloatingIP) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand All @@ -103,7 +103,7 @@ func testAccCheckComputeV2FloatingIPExists(t *testing.T, n string, kp *floatingi
return fmt.Errorf("(testAccCheckComputeV2FloatingIPExists) Error creating OpenStack compute client: %s", err)
}

found, err := floatingip.Get(computeClient, rs.Primary.ID).Extract()
found, err := floatingips.Get(computeClient, rs.Primary.ID).Extract()
if err != nil {
return err
}
Expand Down
Loading