Closed mrhockeymonkey closed 7 years ago
See #4189, and the corresponding changelog entry.
On Jun 6, 2017 14:48, "Scott Matthews" notifications@github.com wrote:
I have just started using Packer 1.0.0 over 0.12.0. It seems that the variable {{ .Artifact }} is no longer present in post-processing for me to use. My post processing involves running a script against an artifact and was working in 0.12.0 but in 1.0.0 i get this error
- Post-processor failed: Error processing command: template: root:1:25: executing "root" at <.Artifact>: can't evaluate field Artifact in type *shell_local.ExecuteCommandTemplate
Packer Version: 1.0.0 Host Platform: Server 2012 R2
Here is how i am replicating the problem. I have a vmdk already saved so i am using the file builder to make a copy and then run my script post-processor against this copy. As mentions above this works in 0.12.0 but not 1.0.0
{ "variables": { "sxs_folder": "D:/Images/iso/en-gb_windows_10_enterprise_version_1607_updated_jan_2017_x64_dvd_9714391/sources/sxs" }, "Builders": [ { "name": "one", "type": "file", "source": "output-server_2016_calc/box2-1496750571-disk1.vmdk", "target": "output-server_2016_calc/one.vmdk" }
], "post-processors": [
{ "type": "shell-local", "execute_command": "{{.Script}} -Artifact {{ .Artifact }} -Format VHD", "script": "scripts/postprocessing/CloneVirtualDisk.ps1" }
] }
Full Log:
2017/06/06 13:42:16 [INFO] Packer version: 1.0.0 2017/06/06 13:42:16 Packer Target OS/Arch: windows amd64 2017/06/06 13:42:16 Built with Go Version: go1.8 2017/06/06 13:42:16 Using internal plugin for null 2017/06/06 13:42:16 Using internal plugin for amazon-ebssurrogate 2017/06/06 13:42:16 Using internal plugin for amazon-instance 2017/06/06 13:42:16 Using internal plugin for azure-arm 2017/06/06 13:42:16 Using internal plugin for cloudstack 2017/06/06 13:42:16 Using internal plugin for digitalocean 2017/06/06 13:42:16 Using internal plugin for docker 2017/06/06 13:42:16 Using internal plugin for googlecompute 2017/06/06 13:42:16 Using internal plugin for oneandone 2017/06/06 13:42:16 Using internal plugin for openstack 2017/06/06 13:42:16 Using internal plugin for parallels-pvm 2017/06/06 13:42:16 Using internal plugin for profitbricks 2017/06/06 13:42:16 Using internal plugin for virtualbox-iso 2017/06/06 13:42:16 Using internal plugin for virtualbox-ovf 2017/06/06 13:42:16 Using internal plugin for vmware-iso 2017/06/06 13:42:16 Using internal plugin for amazon-ebs 2017/06/06 13:42:16 Using internal plugin for file 2017/06/06 13:42:16 Using internal plugin for qemu 2017/06/06 13:42:16 Using internal plugin for triton 2017/06/06 13:42:16 Using internal plugin for amazon-chroot 2017/06/06 13:42:16 Using internal plugin for vmware-vmx 2017/06/06 13:42:16 Using internal plugin for amazon-ebsvolume 2017/06/06 13:42:16 Using internal plugin for hyperv-iso 2017/06/06 13:42:16 Using internal plugin for parallels-iso 2017/06/06 13:42:16 Using internal plugin for shell-local 2017/06/06 13:42:16 Using internal plugin for windows-restart 2017/06/06 13:42:16 Using internal plugin for ansible-local 2017/06/06 13:42:16 Using internal plugin for powershell 2017/06/06 13:42:16 Using internal plugin for puppet-server 2017/06/06 13:42:16 Using internal plugin for shell 2017/06/06 13:42:16 Using internal plugin for file 2017/06/06 13:42:16 Using internal plugin for puppet-masterless 2017/06/06 13:42:16 Using internal plugin for chef-solo 2017/06/06 13:42:16 Using internal plugin for salt-masterless 2017/06/06 13:42:16 Using internal plugin for ansible 2017/06/06 13:42:16 Using internal plugin for chef-client 2017/06/06 13:42:16 Using internal plugin for converge 2017/06/06 13:42:16 Using internal plugin for windows-shell 2017/06/06 13:42:16 Using internal plugin for docker-push 2017/06/06 13:42:16 Using internal plugin for docker-save 2017/06/06 13:42:16 Using internal plugin for shell-local 2017/06/06 13:42:16 Using internal plugin for vagrant 2017/06/06 13:42:16 Using internal plugin for vsphere 2017/06/06 13:42:16 Using internal plugin for amazon-import 2017/06/06 13:42:16 Using internal plugin for compress 2017/06/06 13:42:16 Using internal plugin for docker-import 2017/06/06 13:42:16 Using internal plugin for vagrant-cloud 2017/06/06 13:42:16 Using internal plugin for artifice 2017/06/06 13:42:16 Using internal plugin for checksum 2017/06/06 13:42:16 Using internal plugin for atlas 2017/06/06 13:42:16 Using internal plugin for docker-tag 2017/06/06 13:42:16 Using internal plugin for googlecompute-export 2017/06/06 13:42:16 Using internal plugin for manifest 2017/06/06 13:42:16 Attempting to open config file: C:\Users\su-scottm\AppData\Roaming\packer.config 2017/06/06 13:42:16 [WARN] Config file doesn't exist: C:\Users\su-scottm\AppData\Roaming\packer.config 2017/06/06 13:42:16 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[virtualbox-iso:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso vmware-iso:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso qemu:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu amazon-ebsvolume:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebsvolume digitalocean:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-digitalocean amazon-ebssurrogate:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate amazon-instance:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-instance cloudstack:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack triton:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-triton amazon-chroot:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot parallels-iso:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-iso null:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-null oneandone:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oneandone parallels-pvm:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-pvm virtualbox-ovf:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-ovf amazon-ebs:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs docker:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker googlecompute:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute openstack:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-openstack profitbricks:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-profitbricks file:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file vmware-vmx:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-vmx hyperv-iso:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso azure-arm:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-builder-azure-arm] PostProcessors:map[vsphere:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere vagrant-cloud:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant-cloud amazon-import:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon-import compress:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress shell-local:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local checksum:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-checksum atlas:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-atlas manifest:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-manifest docker-push:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-push docker-save:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-save artifice:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-artifice docker-tag:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-tag googlecompute-export:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-export vagrant:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant docker-import:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-import] Provisioners:map[chef-solo:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-solo ansible:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible converge:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-converge ansible-local:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible-local puppet-server:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-server windows-shell:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-shell shell-local:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell-local windows-restart:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-restart file:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file puppet-masterless:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless powershell:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-powershell shell:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell salt-masterless:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-salt-masterless chef-client:C:\ProgramData\Packer\packer.exe-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client]} 2017/06/06 13:42:16 Setting cache directory: D:\Playground_SM\Packer\packer_cache 2017/06/06 13:42:16 Loading builder: file 2017/06/06 13:42:16 Plugin could not be found. Checking same directory as executable. 2017/06/06 13:42:16 Current exe path: C:\ProgramData\Packer\packer.exe 2017/06/06 13:42:16 Creating plugin client for path: C:\ProgramData\Packer\packer.exe 2017/06/06 13:42:16 Starting plugin: C:\ProgramData\Packer\packer.exe []string{"C:\ProgramData\Packer\packer.exe", "plugin", "packer-builder-file"} 2017/06/06 13:42:16 Waiting for RPC address for: C:\ProgramData\Packer\packer.exe 2017/06/06 13:42:17 [ERR] Checkpoint error: Get https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=ca05536c-8d9c-ccb2-c15a-0133996c992f&version=1.0.0: dial tcp: lookup checkpoint-api.hashicorp.com: no such host 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 [INFO] Packer version: 1.0.0 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Packer Target OS/Arch: windows amd64 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Built with Go Version: go1.8 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Attempting to open config file: C:\Users\su-scottm\AppData\Roaming\packer.config 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 [WARN] Config file doesn't exist: C:\Users\su-scottm\AppData\Roaming\packer.config 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]} 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Setting cache directory: D:\Playground_SM\Packer\packer_cache 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 args: []string{"packer-builder-file"} 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Plugin minimum port: 10000 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Plugin maximum port: 25000 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Plugin address: tcp 127.0.0.1:10000 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Waiting for connection... 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Serving a plugin connection... 2017/06/06 13:42:17 Loading post-processor: shell-local 2017/06/06 13:42:17 Plugin could not be found. Checking same directory as executable. 2017/06/06 13:42:17 Current exe path: C:\ProgramData\Packer\packer.exe 2017/06/06 13:42:17 Creating plugin client for path: C:\ProgramData\Packer\packer.exe 2017/06/06 13:42:17 Starting plugin: C:\ProgramData\Packer\packer.exe []string{"C:\ProgramData\Packer\packer.exe", "plugin", "packer-post-processor-shell-local"} 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 [ERR] Checkpoint error: Get https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=ca05536c-8d9c-ccb2-c15a-0133996c992f&version=1.0.0: dial tcp: lookup checkpoint-api.hashicorp.com: no such host 2017/06/06 13:42:17 Waiting for RPC address for: C:\ProgramData\Packer\packer.exe 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 [INFO] Packer version: 1.0.0 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Packer Target OS/Arch: windows amd64 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Built with Go Version: go1.8 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Attempting to open config file: C:\Users\su-scottm\AppData\Roaming\packer.config 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 [WARN] Config file doesn't exist: C:\Users\su-scottm\AppData\Roaming\packer.config 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]} 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Setting cache directory: D:\Playground_SM\Packer\packer_cache 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 args: []string{"packer-post-processor-shell-local"} 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Plugin minimum port: 10000 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Plugin maximum port: 25000 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Plugin address: tcp 127.0.0.1:10000 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Waiting for connection... 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 Serving a plugin connection... 2017/06/06 13:42:17 ui: one output will be in this color. 2017/06/06 13:42:17 ui: 2017/06/06 13:42:17 Build debug mode: false 2017/06/06 13:42:17 Force build: false 2017/06/06 13:42:17 On error: 2017/06/06 13:42:17 Preparing build: one 2017/06/06 13:42:17 packer.exe: 2017/06/06 13:42:17 [ERR] Checkpoint error: Get https://checkpoint-api.hashicorp.com/v1/check/packer?arch=amd64&os=windows&signature=ca05536c-8d9c-ccb2-c15a-0133996c992f&version=1.0.0: dial tcp: lookup checkpoint-api.hashicorp.com: no such host 2017/06/06 13:42:17 Waiting on builds to complete... 2017/06/06 13:42:17 Starting build run: one 2017/06/06 13:42:17 Running builder: file 2017/06/06 13:42:17 ui: ==> one: Copying output-server_2016_calc/box2-1496750571-disk1.vmdk to output-server_2016_calc/one.vmdk 2017/06/06 13:42:21 ui: ==> one: Copied 4785885184 bytes 2017/06/06 13:42:21 ui: ==> one: Running post-processor: shell-local 2017/06/06 13:42:21 Deleting original artifact for build 'one' 2017/06/06 13:42:21 packer.exe: 2017/06/06 13:42:21 Deleting output-server_2016_calc/one.vmdk 2017/06/06 13:42:21 ui error: Build 'one' errored: 1 error(s) occurred:
Post-processor failed: Error processing command: template: root:1:25: executing "root" at <.Artifact>: can't evaluate field Artifact in type shell_local.ExecuteCommandTemplate 2017/06/06 13:42:21 Builds completed. Waiting on interrupt barrier... 2017/06/06 13:42:21 machine readable: error-count []string{"1"} 2017/06/06 13:42:21 ui error: ==> Some builds didn't complete successfully and had errors: 2017/06/06 13:42:21 machine readable: one,error []string{"1 error(s) occurred:\n\n Post-processor failed: Error processing command: template: root:1:25: executing \"root\" at <.Artifact>: can't evaluate field Artifact in type *shell_local.ExecuteCommandTemplate"} 2017/06/06 13:42:21 ui error: --> one: 1 error(s) occurred:
Post-processor failed: Error processing command: template: root:1:25: executing "root" at <.Artifact>: can't evaluate field Artifact in type *shell_local.ExecuteCommandTemplate 2017/06/06 13:42:21 ui: ==> Builds finished but no artifacts were created. 2017/06/06 13:42:21 waiting for all plugin processes to complete... 2017/06/06 13:42:21 C:\ProgramData\Packer\packer.exe: plugin process exited 2017/06/06 13:42:21 C:\ProgramData\Packer\packer.exe: plugin process exited
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hashicorp/packer/issues/4968, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiCg_rFkChlR3CATfWMazZNqBfkl12Aks5sBUqPgaJpZM4NxSyo .
hi @mrhockeymonkey,
as rickard mentioned, we changed the behavior of the shell-local post-processor. The recommended way to use it is described here https://www.packer.io/docs/post-processors/shell-local.html#interacting-with-build-artifacts
Please feel free to mail the mailing list if you have any questions about using it.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
I have just started using Packer 1.0.0 over 0.12.0. It seems that the variable {{ .Artifact }} is no longer present in post-processing for me to use. My post processing involves running a script against an artifact and was working in 0.12.0 but in 1.0.0 i get this error
Packer Version: 1.0.0 Host Platform: Server 2012 R2
Here is how i am replicating the problem. I have a vmdk already saved so i am using the file builder to make a copy and then run my script post-processor against this copy. As mentions above this works in 0.12.0 but not 1.0.0
Full Log: