packer-cn/packer
Wilken Rivera f672f5bd9b command/validate: Add support for HCL2 configuration files
* Update validate command to use FixConfig for checking against known
fixers
* Update validation command flag docs
* Add ConfigFixer method to PackerHandler Interface
* Implement ConfigFixer interface in PackerConfig
* Remove all stdout messaging (i.e calls to c.Ui.Say) in the validate
command. The command will only display hcl.Diagnotic messaging when there is an error or warning.

HCL2 Configs
```
⇶  packer validate docker_centos_shell_provisioner.pkr.hcl

```

JSON Configs
```
⇶  packer validate vmware-iso_ubuntu_minimal/vmware-iso_ubuntu_minimal.json
Error: Failed to prepare build: "vmware-iso"

1 error occurred:
        * Deprecated configuration key: 'iso_checksum_type'. Please call `packer fix`
against your template to update your template to be compatable with the current
version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
detail.

Warning: Fixable configuration found.
You may need to run `packer fix` to get your build to run correctly.
See debug log for more information.

  map[string]interface{}{
        "builders": []interface{}{
                map[string]interface{}{
                        ... // 3 identical entries
                        "guest_os_type":     string("ubuntu-64"),
                        "http_directory":    string("http"),
-                       "iso_checksum":
string("946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2"),
+                       "iso_checksum":
string("sha256:946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2"),
-                       "iso_checksum_type": string("sha256"),
                        "iso_url":
string("http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04.1-server-amd64.iso"),
                        "shutdown_command":  string("echo 'vagrant' | sudo -S shutdown -P now"),
                        ... // 4 identical entries
                },
        },
  }
```
2020-06-05 14:24:39 -04:00
..
plugin Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
rpc Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
test-fixtures Add RetriedProvisioner to allow retry provisioners (#9061) 2020-04-16 11:58:54 +02:00
tmp clarify comments 2019-01-09 16:30:43 +01:00
artifact.go Expand Artifact API to expose build state 2014-09-22 11:15:47 +01:00
artifact_mock.go Fix gosimple S1005 linting issue (#8870) 2020-03-11 10:30:08 +01:00
artifact_test.go Fix gosimple S1005 linting issue (#8870) 2020-03-11 10:30:08 +01:00
build.go show build block name and source name if possible 2020-06-02 11:43:27 +02:00
build_test.go Avoid calling CoreBuild.Prepare(...) for HCL2 templates (#8742) 2020-02-14 17:39:32 +01:00
builder.go Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
builder_mock.go add tests for info sharing 2019-12-17 13:41:48 -08:00
builder_mock.hcl2spec.go HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
builder_test.go packer: builder prepare can return warnings 2013-11-02 22:31:12 -05:00
cache.go I use Dir instead of Base for mkdirall call 2019-03-28 13:17:15 -07:00
cache_test.go Use the hashicorp/go-getter to download files 2019-03-13 12:11:58 +01:00
communicator.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
communicator_mock.go Add unit test to find issue #7655 2019-05-17 22:27:19 +00:00
communicator_mock_test.go packer: Add UploadDir to the Communicator interface 2013-08-25 20:30:56 -07:00
communicator_test.go use our own copy of iochan.LineReader 2019-04-11 14:25:24 +02:00
config_file.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
config_file_test.go packer: remove unused test variable 2019-11-04 12:53:16 -08:00
config_file_unix.go make code of homeDir, configFile & configDir not os specific anymore 2018-11-30 15:47:43 +01:00
config_file_windows.go make code of homeDir, configFile & configDir not os specific anymore 2018-11-30 15:47:43 +01:00
core.go command/validate: Add support for HCL2 configuration files 2020-06-05 14:24:39 -04:00
core_test.go Update core_test.go 2020-04-30 16:40:58 +02:00
fixconfigmode_enumer.go fix enum 2020-05-08 16:54:44 +02:00
hcl2spec.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
hook.go get data sharing to a working state with the powershell provisioner 2019-12-11 15:43:38 -08:00
hook_mock.go [Builder|Build|PostProcessor|Provisioner|Hook]Server: context cancel using a RPC cancel method 2019-04-03 15:55:55 +02:00
hook_test.go [Builder|Build|PostProcessor|Provisioner|Hook]Server: context cancel using a RPC cancel method 2019-04-03 15:55:55 +02:00
logs.go replace scrubconfig with packer.LogSecretFilter.Set 2018-08-20 15:35:55 -07:00
maps.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
multi_error.go WIP 2018-10-26 16:59:20 -07:00
multi_error_test.go packer: no more asserts lib 2013-10-16 21:09:27 -10:00
packer_test.go packer: Core, and template validate 2015-05-23 14:48:07 -07:00
post_processor.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
post_processor_mock.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
progressbar.go allow building packer on solaris by removing progress bar and tty imports 2019-05-07 15:58:49 +02:00
progressbar_noop.go allow building packer on solaris by removing progress bar and tty imports 2019-05-07 15:58:49 +02:00
progressbar_solaris.go allow building packer on solaris by removing progress bar and tty imports 2019-05-07 15:58:49 +02:00
progressbar_test.go Use the hashicorp/go-getter to download files 2019-03-13 12:11:58 +01:00
provisioner.go Replace file shared state by statebag (#9238) 2020-05-19 11:49:48 +02:00
provisioner_mock.go Add RetriedProvisioner to allow retry provisioners (#9061) 2020-04-16 11:58:54 +02:00
provisioner_test.go Add RetriedProvisioner to allow retry provisioners (#9061) 2020-04-16 11:58:54 +02:00
provisioner_timeout.go change all provision func signatures to use map[string]interface{} 2019-12-12 15:38:32 -08:00
run_interfaces.go command/validate: Add support for HCL2 configuration files 2020-06-05 14:24:39 -04:00
telemetry.go Remove telemetry error reporting message. 2018-02-20 10:54:20 -08:00
telemetry_test.go add config key reporting 2017-11-14 16:30:44 -08:00
testing.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
tty.go Close tty on exit (#7411) 2019-03-15 11:10:30 +01:00
ui.go Allow to use isos in place 2020-02-06 17:07:58 +01:00
ui_test.go Close tty on exit (#7411) 2019-03-15 11:10:30 +01:00