packer-cn/provisioner
nywilken b80882f3b8 provisioner/shell: Fix envVarFile clean up issue
This change ensures the deletion of the external envVarFile (use_env_var_file = true) occurs after all script files have been executed and deleted.

Build results before change
```
> packer build build.pkr.hcl                                                                                                                                                             [~0]
docker: output will be in this color.

==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: ubuntu:bionic
    docker: bionic: Pulling from library/ubuntu
    docker: Digest: sha256:8d31dad0c58f552e890d68bbfb735588b6b820a46e459672d96e585871acc110
    docker: Status: Image is up to date for ubuntu:bionic
    docker: docker.io/library/ubuntu:bionic
==> docker: Starting docker container...
    docker: Run command: docker run -v /home/wilken/.packer.d/tmp476880774:/packer-files -d -i -t --entrypoint=/bin/sh -- ubuntu:bionic
    docker: Container ID: 812069b4d70746a6d4592a8f75c06867c6774b8b0bd81ade76eae7926a30f64b
==> docker: Using docker communicator to connect: 172.17.0.2
==> docker: Provisioning with shell script: sample.sh
    docker: Sample Script
    docker: wilken is NotForSale!
==> docker: Provisioning with shell script: foobar.sh
==> docker: /bin/sh: 1: .: Can't open /tmp/varfile_2555.sh
==> docker: Provisioning step had errors: Running the cleanup provisioner, if present...
==> docker: Killing the container: 812069b4d70746a6d4592a8f75c06867c6774b8b0bd81ade76eae7926a30f64b
Build 'docker' errored: Script exited with non-zero exit status: 2.Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> docker: Script exited with non-zero exit status: 2.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.
```

Build results after change
```
> packer build build.pkr.hcl
docker: output will be in this color.

==> docker: Creating a temporary directory for sharing data...
==> docker: Pulling Docker image: ubuntu:bionic
    docker: bionic: Pulling from library/ubuntu
    docker: Digest: sha256:8d31dad0c58f552e890d68bbfb735588b6b820a46e459672d96e585871acc110
    docker: Status: Image is up to date for ubuntu:bionic
    docker: docker.io/library/ubuntu:bionic
==> docker: Starting docker container...
    docker: Run command: docker run -v /home/wilken/.packer.d/tmp819845000:/packer-files -d -i -t --entrypoint=/bin/sh -- ubuntu:bionic
    docker: Container ID: d8ed9100ff5017379bfc0d80703b2b2d10c4104941663aa5ddbbf18f6dcf74a5
==> docker: Using docker communicator to connect: 172.17.0.2
==> docker: Provisioning with shell script: sample.sh
    docker: Sample Script
    docker: wilken is NotForSale!
==> docker: Provisioning with shell script: foobar.sh
    docker: FooBar Script
    docker: wilken is NotForSale!
==> docker: Committing the container
    docker: Image ID: sha256:a412e43f134431f2049a7d06d5d691aad3717d91dd2ee5e2575e05b89384a4b3
==> docker: Killing the container: d8ed9100ff5017379bfc0d80703b2b2d10c4104941663aa5ddbbf18f6dcf74a5
Build 'docker' finished.

==> Builds finished. The artifacts of successful builds are:
--> docker: Imported Docker image: sha256:a412e43f134431f2049a7d06d5d691aad3717d91dd2ee5e2575e05b89384a4b3
```
2020-01-23 14:59:36 -05:00
..
ansible fix winrmpass sanitization to account for empty string value. 2020-01-06 10:07:30 -08:00
ansible-local Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
breakpoint Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
chef-client Remove redundant placeholder (#8503) 2019-12-19 10:39:46 +01:00
chef-solo Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
converge Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
file Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
inspec Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
powershell Remove redundant placeholder (#8503) 2019-12-19 10:39:46 +01:00
puppet-masterless Remove redundant placeholder (#8503) 2019-12-19 10:39:46 +01:00
puppet-server Remove redundant placeholder (#8503) 2019-12-19 10:39:46 +01:00
salt-masterless Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
shell provisioner/shell: Fix envVarFile clean up issue 2020-01-23 14:59:36 -05:00
shell-local Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
sleep Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
windows-restart Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
windows-shell Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
elevated.go Attempt at generalising elevated support 2018-12-06 18:00:22 +00:00
elevated_test.go Fix/add tests 2018-12-07 16:23:03 +00:00
guest_commands.go add force to powershell move command 2019-02-05 17:47:00 +00:00
guest_commands_test.go Update guest_commands_test.go 2019-02-06 10:50:29 +00:00