Commit Graph

90 Commits

Author SHA1 Message Date
Adrien Delorme c7ce4d598e change Provisioner to be passed a context for cancellation 2019-04-03 15:55:54 +02:00
Adrien Delorme 72e5ae9ddc use ValidExitCode in provisioners windows-shell, powershell and shell 2019-03-14 12:47:22 +01:00
Adrien Delorme 30a65c858a regroup shell provisioner params into a common struct 2019-03-14 11:57:54 +01:00
Adrien Delorme b7222d1f56 Add tmp package that offers Dir & File funcs
this regroups the calls of tmp func calls into one package.
the tmp pkg allows to store tmp files under a common directory for easier managment

Squashed commit of the following:
commit 74b674c01560c6b547e9cab5e8afb486f0fe7d6c
Merge: fc94b5714 66001525d
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Fri Nov 2 02:02:38 2018 -0400

    Merge branch 'remove_TMPDIR_docs' of github.com:tb3088/packer into remove_TMPDIR_docs

commit fc94b571428447aaf2e5171967c95cdf9e5c73ff
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Fri Nov 2 01:42:38 2018 -0400

    update tests to honor configured temporary directory

commit 5a562359f4937af506607dd96ed1c46426093f52
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 18:52:38 2018 -0400

    sync straggler to refactor. implement tests at packer/configfile instead of buried in docker.

commit 9d5a4a0935bfd049e2f8f50ad73e4455b42c9410
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 15:39:46 2018 -0400

    insert URL to GoLang API for os.TempDir()

commit fbae4c2e051898aecd8705e9d8a20353430ede23
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 07:41:29 2018 -0400

    revise documentation to match code

commit 3590fae8bd0afa92a161a49ed794ee32e357d583
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 07:21:59 2018 -0400

    refacter config_file. replace all hard-coded os.TempDir with wrapper

commit d5c5306a97b648ded06a8eb76ce728f07c9924f0
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Wed Oct 31 20:11:36 2018 -0400

    close massive file overwrite hole with TempDir

commit 0a72297da86089fbd07e4f7d9472a92fa4d1c733
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Wed Oct 31 01:06:00 2018 -0400

    adjust var declaration scope

commit 20f68228b6c372d984ea5b055cfc8bda9b110ac5
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Wed Oct 31 00:54:35 2018 -0400

    use mktemp() equivalent to create temporary directory

commit c73ebe3d8321664a2685a0baa8e441dd895b0db4
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 20:40:58 2018 -0400

    remove extraneous variable declaration, fix FOR loop

commit 63549b8bd745a0090b15ed0b0ebf644162db27db
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 19:30:44 2018 -0400

    match styistic convension with rest of docs

commit 976101074942db36f10d3a686d6d29ddb7c01926
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 19:08:39 2018 -0400

    revert dangling config file change

commit 95159afbc05eac96ed11c3183af5fb0abe2f2d5c
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date:   Fri Dec 29 23:53:43 2017 -0500

    replace invalid TMPDIR variable wth PACKER_TMP_DIR.
    update ConfigTmpDir() to try common temporary paths first and
    only write to configDir() as a last resort.

commit 66001525d72de56a4cf9339b900c46f59bc6e91a
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Fri Nov 2 01:42:38 2018 -0400

    update tests to honor configured temporary directory

commit e9b6adefeae8c65eb8aa47fef38cbf0aa424338c
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 18:52:38 2018 -0400

    sync straggler to refactor. implement tests at packer/configfile instead of buried in docker.

commit 852113ed076e2d14e5dca6815ea680da1e2896bb
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 15:39:46 2018 -0400

    insert URL to GoLang API for os.TempDir()

commit 54add38d1d1c6e283cd444b367ed8bd49a5f3699
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 07:41:29 2018 -0400

    revise documentation to match code

commit 6b5b8f6d4edad0e187ca13d64ac4118f34eee643
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Thu Nov 1 07:21:59 2018 -0400

    refacter config_file. replace all hard-coded os.TempDir with wrapper

commit c22092c601c33484327674f322c7379fa41506d7
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Wed Oct 31 20:11:36 2018 -0400

    close massive file overwrite hole with TempDir

commit 7a730450916bf8e5dbc2a741ec233a49466ab7cc
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Wed Oct 31 01:06:00 2018 -0400

    adjust var declaration scope

commit 0f2933adb6f6922dfeab78a95371a444ec8918ab
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Wed Oct 31 00:54:35 2018 -0400

    use mktemp() equivalent to create temporary directory

commit d74839ede05dacf712b55a7bb48aec19fe6b007f
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 20:40:58 2018 -0400

    remove extraneous variable declaration, fix FOR loop

commit eb65416619437e4a3dec90277770803dd5b2281c
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 19:30:44 2018 -0400

    match styistic convension with rest of docs

