vagrant-windows 1.6.0 → 1.7.0.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +7 -1
- data/Gemfile +5 -1
- data/README.md +3 -1
- data/lib/vagrant-windows/communication/command_filters/cat.rb +27 -0
- data/lib/vagrant-windows/communication/command_filters/chmod.rb +21 -0
- data/lib/vagrant-windows/communication/command_filters/chown.rb +21 -0
- data/lib/vagrant-windows/communication/command_filters/rm.rb +28 -0
- data/lib/vagrant-windows/communication/command_filters/test.rb +37 -0
- data/lib/vagrant-windows/communication/command_filters/uname.rb +36 -0
- data/lib/vagrant-windows/communication/command_filters/which.rb +26 -0
- data/lib/vagrant-windows/communication/guestnetwork.rb +16 -19
- data/lib/vagrant-windows/communication/linux_command_filter.rb +44 -0
- data/lib/vagrant-windows/communication/winrmcommunicator.rb +21 -24
- data/lib/vagrant-windows/communication/winrmfilemanager.rb +166 -0
- data/lib/vagrant-windows/communication/winrmshell.rb +8 -38
- data/lib/vagrant-windows/config/windows.rb +5 -5
- data/lib/vagrant-windows/errors.rb +5 -1
- data/lib/vagrant-windows/guest/cap/configure_networks.rb +1 -1
- data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_client.rb +2 -5
- data/lib/vagrant-windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -5
- data/lib/vagrant-windows/monkey_patches/plugins/provisioners/shell/provisioner.rb +13 -6
- data/lib/vagrant-windows/provisioners/chef_command_builder.rb +7 -53
- data/lib/vagrant-windows/scripts/elevated_shell.ps1.erb +95 -0
- data/lib/vagrant-windows/version.rb +1 -1
- data/locales/en.yml +7 -0
- data/spec/vagrant-windows/chef_command_builder_spec.rb +7 -53
- data/spec/vagrant-windows/guestnetwork_spec.rb +10 -5
- data/spec/vagrant-windows/linux_command_filter_spec.rb +73 -0
- data/spec/vagrant-windows/winrmcommunicator_spec.rb +55 -6
- data/spec/vagrant-windows/winrmshell_spec.rb +12 -5
- metadata +16 -8
- data/lib/vagrant-windows/scripts/cheftask.ps1.erb +0 -48
- data/lib/vagrant-windows/scripts/cheftask.xml.erb +0 -45
- data/lib/vagrant-windows/scripts/cheftaskrun.ps1.erb +0 -18
- data/lib/vagrant-windows/scripts/command_alias.ps1 +0 -36
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
|
3
3
|
describe VagrantWindows::Communication::WinRMShell, :integration => true do
|
|
4
4
|
|
|
5
5
|
before(:all) do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
port = (ENV['WINRM_PORT'] || 5985).to_i
|
|
7
|
+
@shell = VagrantWindows::Communication::WinRMShell.new(
|
|
8
|
+
"127.0.0.1", "vagrant", "vagrant", { port: port })
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
describe "powershell" do
|
|
11
|
+
describe ".powershell" do
|
|
12
12
|
it "should return exit code of 0" do
|
|
13
13
|
expect(@shell.powershell("exit 0")[:exitcode]).to eq(0)
|
|
14
14
|
end
|
|
@@ -26,7 +26,7 @@ describe VagrantWindows::Communication::WinRMShell, :integration => true do
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
describe "cmd" do
|
|
29
|
+
describe ".cmd" do
|
|
30
30
|
it "should return stdout" do
|
|
31
31
|
result = @shell.cmd("dir") do |type, line|
|
|
32
32
|
expect(type).to eq(:stdout)
|
|
@@ -35,5 +35,12 @@ describe VagrantWindows::Communication::WinRMShell, :integration => true do
|
|
|
35
35
|
expect(result[:exitcode]).to eq(0)
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
describe ".wql" do
|
|
40
|
+
it "should return query results in stdout" do
|
|
41
|
+
result = @shell.wql('SELECT * FROM Win32_NetworkAdapter WHERE MACAddress IS NOT NULL')
|
|
42
|
+
expect(result[:win32_network_adapter]).to_not be_empty
|
|
43
|
+
end
|
|
44
|
+
end
|
|
38
45
|
|
|
39
46
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant-windows
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.0.pre.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Morton
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: winrm
|
|
@@ -105,8 +105,17 @@ extra_rdoc_files: []
|
|
|
105
105
|
files:
|
|
106
106
|
- CHANGELOG.md
|
|
107
107
|
- Gemfile
|
|
108
|
+
- lib/vagrant-windows/communication/command_filters/cat.rb
|
|
109
|
+
- lib/vagrant-windows/communication/command_filters/chmod.rb
|
|
110
|
+
- lib/vagrant-windows/communication/command_filters/chown.rb
|
|
111
|
+
- lib/vagrant-windows/communication/command_filters/rm.rb
|
|
112
|
+
- lib/vagrant-windows/communication/command_filters/test.rb
|
|
113
|
+
- lib/vagrant-windows/communication/command_filters/uname.rb
|
|
114
|
+
- lib/vagrant-windows/communication/command_filters/which.rb
|
|
108
115
|
- lib/vagrant-windows/communication/guestnetwork.rb
|
|
116
|
+
- lib/vagrant-windows/communication/linux_command_filter.rb
|
|
109
117
|
- lib/vagrant-windows/communication/winrmcommunicator.rb
|
|
118
|
+
- lib/vagrant-windows/communication/winrmfilemanager.rb
|
|
110
119
|
- lib/vagrant-windows/communication/winrmfinder.rb
|
|
111
120
|
- lib/vagrant-windows/communication/winrmshell.rb
|
|
112
121
|
- lib/vagrant-windows/communication/winrmshell_factory.rb
|
|
@@ -130,10 +139,7 @@ files:
|
|
|
130
139
|
- lib/vagrant-windows/monkey_patches/plugins/provisioners/shell/provisioner.rb
|
|
131
140
|
- lib/vagrant-windows/plugin.rb
|
|
132
141
|
- lib/vagrant-windows/provisioners/chef_command_builder.rb
|
|
133
|
-
- lib/vagrant-windows/scripts/
|
|
134
|
-
- lib/vagrant-windows/scripts/cheftask.xml.erb
|
|
135
|
-
- lib/vagrant-windows/scripts/cheftaskrun.ps1.erb
|
|
136
|
-
- lib/vagrant-windows/scripts/command_alias.ps1
|
|
142
|
+
- lib/vagrant-windows/scripts/elevated_shell.ps1.erb
|
|
137
143
|
- lib/vagrant-windows/scripts/mount_volume.ps1.erb
|
|
138
144
|
- lib/vagrant-windows/scripts/reboot_detect.ps1
|
|
139
145
|
- lib/vagrant-windows/scripts/set_work_network.ps1
|
|
@@ -149,6 +155,7 @@ files:
|
|
|
149
155
|
- spec/vagrant-windows/chef_command_builder_spec.rb
|
|
150
156
|
- spec/vagrant-windows/guestnetwork_spec.rb
|
|
151
157
|
- spec/vagrant-windows/helper_spec.rb
|
|
158
|
+
- spec/vagrant-windows/linux_command_filter_spec.rb
|
|
152
159
|
- spec/vagrant-windows/mount_shared_folder_spec.rb
|
|
153
160
|
- spec/vagrant-windows/windows_config_spec.rb
|
|
154
161
|
- spec/vagrant-windows/windows_machine_spec.rb
|
|
@@ -174,9 +181,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
174
181
|
version: '0'
|
|
175
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
183
|
requirements:
|
|
177
|
-
- - '
|
|
184
|
+
- - '>'
|
|
178
185
|
- !ruby/object:Gem::Version
|
|
179
|
-
version:
|
|
186
|
+
version: 1.3.1
|
|
180
187
|
requirements: []
|
|
181
188
|
rubyforge_project:
|
|
182
189
|
rubygems_version: 2.0.14
|
|
@@ -189,6 +196,7 @@ test_files:
|
|
|
189
196
|
- spec/vagrant-windows/chef_command_builder_spec.rb
|
|
190
197
|
- spec/vagrant-windows/guestnetwork_spec.rb
|
|
191
198
|
- spec/vagrant-windows/helper_spec.rb
|
|
199
|
+
- spec/vagrant-windows/linux_command_filter_spec.rb
|
|
192
200
|
- spec/vagrant-windows/mount_shared_folder_spec.rb
|
|
193
201
|
- spec/vagrant-windows/windows_config_spec.rb
|
|
194
202
|
- spec/vagrant-windows/windows_machine_spec.rb
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# kill the task so we can recreate it
|
|
2
|
-
schtasks /delete /tn "chef-solo" /f 2>&1 | out-null
|
|
3
|
-
|
|
4
|
-
# Ensure the chef task running file doesn't exist from a previous failure
|
|
5
|
-
if (Test-Path "<%= options[:chef_task_running] %>") {
|
|
6
|
-
del "<%= options[:chef_task_running] %>"
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
# schedule the task to run once in the far distant future
|
|
10
|
-
schtasks /create /tn 'chef-solo' /xml '<%= options[:chef_task_xml] %>' /ru '<%= options[:user] %>' /rp '<%= options[:pass] %>' | Out-Null
|
|
11
|
-
|
|
12
|
-
# start the scheduled task right now
|
|
13
|
-
schtasks /run /tn "chef-solo" | Out-Null
|
|
14
|
-
|
|
15
|
-
# wait for run_chef.ps1 to start or timeout after 1 minute
|
|
16
|
-
$timeoutSeconds = 60
|
|
17
|
-
$elapsedSeconds = 0
|
|
18
|
-
while ( (!(Test-Path "<%= options[:chef_task_running] %>")) -and ($elapsedSeconds -lt $timeoutSeconds) ) {
|
|
19
|
-
Start-Sleep -s 1
|
|
20
|
-
$elapsedSeconds++
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if ($elapsedSeconds -ge $timeoutSeconds) {
|
|
24
|
-
Write-Error "Timed out waiting for chef scheduled task to start"
|
|
25
|
-
exit -2
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# read the entire file, but only write out new lines we haven't seen before
|
|
29
|
-
$numLinesRead = 0
|
|
30
|
-
$success = $TRUE
|
|
31
|
-
while (Test-Path "<%= options[:chef_task_running] %>") {
|
|
32
|
-
Start-Sleep -m 100
|
|
33
|
-
|
|
34
|
-
if (Test-Path "<%= options[:chef_stdout_log] %>") {
|
|
35
|
-
$text = (get-content "<%= options[:chef_stdout_log] %>")
|
|
36
|
-
$numLines = ($text | Measure-Object -line).lines
|
|
37
|
-
$numLinesToRead = $numLines - $numLinesRead
|
|
38
|
-
|
|
39
|
-
if ($numLinesToRead -gt 0) {
|
|
40
|
-
$text | select -first $numLinesToRead -skip $numLinesRead | ForEach {
|
|
41
|
-
Write-Host "$_"
|
|
42
|
-
}
|
|
43
|
-
$numLinesRead += $numLinesToRead
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
exit Get-Content "<%= options[:chef_task_exitcode] %>"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-16"?>
|
|
2
|
-
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
3
|
-
<RegistrationInfo>
|
|
4
|
-
<Date>2013-06-21T22:41:43</Date>
|
|
5
|
-
<Author>Administrator</Author>
|
|
6
|
-
</RegistrationInfo>
|
|
7
|
-
<Triggers>
|
|
8
|
-
<TimeTrigger>
|
|
9
|
-
<StartBoundary>2045-01-01T12:00:00</StartBoundary>
|
|
10
|
-
<Enabled>true</Enabled>
|
|
11
|
-
</TimeTrigger>
|
|
12
|
-
</Triggers>
|
|
13
|
-
<Principals>
|
|
14
|
-
<Principal id="Author">
|
|
15
|
-
<UserId>vagrant</UserId>
|
|
16
|
-
<LogonType>Password</LogonType>
|
|
17
|
-
<RunLevel>HighestAvailable</RunLevel>
|
|
18
|
-
</Principal>
|
|
19
|
-
</Principals>
|
|
20
|
-
<Settings>
|
|
21
|
-
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
22
|
-
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
23
|
-
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
24
|
-
<AllowHardTerminate>true</AllowHardTerminate>
|
|
25
|
-
<StartWhenAvailable>false</StartWhenAvailable>
|
|
26
|
-
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
27
|
-
<IdleSettings>
|
|
28
|
-
<StopOnIdleEnd>true</StopOnIdleEnd>
|
|
29
|
-
<RestartOnIdle>false</RestartOnIdle>
|
|
30
|
-
</IdleSettings>
|
|
31
|
-
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
32
|
-
<Enabled>true</Enabled>
|
|
33
|
-
<Hidden>false</Hidden>
|
|
34
|
-
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
35
|
-
<WakeToRun>false</WakeToRun>
|
|
36
|
-
<ExecutionTimeLimit>PT2H</ExecutionTimeLimit>
|
|
37
|
-
<Priority>4</Priority>
|
|
38
|
-
</Settings>
|
|
39
|
-
<Actions Context="Author">
|
|
40
|
-
<Exec>
|
|
41
|
-
<Command>powershell</Command>
|
|
42
|
-
<Arguments>-file <%= options[:chef_task_run_ps1] %></Arguments>
|
|
43
|
-
</Exec>
|
|
44
|
-
</Actions>
|
|
45
|
-
</Task>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
$exitCode = -1
|
|
2
|
-
Set-ExecutionPolicy Unrestricted -force;
|
|
3
|
-
|
|
4
|
-
Try
|
|
5
|
-
{
|
|
6
|
-
"running" | Out-File "<%= options[:chef_task_running] %>"
|
|
7
|
-
$process = (Start-Process "<%= options[:chef_binary_path] %>" -ArgumentList "<%= options[:chef_arguments] %>" -NoNewWindow -PassThru -Wait -RedirectStandardOutput "<%= options[:chef_stdout_log] %>" -RedirectStandardError "<%= options[:chef_stderr_log] %>")
|
|
8
|
-
$exitCode = $process.ExitCode
|
|
9
|
-
}
|
|
10
|
-
Finally
|
|
11
|
-
{
|
|
12
|
-
$exitCode | Out-File "<%= options[:chef_task_exitcode] %>"
|
|
13
|
-
if (Test-Path "<%= options[:chef_task_running] %>") {
|
|
14
|
-
del "<%= options[:chef_task_running] %>"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exit $exitCode
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
function which {
|
|
2
|
-
$command = [Array](Get-Command $args[0] -errorAction SilentlyContinue)
|
|
3
|
-
if($null -eq $command)
|
|
4
|
-
{
|
|
5
|
-
exit 1
|
|
6
|
-
}
|
|
7
|
-
write-host $command[0].Definition
|
|
8
|
-
exit 0
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function test ([Switch] $d, [String] $path) {
|
|
12
|
-
if(Test-Path $path)
|
|
13
|
-
{
|
|
14
|
-
exit 0
|
|
15
|
-
}
|
|
16
|
-
exit 1
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function chmod {
|
|
20
|
-
exit 0
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function chown {
|
|
24
|
-
exit 0
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function mkdir ([Switch] $p, [String] $path)
|
|
28
|
-
{
|
|
29
|
-
if(Test-Path $path)
|
|
30
|
-
{
|
|
31
|
-
exit 0
|
|
32
|
-
} else {
|
|
33
|
-
New-Item $path -Type Directory -Force | Out-Null
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|