vagrant-windows 1.2.3 → 1.3.0.pre.1

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.
@@ -9,6 +9,7 @@ module VagrantPlugins
9
9
 
10
10
  include VagrantWindows::Helper
11
11
 
12
+ provision_on_linux = instance_method(:provision)
12
13
  run_chef_solo_on_linux = instance_method(:run_chef_solo)
13
14
 
14
15
  # This patch is needed until Vagrant supports chef on Windows guests
@@ -16,8 +17,25 @@ module VagrantPlugins
16
17
  is_windows ? run_chef_solo_on_windows() : run_chef_solo_on_linux.bind(self).()
17
18
  end
18
19
 
20
+ define_method(:provision) do
21
+ wait_if_rebooting() if is_windows
22
+ provision_on_linux.bind(self).()
23
+ end
24
+
25
+ def wait_if_rebooting
26
+ # Check to see if the guest is rebooting, if its rebooting then wait until its ready
27
+ @logger.info('Checking guest reboot status')
28
+ reboot_detect_script = VagrantWindows.load_script('reboot_detect.ps1')
29
+ exit_status = @machine.communicate.execute(reboot_detect_script, :error_check => false)
30
+ if exit_status != 0
31
+ begin
32
+ @logger.debug('Guest is rebooting, waiting 10 seconds...')
33
+ sleep(10)
34
+ end until @machine.communicate.ready?
35
+ end
36
+ end
37
+
19
38
  def run_chef_solo_on_windows
20
-
21
39
  # This re-establishes our symbolic links if they were created between now and a reboot
22
40
  # Fixes issue #119
23
41
  @machine.communicate.execute('& net use a-non-existant-share', :error_check => false)
@@ -0,0 +1,31 @@
1
+ # function to check whether machine is currently shutting down
2
+ function ShuttingDown {
3
+ [string]$sourceCode = @"
4
+ using System;
5
+ using System.Runtime.InteropServices;
6
+
7
+ namespace VagrantWindows {
8
+ public static class RemoteManager {
9
+ private const int SM_SHUTTINGDOWN = 0x2000;
10
+
11
+ [DllImport("User32.dll", CharSet = CharSet.Unicode)]
12
+ private static extern int GetSystemMetrics(int Index);
13
+
14
+ public static bool Shutdown() {
15
+ return (0 != GetSystemMetrics(SM_SHUTTINGDOWN));
16
+ }
17
+ }
18
+ }
19
+ "@
20
+ $type = Add-Type -TypeDefinition $sourceCode -PassThru
21
+ return $type::Shutdown()
22
+ }
23
+
24
+ if (ShuttingDown) {
25
+ Write-Host "Shutting Down"
26
+ exit 1
27
+ }
28
+ else {
29
+ Write-Host "All good"
30
+ exit 0
31
+ }
@@ -1,3 +1,3 @@
1
1
  module VagrantWindows
2
- VERSION = "1.2.3"
2
+ VERSION = "1.3.0.pre.1"
3
3
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-windows
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
5
- prerelease:
4
+ version: 1.3.0.pre.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Morton
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-25 00:00:00.000000000 Z
13
+ date: 2013-10-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: winrm
@@ -186,6 +186,7 @@ files:
186
186
  - lib/vagrant-windows/scripts/cheftaskrun.ps1.erb
187
187
  - lib/vagrant-windows/scripts/command_alias.ps1
188
188
  - lib/vagrant-windows/scripts/mount_volume.ps1.erb
189
+ - lib/vagrant-windows/scripts/reboot_detect.ps1
189
190
  - lib/vagrant-windows/scripts/set_work_network.ps1
190
191
  - lib/vagrant-windows/scripts/winrs_v3_get_adapters.ps1
191
192
  - lib/vagrant-windows/version.rb
@@ -224,16 +225,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
225
  version: '0'
225
226
  segments:
226
227
  - 0
227
- hash: -3479257835022585511
228
+ hash: -1146635457027208657
228
229
  required_rubygems_version: !ruby/object:Gem::Requirement
229
230
  none: false
230
231
  requirements:
231
- - - ! '>='
232
+ - - ! '>'
232
233
  - !ruby/object:Gem::Version
233
- version: '0'
234
- segments:
235
- - 0
236
- hash: -3479257835022585511
234
+ version: 1.3.1
237
235
  requirements: []
238
236
  rubyforge_project:
239
237
  rubygems_version: 1.8.23