115 Commits

Author SHA1 Message Date
Paul Hinze
291db96510 communicators/winrm: don't stop task on idle end
StopOnIdleEnd was set in the task definition for elevated/privileged
windows guest scripts. This setting:

> specifies that the task stops when the idle condition ceases to be true [1]

The "idle condition" is something that Windows periodically checks for,
and it's defined by a bunch of criteria like user presence/absence, CPU
/ IO idle time, etc. [2]

Telling our provisioner to stop the task if the "idle condition" ceases
to be true is a recipe for some sporadically stopped tasks, which seems
like precisely the behavior being reported in #5362.

I'm pretty sure this fixes #5362

[1] https://msdn.microsoft.com/en-us/library/cc248332.aspx
[2] https://msdn.microsoft.com/en-us/library/windows/desktop/aa383561%28v=vs.85%29.aspx
2015-03-12 15:25:40 -05:00
Max Lincoln
39882957ee Add retry_delay setting to speed up test 2015-01-28 13:41:07 -05:00
Max Lincoln
5d5e13bc0f Change authorization error tests to match WinRM 1.3 2015-01-28 13:41:07 -05:00
Max Lincoln
c37c12526a Merge branch 'master' of github.com:mitchellh/vagrant into winrm_error_handling
Conflicts:
	vagrant.gemspec
2015-01-28 10:44:47 -05:00
Max Lincoln
29845e926c Merge branch 'master' into winrm_error_handling 2015-01-20 16:16:48 -05:00
Max Lincoln
edc867986b Merge branch 'master' into winrm_error_handling 2015-01-20 16:07:00 -05:00
Shawn Neal
31163da0d5 Use winrm-fs for file uploads
Replace the Vagrant native winrm file upload functionality with the winrm-fs gem.
2015-01-20 11:45:57 -08:00
Vít Ondruch
7d3b5352da Remove unneeded executable permissions. 2015-01-20 11:53:30 +01:00
Mitchell Hashimoto
79873cdb44 communicators/winrm: detect parse errors in powershell and error
/cc @sneal - Any better way to do this?
2015-01-05 16:53:17 -08: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
e7e50d39d9 Fix tests - all pass but auth retry test is extremely slow 2014-12-11 13:23:40 -05: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
24f919c4d3 Fix accessors used by in communicator.rb 2014-12-11 13:22:39 -05:00
Max Lincoln
2caaf82ae0 Change default transport back to :plaintext, for backwards compatibility 2014-12-11 13:21:58 -05:00
Max Lincoln
02f4adc895 Fix broken variable references 2014-12-11 13:21:58 -05:00
Max Lincoln
072bb26a30 Change @ssl to @transport 2014-12-11 13:21:58 -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
Max Lincoln
1beb221bf3 Rename no_ssl_peer_verification to ssl_peer_verification, and make it configurable 2014-12-11 13:21:58 -05:00
Peter Ericson
243cc5dc37 config.rb: set default port based on @ssl 2014-12-11 13:20:22 -05:00
Peter Ericson
52d8fddf38 shell.rb: fix precedence 2014-12-11 13:20:22 -05:00
Peter Ericson
4455d2401b Add ssl option to winrm config.rb 2014-12-11 13:19:09 -05:00
Peter Ericson
a99d32f60a Add WinRM over SSL support 2014-12-11 13:19:09 -05:00
Mitchell Hashimoto
4af0f9b9c6 whitespace 2014-10-18 16:13:01 -07:00
Matt Wrock
e22767184b exit wit code 1 from powershell commands that fail but do not send an exit code 2014-08-24 10:18:03 -07:00
Stefan Scherer
f0ef46f648 write to stdout before exit 1 2014-08-17 16:22:35 +02: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
Mitchell Hashimoto
00bd226fc7 guests/nixos: don't detect as Windows [GH-4302] 2014-08-06 11:17:41 -07:00
Mitchell Hashimoto
94841ef1bc Merge pull request #4094 from mitchellh/improved-winrm-command-failure-messaging
provisioners/winrm: Better WinRM command failure messaging
2014-08-06 10:44:35 -07:00
Richard Guin
120b15bc39 Modified WinRM rm filter to account for -f switch, handle recurse properly 2014-07-30 15:43:37 -04:00
Richard Guin
361d41527a Added mkdir command filter for WinRM to be compatible with PS4+ 2014-07-30 15:43:11 -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
Shawn Neal
291f01045b Fixed issue 3918
Running Windows guest commands through a scheduled task were not returning the correct exit codes, they were only returning 1 or 0. This has negative consequences especially for Puppet which can return an exit code of 2 for partial success.

Since we're running an executable from inside a powershell encoded command we need to ensure we explicitly propagate the exit code to the original caller just like a regular PowerShell script - in this case cmd /c which in return is called from a scheduled task.
2014-05-28 08:54:36 -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
Shawn Neal
823e80fa32 Fixed issue 3729
The logic used to read the file contents sometimes would leave lines behind unread. It now defaults to reading all lines and counts each line it has actually read.
2014-05-15 09:17:57 -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
1dd081d866 Don't use interpolated strings for username and password
Its possible that usernames and passwords may contain special characters like $
2014-04-26 21:07:26 -07:00
Shawn Neal
045e06455a Added WinRM elevated shell wrapper script
This script creates an immediately run scheduled task using fresh credentials. This is a generic implementation used by the Chef provisioners. The script gets around several limitations in WinRM.

1. Credential hopping
2. The non-default Administrator account sometimes doesn't have true Administrator access when run through WinRM even with UAC disabled.

In short, this script allows commands to run through WinRM just as if they were run directly on the box.
2014-04-26 21:07:26 -07:00
Shawn Neal
cad3dde760 Fixed whitespacing in command_filter and file_manager 2014-04-24 07:52:13 -07:00
Shawn Neal
afeb60c850 ivars should be alphabetized 2014-04-24 07:50:24 -07:00
Shawn Neal
d5d9918e48 Cleanup whitespace and comments in WinRM command filters 2014-04-24 07:49:19 -07:00
Shawn Neal
ab51a786ff Extract execution_output method from WinRM comm execute 2014-04-23 21:49:28 -07:00
Shawn Neal
4a2a147926 Refactored WinRM test command filter 2014-04-23 21:15:05 -07:00