commit acaa2b31ed463219c4ef099f351eec72406e2989
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 19:08:39 2018 -0400

    revert dangling config file change

commit e573fde668dcb418561e61535c1d68b2888f5b0f
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date:   Fri Dec 29 23:53:43 2017 -0500

    replace invalid TMPDIR variable wth PACKER_TMP_DIR.
    update ConfigTmpDir() to try common temporary paths first and
    only write to configDir() as a last resort.

commit 39a9874afc9dea71b36753375fb7feb61ffecf69
Merge: 8a413cfe8 3315812c2
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Oct 30 18:19:26 2018 -0400

    Merge branch 'master' of https://github.com/hashicorp/packer into prestine

commit 8a413cfe83b0a70dbd99c32d936334ca5788ca9b
Merge: e07491de5 4e14710a6
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Mon Oct 1 20:18:10 2018 -0400

    Merge remote-tracking branch 'upstream/master' into prestine

commit e07491de59cead0b337a7f57f4a6c625e1f560ab
Merge: 42610a35d a1fa35dff
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Tue Aug 21 13:26:19 2018 -0400

    Merge remote-tracking branch 'upstream/master' into prestine

commit 42610a35d5ef65af8844a58ad70e2ec75262da6a
Merge: 5298142da 0d63cf7bc
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date:   Tue Jun 19 22:45:05 2018 -0400

    Merge remote-tracking branch 'upstream/master' into prestine

commit 5298142da6da95354844f201deeeef3c599e48b2
Merge: 7bb110bc7 9d9736552
Author: Matthew Patton <mpatton@enquizit.com>
Date:   Mon Jun 11 15:10:09 2018 -0400

    Merge remote-tracking branch 'upstream/master' into prestine

commit 7bb110bc744c9797fcaec25a265d9b85a22d6d6b
Merge: a61c869ca 6189d66e7
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date:   Wed May 9 23:41:22 2018 -0400

    Merge remote-tracking branch 'upstream/master' into prestine

commit a61c869ca7268acf0e3b1e1fa7a8ee7feea65984
Merge: 098101dd9 4be5f072c
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date:   Fri May 4 10:13:04 2018 -0400

    Merge remote-tracking branch 'upstream/master' into prestine

commit 098101dd99f08b0ca110d33eff6904537c6d21de
Merge: fefaf0fa6 554b2b4a5
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date:   Tue May 1 20:52:30 2018 -0400

    Merge branch 'EOL-handling' into prestine

Co-Authored-By: Matthew Patton <pattonme@yahoo.com>
2018-12-12 16:35:57 +01:00
Megan Marsh e69391f28b save users some bash scripting by exposing IP and port separately as well as together 2018-12-06 09:29:07 -08:00
Adrien Delorme 56fd98552e
removed space 2018-10-24 15:49:49 +02:00
Mark Meyer 31afd1c2f8 Add PauseAfter option to shell provisioner
Closes #6540
2018-10-24 14:04:08 +02:00
Megan Marsh 266a48a73a minor fixes for shell provisioner docs and logging 2018-08-30 14:36:14 -07:00
Megan Marsh ab13c73277 make varfile name unique and make sure to remove it from guest system if cleanup is true. 2018-08-30 11:02:56 -07:00
Megan Marsh cce13e3877 shell provisioner: add option to source env vars from a file 2018-08-29 11:10:49 -07:00
Megan Marsh fbbcbd772b remove file stat 2018-05-03 11:08:41 -07:00
Matthew Hooker 732a532d0e
pass file info during shell file upload 2018-03-20 16:32:55 -07:00
Matthew Hooker ecad3348b3
rephrase log message. 2017-10-26 10:41:49 -07:00
Ohad Basan 33b85b0130 Add suggestion for "expected_disconnect" option if disconnection occurs 2017-10-26 19:53:48 +03:00
Matthew Hooker 75111e49e9
remove convoluted pointer logic 2017-10-11 23:35:24 -07:00
Megan Marsh 401c718a59 set default for ExpectDisconnect to false 2017-08-24 14:46:52 -07:00
Matthew Hooker 56979a1974
Revert "Universally provide POSIX semantics for the `shell` provisioner."
This reverts commit 1ba7f9cc20.
2017-06-21 16:11:47 -07:00
Sean Chittenden 1ba7f9cc20
Universally provide POSIX semantics for the `shell` provisioner.
All platforms everywhere have `env(1)` available, leverage it
accordingly.

