From 78a9f8bfb4d9a5ede469f52ace538c10ed67df7a Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 10 May 2016 15:40:02 -0700 Subject: [PATCH 1/4] build: "make fmt" to ignore vendor packages Several of our vendered dependencies are not gofmt-compliant, but we don't want to fix that since the vendored code is supposed to exactly match upstream. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 624d728ef..857d6c8ff 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ TEST?=$$(go list ./... | grep -v /vendor/) VETARGS?=-all +GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) default: test vet @@ -80,7 +81,7 @@ generate: @go fmt command/internal_plugin_list.go > /dev/null fmt: - gofmt -w . + gofmt -w $(GOFMT_FILES) fmtcheck: @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" From 250ee8d0892c290407a6258453958b95c4e0d2f7 Mon Sep 17 00:00:00 2001 From: Clint Date: Wed, 11 May 2016 10:18:45 -0500 Subject: [PATCH 2/4] provider/aws: Fix cloudtrail_tags config formatting in test (#6615) --- .../aws/resource_aws_cloudtrail_test.go | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/builtin/providers/aws/resource_aws_cloudtrail_test.go b/builtin/providers/aws/resource_aws_cloudtrail_test.go index 0c7f8497a..8f6ae7223 100644 --- a/builtin/providers/aws/resource_aws_cloudtrail_test.go +++ b/builtin/providers/aws/resource_aws_cloudtrail_test.go @@ -617,23 +617,33 @@ POLICY ` func testAccAWSCloudTrailConfig_tags(cloudTrailRandInt int) string { - return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, - `tags { + tagsString := `tags { Foo = "moo" Pooh = "hi" - }`, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) + }` + return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, + cloudTrailRandInt, + tagsString, + cloudTrailRandInt, + cloudTrailRandInt, + cloudTrailRandInt) } func testAccAWSCloudTrailConfig_tagsModified(cloudTrailRandInt int) string { - return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, - `tags { + tagsString := `tags { Foo = "moo" Pooh = "hi" Moo = "boom" - }`, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) + }` + return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, + cloudTrailRandInt, + tagsString, + cloudTrailRandInt, + cloudTrailRandInt, + cloudTrailRandInt) } func testAccAWSCloudTrailConfig_tagsModifiedAgain(cloudTrailRandInt int) string { return fmt.Sprintf(testAccAWSCloudTrailConfig_tags_tpl, - "", cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) + cloudTrailRandInt, "", cloudTrailRandInt, cloudTrailRandInt, cloudTrailRandInt) } From 5984f84c12412aacc10040f554a77b4f6048ceb6 Mon Sep 17 00:00:00 2001 From: thetuxkeeper Date: Wed, 11 May 2016 17:21:54 +0200 Subject: [PATCH 3/4] provider/vsphere: read gateway and ipv6_gateway read gateway and ipv6_gateway information for vsphere_virtual_machine resources. --- .../resource_vsphere_virtual_machine.go | 25 +++++++++++++++++++ .../resource_vsphere_virtual_machine_test.go | 6 +++++ 2 files changed, 31 insertions(+) diff --git a/builtin/providers/vsphere/resource_vsphere_virtual_machine.go b/builtin/providers/vsphere/resource_vsphere_virtual_machine.go index 86b093731..8ae9108fd 100644 --- a/builtin/providers/vsphere/resource_vsphere_virtual_machine.go +++ b/builtin/providers/vsphere/resource_vsphere_virtual_machine.go @@ -795,6 +795,31 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{}) networkInterfaces = append(networkInterfaces, networkInterface) } } + if mvm.Guest.IpStack != nil { + for _, v := range mvm.Guest.IpStack { + if v.IpRouteConfig != nil && v.IpRouteConfig.IpRoute != nil { + for _, route := range v.IpRouteConfig.IpRoute { + if route.Gateway.Device != "" { + gatewaySetting := "" + if route.Network == "::" { + gatewaySetting = "ipv6_gateway" + } else if route.Network == "0.0.0.0" { + gatewaySetting = "ipv4_gateway" + } + if gatewaySetting != "" { + deviceID, err := strconv.Atoi(route.Gateway.Device) + if err != nil { + log.Printf("[WARN] error at processing %s of device id %#v: %#v", gatewaySetting, route.Gateway.Device, err) + } else { + log.Printf("[DEBUG] %s of device id %d: %s", gatewaySetting, deviceID, route.Gateway.IpAddress) + networkInterfaces[deviceID][gatewaySetting] = route.Gateway.IpAddress + } + } + } + } + } + } + } log.Printf("[DEBUG] networkInterfaces: %#v", networkInterfaces) err = d.Set("network_interface", networkInterfaces) if err != nil { diff --git a/builtin/providers/vsphere/resource_vsphere_virtual_machine_test.go b/builtin/providers/vsphere/resource_vsphere_virtual_machine_test.go index 426993973..d4a2738f3 100644 --- a/builtin/providers/vsphere/resource_vsphere_virtual_machine_test.go +++ b/builtin/providers/vsphere/resource_vsphere_virtual_machine_test.go @@ -50,6 +50,7 @@ func TestAccVSphereVirtualMachine_basic(t *testing.T) { gateway, label, ip_address, + gateway, datastoreOpt, template, ), @@ -111,6 +112,7 @@ func TestAccVSphereVirtualMachine_diskInitType(t *testing.T) { gateway, label, ip_address, + gateway, datastoreOpt, template, ), @@ -490,6 +492,7 @@ func TestAccVSphereVirtualMachine_createWithExistingVmdk(t *testing.T) { gateway, label, ip_address, + gateway, datastoreOpt, vmdk_path, ), @@ -935,6 +938,7 @@ resource "vsphere_virtual_machine" "foo" { label = "%s" ipv4_address = "%s" ipv4_prefix_length = 24 + ipv4_gateway = "%s" } disk { %s @@ -958,6 +962,7 @@ resource "vsphere_virtual_machine" "thin" { label = "%s" ipv4_address = "%s" ipv4_prefix_length = 24 + ipv4_gateway = "%s" } disk { %s @@ -1078,6 +1083,7 @@ resource "vsphere_virtual_machine" "with_existing_vmdk" { label = "%s" ipv4_address = "%s" ipv4_prefix_length = 24 + ipv4_gateway = "%s" } disk { %s From 9c0a17531194d68637ab7060c6f6020e5466e539 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Wed, 11 May 2016 11:25:35 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dfdb0f2d..7f8160444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ IMPROVEMENTS: BUG FIXES: * core: Correct the previous fix for a bug causing "attribute not found" messages during destroy, as it was insufficient [GH-6599] + * provider/vsphere: `gateway` and `ipv6_gateway` are now read from `vsphere_virtual_machine` resources [GH-6522] ## 0.6.16 (May 9, 2016)