Commit Graph

42 Commits

Author SHA1 Message Date
Matt Wrock 725824e1dd refactor winrm communicator to use latest winrm gems and v2 api
Signed-off-by: Matt Wrock <matt@mattwrock.com>
2016-12-11 00:52:00 -08:00
Matt Wrock c5e1a6d8c0 use the cmd shell to check winrm availability 2016-09-26 14:07:11 -07:00
Seth Vargo 7014aa3bab
Remove custom tempfile class
This is not actually providing any additional utility and also causes
namespace conflicts with people trying to use the real Tempfile class.
2016-05-30 23:21:47 -04:00
Seth Vargo 5a4f345363
Use Util::Tempfile when configuring networks
This fixes a fairly large tempfile leak. Vagrant uses a template
renderer to write network configuration files locally to disk. Then,
that temporarily file is uploaded to the remote host and moved into
place. Since Vagrant is such a short-lived process, GC never came along
and cleaned up those tempfiles, resulting in many temporary files being
created through regular Vagrant usage.

The Util::Tempfile class uses a block to ensure the temporary file is
deleted when the block finishes. This API required small tweaks to the
usage, but provides more safety to ensure the files are deleted.
2016-05-28 23:22:34 -04:00
Matt Wrock f912a81362 powershell and cmd calls should use commnand_executor to reuse oprn winrm shell 2016-01-27 11:59:10 -08:00
Mitchell Hashimoto d657804f18 Merge branch 'master' of https://github.com/matthewcodes/vagrant into matthewcodes-master 2015-11-18 15:09:47 -08:00
Seng Lin Shee 774940521e Ignore Powershell progress updates on stderr
Starting with PowerShell 5, the progress bar can be observed via the
Write-Progress cmdlet. From WinRM, this appears as a stderr output.
Vagrant assumes that there is error if output appears on stderr.

This terminates various scripts which previously executed successfully
in Vagrant (prior to Windows 10).

This fix injects a variable assignment at various points of the script
execution process to disable display of the progress bar.
2015-11-18 13:52:25 -08:00
Mitchell Hashimoto d3bcc4e5f9 Merge pull request #6213 from jrob/winrm-execution-timeout
Winrm execution timeout
2015-11-18 13:00:59 -08:00
Mitchell Hashimoto dde21bc95a fix file permissions 2015-11-18 12:48:41 -08:00
matthewcodes 8e7a297fb5 Fix for interpolated strings being used for username and passwords, this fix was made in commit 1dd081d but was removed by 1152b4e. This was causing passwords with $ in them to stop working as the dollar sign was getting stripped out 2015-10-28 16:39:19 +00:00
Dan Dunckel d859a3b752 Somehow I missed this param while resolving conflicts 2015-10-15 12:36:19 -07:00
Marc Siegfriedt 8e87990599 add the option to make elevated interactive scripts 2015-10-15 12:25:50 -07:00
Paul Hinze 1e84cc4d6a communicators/winrm: respect boot_timeout when fetching winrm_info
We gained a ton of improvemnts to WinRM error handling in
https://github.com/mitchellh/vagrant/pull/4943, but we also got one bug.

The new code raises an exception when `winrm_info` does not return right
away. This was preventing us from catching the retry/timout logic that's
meant to wait until boot_timeout for the WinRM communicator to be ready.

This restores the proper behavior by rescuing the WinRMNotReady
exception and continuing to retry until the surrounding timeout fires.
2015-09-02 16:36:23 -05:00
Jeremy Roberts c844a9c4fd Adding WinRM execution_time_limit to log. 2015-08-31 11:42:35 -04:00
Jeremy Roberts 18d229ca82 Added execution_time_limit for WinRM.
Adds a configurable value for WinRm and the elevated permission shell ExecutionTimeLimit.

Please see mitchellh/vagrant#5506

Ex: config.winrm.execution_time_limit = "P1D"
2015-08-31 11:42:25 -04:00
Shawn Neal 1152b4e1df Fix issue 5790
Leaving around plaintext username and passwords in a script on a box isn't the best from a security standpoint. This change ensures the scheduled task wrapper script for WinRM doesn't leave these around on the box, and instead passes them to the script as arguments.
2015-06-10 16:04:46 -07:00
Max Lincoln edc867986b Merge branch 'master' into winrm_error_handling 2015-01-20 16:07:00 -05:00
Shawn Neal c4422d7c70 Fix guest autodetection when running windows guests so Vagrant doesn't think the guest is Ubuntu 2014-12-16 08:20:01 -08:00
Max Lincoln 24de8a1fb7 Just use ready? 2014-12-11 13:22:39 -05:00
Max Lincoln ba7b964b1e Better error handling for WinRM (using winrm v1.3.0.dev.2) 2014-12-11 13:22:39 -05:00
Max Lincoln b3480049ad DRY the Shell: Don't duplicate the Config, especially since there were differing default values 2014-12-11 13:21:58 -05:00
Peter Ericson a99d32f60a Add WinRM over SSL support 2014-12-11 13:19:09 -05:00
William E. Triest. III 4a2566c646 Fixes 4309
When the winrm communicator executes a command in an elevated shell,
this patch causes it to escape double quotes.

This is necessary as the first line in the file that it produces and
then executes it puts the command into a variable called command that
is delimited by double quotes.
2014-08-07 08:49:36 -04:00
Shawn Neal c72a412600 Better WinRM command failure messaging
Command failures include the stdout and stderr in the error message just like the SSH communicator.
Its now possible to specify only an error_class and have that use the correct error_key by default.
2014-06-24 10:09:11 -07:00
Kalman Hazins bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Mitchell Hashimoto d7fa60b5df communicators/winrm: use winrm_info cap if available [GH-3832] 2014-05-20 20:13:36 -07:00
Mitchell Hashimoto 0485413d0a Merge pull request #3847 from mitchellh/command-line-too-long-fix-for-winrm
guests/windows: fix #3816 long arg list
2014-05-20 19:38:53 -07:00
Mitchell Hashimoto 690c119ae2 communicators/winrm: don't look up forwarded port if non-local [GH-3861] 2014-05-20 19:30:53 -07:00
Shawn Neal 0d3979f80d Fixed issue 3816
Elevated command line is now rendered to a script which is uploaded to the guest and executed. This allows the command line itself to be less than 100 chars to start the script and any user commands are puts into the script which has unlimited* length.
2014-05-19 08:04:59 -07:00
Mitchell Hashimoto b47df84887 communicators/winrm: fix tests 2014-05-07 10:09:14 -07:00
Mitchell Hashimoto 882c9ad7f6 communicators/winrm: good_exit option 2014-05-07 09:47:47 -07:00
Shawn Neal 30b0399431 Use new Ruby hash initializer syntax 2014-04-26 21:07:26 -07:00
Shawn Neal f18a397289 Allow WinRM commands to be run elevated via scheduled task 2014-04-26 21:07:26 -07:00
Shawn Neal afeb60c850 ivars should be alphabetized 2014-04-24 07:50:24 -07:00
Shawn Neal ab51a786ff Extract execution_output method from WinRM comm execute 2014-04-23 21:49:28 -07:00
Shawn Neal f44c795eed Integrated WinRM command filter into communicator
*nix commands are now filtered out instead of being sent to the guest. This means the command_alias PowerShell script is no longer needed.

Moved the PowerShell exit code helper to the WinRM shell and changed it to always return an exit code.
2014-04-23 20:38:16 -07:00
Shawn Neal 9177bd8a48 Added WQL support to Vagrant communicator execute
- Removed duplication for WQL specific commands
2014-04-22 11:29:22 -07:00
Mitchell Hashimoto db64fbf6ef communicators/winrm: reload shell on reload so we get proper port 2014-04-21 13:56:42 -07:00
Mitchell Hashimoto 7223e29330 communicators/winrm: fix powershell execution 2014-04-21 13:51:05 -07:00
Mitchell Hashimoto 21ac0810fd communicators/winrm: more tests 2014-04-21 13:51:04 -07:00
Mitchell Hashimoto bb9f0aef32 communicators/winrm: autodetect port based on forwarded ports 2014-04-21 13:51:03 -07:00
Mitchell Hashimoto 2a8a04ebb9 communicators/winrm: initial import from vagrant-windows 2014-04-21 13:50:58 -07:00