vagrant-windows-update 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54ea485d5e4758a19ea3a8504daf7f1e5ff17d02
4
- data.tar.gz: e17fa78130d2eee869788409b26217595e9692f4
3
+ metadata.gz: 4b2bca4595670ddeb5e08add150fea22c6aa0700
4
+ data.tar.gz: f725f87e1f42c7a16d2ce2a470f7b30910382dac
5
5
  SHA512:
6
- metadata.gz: e90107938bd2ad31cdee9e9bcf85f48af5e352e6d246221ca822168654bf775bcdffb256966b3347fac7d4bfe21071bdb80e66287da7bcf73d2b6834244b8e22
7
- data.tar.gz: 6cb0b04df5ad00fe868c3871e7e90db1e686fe3ff5cc22bb8491bed49b308d6631d7eb95eb6b4b3f70c4a8be211d8cd1b2323d100f73164256a27bd04d6aba57
6
+ metadata.gz: 9d52c4a301cb8d1cb46bb0521e200d7a4140167803f402a3323dd12c458c8b835e6308eea9712e6c94a3e5bbe341cf7afaeb07a1271513d193c4d5b549ff6ef5
7
+ data.tar.gz: 1915066fa60a3f950830f0ae03a8b24ef8be4079531022b204ae8c6414531994f8ab69362dac5dc7ebde740fa3200a98ba626784920c966ef4bc10878800f8dd
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module WindowsUpdate
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -20,6 +20,7 @@ $ErrorActionPreference = 'Stop'
20
20
  trap {
21
21
  Write-Output "ERROR: $_"
22
22
  Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1')
23
+ Write-Output (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1')
23
24
  Exit 1
24
25
  }
25
26
 
@@ -61,10 +62,14 @@ function Wait-Condition {
61
62
  }
62
63
  }
63
64
 
64
- function ExitWhenRebootRequired {
65
+ function ExitWhenRebootRequired([bool]$forceReboot=$false) {
66
+ $rebootRequired = $forceReboot
67
+
65
68
  # check for pending Windows Updates.
66
- $systemInformation = New-Object -ComObject 'Microsoft.Update.SystemInfo'
67
- $rebootRequired = $systemInformation.RebootRequired
69
+ if (!$rebootRequired) {
70
+ $systemInformation = New-Object -ComObject 'Microsoft.Update.SystemInfo'
71
+ $rebootRequired = $rebootRequired -or $systemInformation.RebootRequired
72
+ }
68
73
 
69
74
  # check for pending Windows Features.
70
75
  if (!$rebootRequired) {
@@ -74,8 +79,10 @@ function ExitWhenRebootRequired {
74
79
  }
75
80
 
76
81
  if ($rebootRequired) {
77
- Write-Output 'Pending Reboot detected. Waiting for the Windows Modules Installer to exit...'
78
- Wait-Condition {(Get-Process -ErrorAction SilentlyContinue TiWorker,TrustedInstaller | Measure-Object).Count -eq 0}
82
+ if (!$forceReboot) {
83
+ Write-Output 'Pending Reboot detected. Waiting for the Windows Modules Installer to exit...'
84
+ Wait-Condition {(Get-Process -ErrorAction SilentlyContinue TiWorker,TrustedInstaller | Measure-Object).Count -eq 0}
85
+ }
79
86
  Write-Output 'Rebooting...'
80
87
  Exit 0
81
88
  }
@@ -131,9 +138,7 @@ if ($searchResult.Updates.Count) {
131
138
  $updateInstaller = $updateSession.CreateUpdateInstaller()
132
139
  $updateInstaller.Updates = $updatesToInstall
133
140
  $installResult = $updateInstaller.Install()
134
- if ($installResult.RebootRequired) {
135
- ExitWhenRebootRequired
136
- }
141
+ ExitWhenRebootRequired $true
137
142
  }
138
143
  } else {
139
144
  Write-Output 'No Windows updates found'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-windows-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rui Lopes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-16 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake