Commit Graph

823 Commits

Author SHA1 Message Date
Ali Rizvi-Santiago 3da5a64a8d Fixed a race in the ReadNetworkingConfig implementation from the parsers belonging to the vmware builders that existed between reading the version and consuming tokens from the rest of the file. 2020-06-09 19:37:38 -05:00
Megan Marsh 5d67183c4c fix test 2020-06-05 14:05:59 -07:00
Megan Marsh 093cfcfd9f
Merge pull request #9322 from arizvisa/GH-8528
Fix the VMware builders when the guest platform's dhcpcd switches the ip address in-between a build
2020-06-05 10:58:00 -07:00
Ali Rizvi-Santiago 8985ba077c Re-added the (mistakenly removed) host override to the CommHost for the vmware builders. 2020-06-05 12:39:20 -05:00
Megan Marsh 4cd3429914 add ssh override test 2020-06-05 10:15:11 -07:00
Ali Rizvi-Santiago 9c5a65263f Added @SwampDragons' suggestion to the `CommHost()` implementation for the vmware builders which uses the communicator config's `Config.Port()` function to determine the communication port-number independent of the configured protocol. 2020-06-04 19:04:12 -05:00
Megan Marsh baed65156c
Merge pull request #9319 from arizvisa/GH-8528.refactor
This refactors the dhcpd lease parser in the vmware builders and adds unit tests for everything.
2020-06-04 12:18:49 -07:00
Ali Rizvi-Santiago 898321bcfe Added suggestions from @SwampDragons to the parsers from the vmware builders, included unit-tests and sample file for fusion's networking file, and fixed a few situations where the channel wasn't being closed. 2020-06-04 05:07:18 -05:00
Joshua Foster d35f342319 add the ability to configure the http bind address. defaults to 0.0.0.0. 2020-06-03 16:40:18 -07:00
Megan Marsh df37918467
Merge pull request #9303 from arizvisa/GH-8528.unit-tests
Unit tests for the driver_parser.go functionality of the vmware builder
2020-06-02 15:28:13 -07:00
Ali Rizvi-Santiago e5b6d8c37c Didn't know that WinRM uses a different variable for the port number when trying to determine the communication host in `CommHost`...now it's fixed. 2020-05-30 02:17:21 -05:00
Ali Rizvi-Santiago 229b5d17ff Re-worked the vmware builder drivers so that they're able to check multiple ip addresses when trying to connect via the CommHost. 2020-05-28 15:36:45 -05:00
Ali Rizvi-Santiago 0609909f1a Fixed some lint issues. 2020-05-28 13:53:49 -05:00
Ali Rizvi-Santiago ad7194c920 Rewrote the GuestIP implementation in the vmware builder to use the new dhcpd lease parsers instead of the old regexp-based logic. 2020-05-28 13:22:58 -05:00
Ali Rizvi-Santiago 020b005522 Finished implementing the final dhcpd lease entries parser for the vmware builders and also included its own unit tests. 2020-05-28 13:22:58 -05:00
Ali Rizvi-Santiago cf5332fa20 Updated the dhcpd lease entry parser in the vmware builder to return errors if any are encountered. 2020-05-28 13:22:58 -05:00
Ali Rizvi-Santiago afa4696985 Tightened the regular expressions used by the vmware builder to parse the dhcpd leases, and added support for parsing the weekdays. 2020-05-28 13:22:58 -05:00
Ali Rizvi-Santiago e2a7c317eb Implemented the dhcpd lease entry decoder and the address decoder for the vmware builder. 2020-05-28 13:22:57 -05:00
Ali Rizvi-Santiago efb775accb Added a number of parsing combinators to the vmware builder and some minor tests for them to help with parsing dhcpd leases. 2020-05-28 13:22:57 -05:00
Ali Rizvi-Santiago f17007d546 Removed the sentinelSignaller chan from the vmware builder parsers and its unit-tests, and also commented all of the goroutines that are used. 2020-05-28 13:22:56 -05:00
Ali Rizvi-Santiago 159ea595df More lint issues fixed... 2020-05-28 13:12:42 -05:00
Ali Rizvi-Santiago 32b64e0576 Fixed some lint issues in the unit tests for the vmware builder driver parsers. 2020-05-28 13:07:54 -05:00
Adrien Delorme 40947c2bf6
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:

