Commit Graph

174 Commits

Author SHA1 Message Date
Adrien Delorme f555e7a9f2 allow a provisioner to timeout
* I had to contextualise Communicator.Start and RemoteCmd.StartWithUi
NOTE: Communicator.Start starts a RemoteCmd but RemoteCmd.StartWithUi will run the cmd and wait for a return, so I renamed StartWithUi to RunWithUi so that the intent is clearer.
Ideally in the future RunWithUi will be named back to StartWithUi and the exit status or wait funcs of the command will allow to wait for a return. If you do so please read carrefully https://golang.org/pkg/os/exec/#Cmd.Stdout to avoid a deadlock
* cmd.ExitStatus to cmd.ExitStatus() is now blocking to avoid race conditions
* also had to simplify StartWithUi
2019-04-08 20:09:21 +02: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 812e009e57 Add more detail for errors where the problem is that TEMPDIR is filled up 2018-11-08 15:21:40 -08:00
Megan Marsh 7d40aeaa33 this needs to be _below_ the call to ToPath 2018-10-19 14:24:56 -07:00
Megan Marsh 18c5e8deb8 fix 2018-10-19 13:46:55 -07:00
Megan Marsh 1e4133cbf9 quote upload path 2018-10-19 13:43:13 -07:00
Megan Marsh 00eba7e894 make trailing slash still work 2018-07-12 09:08:36 -07:00
Megan Marsh 36df317b89 don't try to determine file or folder with winrm communicator; not all systems will have powershell installed on them 2018-07-11 13:30:20 -07:00
Matthew Hooker 44012b29ec
Remove redundant error message. 2018-05-08 03:25:39 -07:00
Megan Marsh ee1ff3132d remove attempt to discover whether destination is a directory from upload function in various communicators 2018-04-10 08:13:06 -07:00
DanHam 191f407f5c
Fix copy/paste error in comment 2018-03-23 12:54:33 +00:00
Matthew Hooker c5e0710a9a
Do nothing if we detect destination is a directory
We can't modify the destination path in the communicator because it
breaks assumptions in the provisioners. For example, we try to chmod in
the shell provisioner. The chmod command uses the path as supplied by
the user. If the communicator decides to rewrite the path, the
provisioner doesn't know that, and so tries to chmod the wrong thing.

The best we can do is detect that the destination is a directory and
fail.