Improves on: #2343
2017-05-20 09:28:02 -07:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker 0149f679de
Print instead of Printf with no dynamic first variable. 2017-03-28 20:36:20 -07:00
DanHam 0cbb4ff30c provisioner/shell: Align gen of flattened env vars with powershell/win-shell
* Move code to generate quoted flattened env vars to separate function
* Fix: generate flattened env vars once per provisioner not once per script
2017-01-23 12:10:46 +00:00
Matthew Hooker 4e6a44f5f1
append will resize 2017-01-17 17:21:14 -08:00
Matthew Hooker 480398c3d2
only set PACKER_HTTP_ADDR if a server is listening 2017-01-17 17:17:36 -08:00
Matthew Hooker d2e59e4e92
set PACKER_HTTP_ADDR env var when available.
If using a builder that has an http server set up for file transfer,
expose the connection info to the shell provisioner through the environment
variable PACKER_HTTP_ADDR.

Closes #2869
2017-01-16 23:19:52 -08:00
Matthew Hooker 12176b6afc
provisioner/shell: treat disconnects as retryable. 2016-11-22 15:59:40 -08:00
Matthew Hooker 892d5e82c9 expect_disconnect option
provisioner/shell: Adds option to fail if the remote server disconnects
us.
2016-10-21 11:39:03 -07:00
Ian Duffy 7e653370b7 Seperate remote_path into remote_folder and remote_script. (#3462)
Commonly /tmp is set as noexec, as a result packer scripts
fail to run. In order to get around this one can set a
remote_path, whoever, remote path requires full filename
and path.

By making remote_path a combination of
remote_folder/remote_script we can change remote_folder
and keep the default script_nnn.sh

Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2016-04-26 16:04:29 -07:00
Chris Bednarski 1f6749096a Restore missing interpolation after merging ansible remote; fixes #3138 2016-02-01 13:28:49 -08:00
Chris Bednarski 15f99a4aee Merge branch 'ansible-provisioner' of https://github.com/bhcleek/packer into f-ansible 2016-01-28 15:16:54 -08:00
David Zanetti 2668747c71 Rename noclean shell option to skip_clean, per pull feedback 2015-11-19 16:02:45 +13:00
David Zanetti 3d23655f2f Add "noclean" boolean to shell provisioner. This stops the provisioner from
attempting to remove helper scripts it creates. As noted on #2803 this can
be useful when deleting the build user from an AMI or other template.
2015-11-16 16:37:09 +13:00
Billie H. Cleek cc8ca3098e add ansible provisioner 2015-10-31 10:39:33 -07:00
Mitchell Hashimoto 7c8e86c9c5 provisioner/*: fix interpolation context 2015-06-22 12:26:54 -07:00
Mitchell Hashimoto 6ec428cc38 provisioner/shell: retry file delete [GH-2286] 2015-06-21 19:53:43 -07:00
Mitchell Hashimoto 4463083a60 provisioner/shell: randomize default script name 2015-06-18 10:38:23 +02:00
Mitchell Hashimoto 6c80228661 provisioner/shell: missing error arg 2015-06-15 15:11:08 -07:00
Mitchell Hashimoto a235419c7d provisioner/shell: remove file after exec [GH-1536] 2015-06-15 15:02:59 -07:00
Mitchell Hashimoto c549fce85e provisioner/shell: escape single quotes [GH-2067] 2015-06-13 14:11:20 -04:00
Mitchell Hashimoto b28f946be9 Merge pull request #2210 from mitchellh/b-set-e
provisioner/shell: set -e for inline [GH-2069]
2015-06-11 17:19:43 -04:00
Mitchell Hashimoto 3ed73852be provisioner/shell: set -e on the shebang itself 2015-06-11 17:19:23 -04:00
Mitchell Hashimoto a995df352e provisioner/shell: uploaded script should be 0755 [GH-1708] 2015-06-10 21:18:46 -07:00
Mitchell Hashimoto 952077ccb0 provisioner/shell: set -e for inline [GH-2069] 2015-06-10 21:02:22 -07:00
Mitchell Hashimoto 2b4df93f2f provisioner/*: interpolation 2015-05-27 14:50:20 -07:00
Mitchell Hashimoto 3eda0f33a0 provisioner/shell: quote PACKER env vars [GH-1565] 2014-10-28 08:23:18 -07:00
Josh Frye 5835ca42b4 Move quoting to else block only for valid vars. Add test case. 2014-10-14 14:20:36 -07:00
Josh Frye a667282e00 Single quote env var values. 2014-10-14 13:03:14 -07:00
Ross Smith II d92179847d provisioner/file: set file/directory permissions
fixes #1064
2014-05-09 21:03:35 -07:00
Mitchell Hashimoto 9365b879c0 provisioner/shell: chmod uploaded file to 0777 [GH-994] 2014-04-26 20:20:47 -07:00
Mitchell Hashimoto ec41edf558 provisioner/shell: Split on first equal for env vars [GH-1045] 2014-04-26 14:51:56 -07:00
Jason A. Beranek b3d76b7945 provisioner/shell: fix provisioner to use UnixReader [GH-477]
Packer was using the original file reader when uploading, instead of the UnixReader /cc @mitchellh
2013-09-30 23:54:54 -05:00