```go
package main

import (
	"fmt"

	"github.com/hashicorp/hcl/v2/gohcl"
	"github.com/hashicorp/hcl/v2/hclwrite"
	"github.com/hashicorp/packer/builder/alicloud/ecs"
)

func main() {
	name := "name"
	app := ecs.FlatConfig{
		AlicloudImageName: &name,
		ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
			DiskName: &name,
		},
	}

	f := hclwrite.NewEmptyFile()
	block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
	f.Body().AppendBlock(block)
	fmt.Printf("%s", f.Bytes())
}

```

Will output:

```
source "something" "something" {
  packer_user_variables      = null
  packer_sensitive_variables = null
  image_name                 = "name"
  image_share_account        = null
  image_unshare_account      = null
  image_copy_regions         = null
  image_copy_names           = null
  tags                       = null
  tag                        = null
  system_disk_mapping        = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
  image_disk_mappings        = null
  ssh_remote_tunnels         = null
  ssh_local_tunnels          = null
  ssh_public_key             = null
  ssh_private_key            = null
}
```

This is a good first step for #9015 and #9282 

fix #9304
2020-05-28 11:19:00 +02:00
Adrien Delorme 0fa60c68fb
Drop the iso_checksum_type & iso_checksum_url fields (#8437)
* Drop the iso_checksum_type & iso_checksum_url fields

In favor of simply using iso_checksum that will know what to do.

* fix after master merge

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* remove checksum lowercasing tests

* Update builder_test.go

* Update builder_test.go

* better docs

* Update builder_test.go

* even better docs

* Update config.go

* Update builder_test.go

* Update step_create_vmx_test.go

* make generate

* better docs

* fix imports

* up tests

* Update _ISOConfig-required.html.md

* Update builder_test.go

* don't use sha1.Sum("none") as a caching path

* Update builder_test.go

* better docs

* Update iso_config_test.go

remove ISOChecksumType/ISOChecksumURL references

* Update step_download_test.go

* add iso_checksum_url and iso_checksum_type fixers + tests

* add concrete examples of checksum values

* add examples of checksumming from local file

* update go-getter dep

* up deps

* use new go-getter version

* up ESX5Driver.VerifyChecksum: use go-getter's checksumming

* ISOConfig.Prepare: get checksum there in case we need it as a string in ESX5Driver.VerifyChecksum

* Update iso_config.go

* get go-getter from v2 branch

* Update driver_esx5.go

add more comments

* Update driver_esx5.go

* show better error message when the checksum is invalid

* Update builder_test.go

put in a valid checksum to fix tests, checksum is md5("packer")

* Update builder_test.go

test invalid and valid checksum

* more test updating

* fix default md5 string to be a valid md5

* TestChecksumFileNameMixedCaseBug: use 'file:' prefix for file checksumming

* Update iso_config_test.go

* Update iso_config_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update go.mod

* Update go.mod

* Update CHANGELOG.md
2020-05-28 11:02:09 +02:00
Ali Rizvi-Santiago 2a8bc45bc4 Added unit-tests for the netmap parsing components in the vmware builder. 2020-05-26 23:03:30 -05:00
Ali Rizvi-Santiago 7c1ad4adcf Added unit-tests for the dhcpd configuration components in the vmware builder, and fixed a few discovered race conditions. 2020-05-26 22:59:35 -05:00
Sylvia Moss 1c30a71d09
Replace file shared state by statebag (#9238) 2020-05-19 11:49:48 +02:00
Megan Marsh 7e0cfd8b77 add undocumented tag to struct-markdown generator so that we can leave internal-use-only fields out of docs 2020-05-01 10:31:38 -07:00
Wilken Rivera e8f8ebf132
builder/vmware: Add some additional debug logging to the driver version check (#9064) 2020-04-15 10:34:48 +02:00
Adrien Delorme 840e67f775
HCL2: when we see a map generate an attribute spec instead of a block spec (#9035)
* mapstructure-to-hcl2: when we see a map generate an attribute spec and not a block spec

this will alow to do

tags = {
 key = "value"
}

instead of

tags {
  key = "value"
}

This will also enable using variables directly for those tags

* generate code

* update tests
2020-04-14 16:05:13 +02:00
Megan Marsh a48c0ecf49 update docs for headless to help users know they may need to launch the gui 2020-04-08 13:53:19 -07:00
Jeff Escalante 2999934326
fix generation script, bugfixes in source comments, update website paths in primary codebase 2020-04-07 17:53:22 -04:00
Jeff Escalante 9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Jeff Escalante 4afd107eeb
patch source files for extensions changes 2020-04-07 17:50:51 -04:00
Sylvia Moss b17b211aa9
Add cleanup_remote_cache config option to vmware-iso (#8917) 2020-03-24 16:16:25 +01:00
Adrien Delorme 88297c796d Merge branch 'master' into hcl2_singular_blocks 2020-03-17 14:47:17 +01:00
Adrien Delorme 94a1f0bcb6 go fmt 2020-03-17 12:05:37 +01:00
Megan Marsh 6008f911fd
Merge pull request #8847 from takaishi/support-keyboard-interactive
communicator/ssh: support keyboard-interactive auth to connect bastion
2020-03-13 11:48:12 -07:00
r_takaishi f50ff1d270 make generate 2020-03-13 11:29:42 +09:00
Paul Cichonski (pcichons) c3d793255e Do not test if NIC is reachable when ssh bastion is required
Relates to https://github.com/hashicorp/packer/issues/8866
2020-03-11 19:27:48 -04:00
Wilken Rivera e1a46ec293
Fix gosimple S1025 linting errors (#8838)
Remove unneeded use of fmt.Sprintf for variables that are already strings.
2020-03-04 15:31:30 -05:00
Megan Marsh dde74232f2
Clearly document all template-engine-enabled options (#8770) 2020-02-20 11:05:27 +01:00
Jason A. Beranek 9cbb49bacb
builder/vmware/iso: Expand `guest_os_type` docs (#8760) 2020-02-18 11:11:20 +01:00
Wilken Rivera 9ec8b67392
Add golangci-lint to project (#8686)
* Add golangci-lint as linting tool

* Disable failing staticchecks to start; GitHub issue to handle coming soon

* Run `goimports -w` to repair all source files that have improperly
formatted imports

* makefile: Add ci-lint target to run on travis

This change adds a new make target for running golangci-lint on newly
added Go files only. This target is expected to run during Packer ci builds.

* .github/contributing: Add code linting instructions

* travis: Update job configuration to run parallel builds
2020-02-14 11:42:29 -05:00
Sylvia Moss dc31bad539
Sharing info with post-processors via artifact (#8632) 2020-01-30 11:27:58 +01:00
Moss 61bee60ecf Add StepHttpIpDiscover tests 2020-01-28 10:31:17 +01:00
Moss df38d11270 Fix compilation error 2020-01-27 17:15:13 +01:00
Moss 0566f1f999 Extract http ip discover to a new step 2020-01-27 17:06:56 +01:00
Megan Marsh 8c8de27509 add note about error abort to vmware warning 2020-01-24 09:02:30 -08:00
Sylvia Moss d6a351b173
Rename communicator config variables and remove deprecated code (#8584) 2020-01-09 08:37:30 -08:00