vagrant-windows 1.3.0.pre.1 → 1.3.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,21 +25,14 @@ module VagrantPlugins
25
25
  def wait_if_rebooting
26
26
  # Check to see if the guest is rebooting, if its rebooting then wait until its ready
27
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?
28
+
29
+ while is_rebooting?(machine)
30
+ @logger.debug('Guest is rebooting, waiting 10 seconds...')
31
+ sleep(10)
35
32
  end
36
33
  end
37
34
 
38
- def run_chef_solo_on_windows
39
- # This re-establishes our symbolic links if they were created between now and a reboot
40
- # Fixes issue #119
41
- @machine.communicate.execute('& net use a-non-existant-share', :error_check => false)
42
-
35
+ def run_chef_solo_on_windows
43
36
  # create cheftaskrun.ps1 that the scheduled task will invoke when run
44
37
  render_file_and_upload("cheftaskrun.ps1", chef_script_options[:chef_task_run_ps1], :options => chef_script_options)
45
38
 
@@ -63,6 +56,10 @@ module VagrantPlugins
63
56
  else
64
57
  @machine.env.ui.info I18n.t("vagrant.provisioners.chef.running_solo_again")
65
58
  end
59
+
60
+ # This re-establishes our symbolic links if they were created between now and a reboot
61
+ # Fixes issue #119
62
+ @machine.communicate.execute('& net use a-non-existant-share', :error_check => false)
66
63
 
67
64
  exit_status = @machine.communicate.execute(command, :error_check => false) do |type, data|
68
65
  # Output the data with the proper color based on the stream.
@@ -117,7 +114,12 @@ module VagrantPlugins
117
114
  }
118
115
  end
119
116
  @chef_script_options
120
- end
117
+ end
118
+
119
+ def is_rebooting?(machine)
120
+ reboot_detect_script = VagrantWindows.load_script('reboot_detect.ps1')
121
+ @machine.communicate.execute(reboot_detect_script, :error_check => false) != 0
122
+ end
121
123
 
122
124
  def is_windows
123
125
  @machine.config.vm.guest.eql? :windows
@@ -22,10 +22,22 @@ namespace VagrantWindows {
22
22
  }
23
23
 
24
24
  if (ShuttingDown) {
25
- Write-Host "Shutting Down"
26
25
  exit 1
27
26
  }
28
27
  else {
29
- Write-Host "All good"
30
- exit 0
28
+ # see if a reboot is scheduled in the future by trying to schedule a reboot
29
+ . shutdown.exe -f -r -t 60
30
+
31
+ if ($LASTEXITCODE -eq 1190) {
32
+ # reboot is already pending
33
+ exit 2
34
+ }
35
+
36
+ # Remove the pending reboot we just created above
37
+ if ($LASTEXITCODE -eq 0) {
38
+ . shutdown.exe -a
39
+ }
31
40
  }
41
+
42
+ # no reboot in progress or scheduled
43
+ exit 0
@@ -1,3 +1,3 @@
1
1
  module VagrantWindows
2
- VERSION = "1.3.0.pre.1"
2
+ VERSION = "1.3.0.pre.2"
3
3
  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.3.0.pre.1
4
+ version: 1.3.0.pre.2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-26 00:00:00.000000000 Z
13
+ date: 2013-11-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: winrm
@@ -225,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  segments:
227
227
  - 0
228
- hash: -1146635457027208657
228
+ hash: -2247683547305016940
229
229
  required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  none: false
231
231
  requirements: