From 494a18a4adf8681554989e167742be77653f0651 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 20 Apr 2017 15:45:06 -0600 Subject: [PATCH 1/2] Fixes panic from occuring with unqualifying nats --- .../go-oracle-terraform/compute/instances.go | 23 ++++++++++++++----- vendor/vendor.json | 6 ++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/vendor/github.com/hashicorp/go-oracle-terraform/compute/instances.go b/vendor/github.com/hashicorp/go-oracle-terraform/compute/instances.go index 7368e9ba2..3c27db611 100644 --- a/vendor/github.com/hashicorp/go-oracle-terraform/compute/instances.go +++ b/vendor/github.com/hashicorp/go-oracle-terraform/compute/instances.go @@ -364,7 +364,11 @@ func (c *InstancesClient) GetInstance(input *GetInstanceInput) (*InstanceInfo, e } responseBody.SSHKeys = sshKeyNames - responseBody.Networking = c.unqualifyNetworking(responseBody.Networking) + var networkingErr error + responseBody.Networking, networkingErr = c.unqualifyNetworking(responseBody.Networking) + if networkingErr != nil { + return nil, networkingErr + } responseBody.Storage = c.unqualifyStorage(responseBody.Storage) return &responseBody, nil @@ -481,8 +485,9 @@ func (c *InstancesClient) qualifyNetworking(info map[string]NetworkingInfo) map[ return qualifiedNetworks } -func (c *InstancesClient) unqualifyNetworking(info map[string]NetworkingInfo) map[string]NetworkingInfo { +func (c *InstancesClient) unqualifyNetworking(info map[string]NetworkingInfo) (map[string]NetworkingInfo, error) { // Unqualify ip network + var err error unqualifiedNetworks := map[string]NetworkingInfo{} for k, v := range info { unq := v @@ -493,7 +498,10 @@ func (c *InstancesClient) unqualifyNetworking(info map[string]NetworkingInfo) ma unq.Vnic = c.getUnqualifiedName(v.Vnic) } if v.Nat != nil { - unq.Nat = c.unqualifyNat(v.Nat) + unq.Nat, err = c.unqualifyNat(v.Nat) + if err != nil { + return nil, err + } } if v.VnicSets != nil { unq.VnicSets = c.getUnqualifiedList(v.VnicSets) @@ -507,7 +515,7 @@ func (c *InstancesClient) unqualifyNetworking(info map[string]NetworkingInfo) ma } unqualifiedNetworks[k] = unq } - return unqualifiedNetworks + return unqualifiedNetworks, nil } func (c *InstancesClient) qualifyNat(nat []string, shared bool) []string { @@ -526,7 +534,7 @@ func (c *InstancesClient) qualifyNat(nat []string, shared bool) []string { return qualifiedNats } -func (c *InstancesClient) unqualifyNat(nat []string) []string { +func (c *InstancesClient) unqualifyNat(nat []string) ([]string, error) { unQualifiedNats := []string{} for _, v := range nat { if strings.HasPrefix(v, "ippool:/oracle") { @@ -534,10 +542,13 @@ func (c *InstancesClient) unqualifyNat(nat []string) []string { continue } n := strings.Split(v, ":") + if len(n) < 1 { + return nil, fmt.Errorf("Error unqualifying NAT: %s", v) + } u := n[1] unQualifiedNats = append(unQualifiedNats, c.getUnqualifiedName(u)) } - return unQualifiedNats + return unQualifiedNats, nil } func (c *InstancesClient) unqualifyStorage(attachments []StorageAttachment) []StorageAttachment { diff --git a/vendor/vendor.json b/vendor/vendor.json index e1a036a0e..e21c5ffdb 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1993,10 +1993,10 @@ "revision": "d30f09973e19c1dfcd120b2d9c4f168e68d6b5d5" }, { - "checksumSHA1": "yNCeppZjpZqEUgp/4g0AeJ+ee44=", + "checksumSHA1": "fOs3GlAj3fAMTlz+6OyllpZV6ow=", "path": "github.com/hashicorp/go-oracle-terraform/compute", - "revision": "bb3c65caa646927d1ad68b97f77241f48c855ad0", - "revisionTime": "2017-04-19T14:06:08Z" + "revision": "c96a23ea6900a1bbf65698abbd1b9a0010576cb5", + "revisionTime": "2017-04-20T21:25:45Z" }, { "checksumSHA1": "DzK7lYwHt5Isq5Zf73cnQqBO2LI=", From a22576dee5b7d849387986314070c6e4c005e835 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 20 Apr 2017 16:18:33 -0600 Subject: [PATCH 2/2] Updated other vendors --- vendor/vendor.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/vendor.json b/vendor/vendor.json index e21c5ffdb..f56d8a8bf 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -2001,14 +2001,14 @@ { "checksumSHA1": "DzK7lYwHt5Isq5Zf73cnQqBO2LI=", "path": "github.com/hashicorp/go-oracle-terraform/helper", - "revision": "bb3c65caa646927d1ad68b97f77241f48c855ad0", - "revisionTime": "2017-04-19T14:06:08Z" + "revision": "c96a23ea6900a1bbf65698abbd1b9a0010576cb5", + "revisionTime": "2017-04-20T21:25:45Z" }, { "checksumSHA1": "AyNRs19Es9pDw2VMxVKWuLx3Afg=", "path": "github.com/hashicorp/go-oracle-terraform/opc", - "revision": "bb3c65caa646927d1ad68b97f77241f48c855ad0", - "revisionTime": "2017-04-19T14:06:08Z" + "revision": "c96a23ea6900a1bbf65698abbd1b9a0010576cb5", + "revisionTime": "2017-04-20T21:25:45Z" }, { "checksumSHA1": "b0nQutPMJHeUmz4SjpreotAo6Yk=",