Also correctly surface output from sftp uploader.
2018-03-20 16:33:00 -07:00
Matthew Hooker 67c7b9d152
display debug log levels 2018-03-20 16:32:55 -07:00
Matthew Hooker ccdee2550b
Treat any output directory test command as error.
Surfaces any communications from the remote end during file
uploads. For example, we might get notifications if we're logging in
with the wrong user. Rather than swallow these, let's show them to the
user.
2018-03-20 16:32:35 -07:00
Matthew Hooker e2f9204c11
replace nil ptr exceptions with infinite loops 2018-03-19 15:52:43 -07:00
Josh Soref 6c1654d421 spelling: separators 2018-03-14 03:21:38 +00:00
Josh Soref eebe236587 spelling: keyboard 2018-03-13 08:07:31 +00:00
Josh Soref fc99dc25ae spelling: error 2018-03-13 07:45:13 +00:00
Matthew Hooker a4123eabe3
prevent 0-value ticker during ssh keepalive 2018-02-12 10:45:53 -08:00
Megan Marsh f8f256354f use winrmcp logic when creating new winrm client for uploads and downloads 2018-02-07 09:56:10 -08:00
Matthew Hooker ff64ccda55
Merge pull request #5426 from hashicorp/fix_4915
Fix 4915
2018-02-05 14:54:27 -08:00
Matthew Hooker 63f1673909
ssh deadlines 2018-01-31 12:35:25 -08:00
Matthew Hooker cab52872f4
add session level keep-alives for ssh communicator 2018-01-30 22:00:37 -08:00
Matthew Hooker ebe995c0ff
run goimports 2018-01-22 17:21:10 -08:00
Paul Kilar d9b404fa00 SOCKS5 proxy support 2017-10-10 15:04:15 +01:00
Megan Marsh 52c0be2d82 fix test 2017-10-05 16:57:52 -07:00
Megan Marsh a79d5eff4e implement sftp path 2017-10-05 10:44:18 -07:00
Megan Marsh 93bddb3e65 implement directory fix for lxc file uploads 2017-10-04 13:35:15 -07:00
Megan Marsh b3cc90125d ssh communicator works 2017-10-03 16:36:27 -07:00
Megan Marsh a5e6134819 implement dir check for ssh communicator 2017-10-03 15:55:32 -07:00
Megan Marsh 35ef7bce5c implement dir check for winrm communicator 2017-10-03 15:35:03 -07:00
Megan Marsh 9db2cdc02a Merge pull request #5273 from StuporHero/master
Use docker cp
2017-08-30 13:52:07 -07:00
Megan Marsh 4e8303f3b4 Merge pull request #5024 from rickard-von-essen/issue-4941
ssh: Renamed ssh_disable_agent to ssh_disable_agent_forwarding
2017-08-28 11:55:26 -07:00
Matthew Hooker 4edbd5322c
docker: stream uploads over stdin
Only write to a tempfile if we don't have a stat struct
2017-08-24 13:29:38 -07:00
Matthew Hooker ea76b5a693
Show scp output on error 2017-08-10 11:46:38 -07:00
Rickard von Essen 4f6010aa26
ssh: Renamed ssh_disable_agent to ssh_disable_agent_forwarding
Closes: #4941
2017-06-19 16:26:18 +02:00
Matthew Hooker 2ceaa2b79e Merge pull request #4748 from greenhouse-org/download-winrm
Add support for download in WinRM communicator
2017-05-22 13:35:25 -07:00
Roger Shimizu 28ee60d216 handle ABI change of golang-golang-x-crypto-dev
That ABI change was due to CVE security fix

Fix is picked from upstream of golang-golang-x-crypto-dev:
  e4e2799dd7

Closes: #861282
2017-05-14 23:54:04 +09:00
Mark DeLillo 9a16b6768e Fix decode
- Write decoded bytes without padding

Signed-off-by: Natalie Arellano <narellano@pivotal.io>
2017-04-26 12:15:57 -04:00
Paul Nikonowicz 0614fc234f Implement download for WinRM communicator
Signed-off-by: Mark DeLillo <mdelillo@pivotal.io>
2017-04-26 12:15:30 -04:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker eab4730c29
communicator/ssh: don't return error if we can't close connection. 2017-03-30 02:14:49 -07:00
Matthew Hooker cc11ec3566
check for a couple errors 2017-03-28 20:36:21 -07:00
Matthew Hooker 35578d9ed1
remove unnecessary type conversions 2017-03-28 20:36:21 -07:00
Matthew Hooker 79287d7e47
simplify some code 2017-03-28 20:36:20 -07:00
Matthew Hooker ce259c126a
communicator/ssh: fix nil ptr error
fixes a case where we could return a nil error and nil ssh session.
2017-03-20 14:30:53 -07:00
Matthew Hooker cc95b90abb Merge pull request #4438 from mitchellh/winrmupload
communicator/winrm: make directory upload behave more like scp
2017-03-10 16:30:14 -08:00
DanHam 2b0f52e84a
Fix copy/paste Terraform references 2017-01-29 16:31:23 +00:00
Matthew Hooker 85e85ddb47
communicator/winrm: make directory upload behave more like scp
changes behavior to be in-line with the docs.
Resolves #3562
2017-01-21 21:45:08 -08:00
Eike Verdenhalven 7ad77b9e93 integrate new winrm transport interface 2017-01-18 22:11:48 +01:00