vagrant-dsc 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -8
- data/lib/vagrant-dsc/locales/en.yml +2 -3
- data/lib/vagrant-dsc/provisioner.rb +1 -8
- data/lib/vagrant-dsc/templates/runner.ps1.erb +6 -1
- data/lib/vagrant-dsc/version.rb +1 -1
- data/spec/provisioner/provisioner_spec.rb +6 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62685e91971c7c7cb5efccec0e81fd8af44e0d20
|
4
|
+
data.tar.gz: 2bb9b7e13583abed3f226e9734a77d30c4bed9ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53db6b5272916a49bd32bfb2f512fffb63340565705ef0be7113cebc512904127bf64167b2928466e0a285d41cef6157b1f4d4423f59ce11ff5b932c6d43fab6
|
7
|
+
data.tar.gz: 8a862de42af21ad8cb703102e2635a6a63bd062f6456ab857d315d57d7aa21651ae1ac1f4aa3fcef57d1d88f2a1878f31aa16bca478023abb6a31a6eae3db089
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/mefellows/vagrant-dsc/badge.png?branch=master)](https://coveralls.io/r/mefellows/vagrant-dsc?branch=master)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/vagrant-dsc.svg)](http://badge.fury.io/rb/vagrant-dsc)
|
6
6
|
|
7
|
-
[Desired State Configuration](
|
7
|
+
[Desired State Configuration](https://msdn.microsoft.com/en-us/powershell/dsc/overview) provisioning plugin for Vagrant, enabling you to quickly configure & bootstrap a Windows Virtual Machine in a repeatable, reliable fashion - the Vagrant way.
|
8
8
|
|
9
9
|
.NET Devs - no more excuses...
|
10
10
|
|
@@ -12,6 +12,13 @@
|
|
12
12
|
|
13
13
|
...is a thing of the past
|
14
14
|
|
15
|
+
## Features
|
16
|
+
|
17
|
+
1. Automated provisioning using [PowerShell DSC](https://msdn.microsoft.com/en-us/powershell/dsc/overview)
|
18
|
+
2. Install modules from the [Powershell Gallery](https://www.powershellgallery.com/)
|
19
|
+
with PowerShellGet / PowerShell5
|
20
|
+
3. Windows development machine from zero to dev-ready < 5 minutes!
|
21
|
+
|
15
22
|
## Installation
|
16
23
|
|
17
24
|
```vagrant plugin install vagrant-dsc```
|
@@ -60,16 +67,15 @@ In your Vagrantfile, add the following plugin and configure to your needs:
|
|
60
67
|
#
|
61
68
|
# These paths are added to the DSC Configuration running
|
62
69
|
# environment to enable local modules to be addressed.
|
63
|
-
#
|
64
|
-
# @return [Array] Set of relative module paths.
|
65
70
|
dsc.module_path = ["manifests", "modules"]
|
66
71
|
|
67
|
-
# Set of modules
|
72
|
+
# Set of modules to install from the PowerShell Gallery
|
73
|
+
# (https://www.powershellgallery.com/).
|
68
74
|
#
|
69
|
-
# Requires
|
75
|
+
# Requires PowerShell 5 or PowerShellGet installed on guest machine.
|
70
76
|
#
|
71
|
-
# These modules are downloaded and installed when
|
72
|
-
#
|
77
|
+
# These modules are downloaded and installed when provisioning,
|
78
|
+
# if a module is already installed it is a no-op.
|
73
79
|
dsc.module_install = ["xNetworking", "xComputerManagement"]
|
74
80
|
|
75
81
|
# The type of synced folders to use when sharing the data
|
@@ -131,7 +137,9 @@ We may consider automatically installing and configuring DSC in a future release
|
|
131
137
|
|
132
138
|
Before getting started, read the Vagrant plugin [development basics](https://docs.vagrantup.com/v2/plugins/development-basics.html) and [packaging](https://docs.vagrantup.com/v2/plugins/packaging.html) documentation.
|
133
139
|
|
134
|
-
You will need Ruby 1.
|
140
|
+
You will need Ruby 2.1.5 and Bundler v1.12.5 installed before proceeding.
|
141
|
+
|
142
|
+
_NOTE_: it _must_ be bundler v1.12.5 due to a hard dependency in Vagrant at this time.
|
135
143
|
|
136
144
|
```
|
137
145
|
git clone git@github.com:mefellows/vagrant-dsc.git
|
@@ -152,6 +160,16 @@ bundle exec vagrant up
|
|
152
160
|
|
153
161
|
There is a test Vagrant DSC setup in `./development` that is a good example of a simple acceptance test.
|
154
162
|
|
163
|
+
### Multiple Bundlers?
|
164
|
+
|
165
|
+
If you have multiple Bundler versions, you can still use 1.12.5 with the following:
|
166
|
+
|
167
|
+
```
|
168
|
+
bundle _1.12.5_ <command>
|
169
|
+
```
|
170
|
+
|
171
|
+
e.g. `bundle _1.12.5_ exec rake spec`
|
172
|
+
|
155
173
|
### Visual Studio Code
|
156
174
|
|
157
175
|
You can run the test from Visual Studio Code. This needs the binstubs from bundler. Run
|
@@ -40,6 +40,5 @@ en:
|
|
40
40
|
"Absolute 'module_path' not allowed. Please provide a path relative to your Vagrantfile."
|
41
41
|
failure_status: |-
|
42
42
|
"DSC Status is \"Failure\"."
|
43
|
-
|
44
|
-
|
45
|
-
The Host disconnect the active connection. Try to wait for the completion of DSC.
|
43
|
+
winrm_authorization_error_recover: |-
|
44
|
+
The host terminated the active connection. Try to wait for the completion of DSC.
|
@@ -103,7 +103,7 @@ module VagrantPlugins
|
|
103
103
|
rescue VagrantPlugins::CommunicatorWinRM::Errors::AuthenticationFailed
|
104
104
|
# when install set a domain controller windows kills the active connection with a AuthenticationFailed.
|
105
105
|
# The DSC job is still running and new connections are possible, so try to wait
|
106
|
-
@machine.ui.info(I18n.t("vagrant_dsc.
|
106
|
+
@machine.ui.info(I18n.t("vagrant_dsc.errors.winrm_authorization_error_recover"))
|
107
107
|
end
|
108
108
|
|
109
109
|
wait_for_dsc_completion
|
@@ -196,13 +196,7 @@ module VagrantPlugins
|
|
196
196
|
# Operation is current unsupported, but is likely to be enabled
|
197
197
|
# as a flag when the plugin detects an unsupported OS.
|
198
198
|
def install_dsc
|
199
|
-
# raise DSCError, I18n.t("vagrant_dsc.errors.manifest_missing", operation: "install_dsc")
|
200
199
|
raise DSCUnsupportedOperation, :operation => "install_dsc"
|
201
|
-
# Install chocolatey
|
202
|
-
|
203
|
-
# Ensure .NET 4.5 installed
|
204
|
-
|
205
|
-
# Ensure WMF 4.0 is installed
|
206
200
|
end
|
207
201
|
|
208
202
|
# Generates a PowerShell DSC runner script from an ERB template
|
@@ -232,7 +226,6 @@ module VagrantPlugins
|
|
232
226
|
# @return [String] the Path to the uploaded location on the guest machine.
|
233
227
|
def write_dsc_runner_script(script)
|
234
228
|
guest_script_path = DSC_GUEST_RUNNER_PATH
|
235
|
-
# TODO: Get a counter in here in case of multiple runs
|
236
229
|
file = Tempfile.new(["vagrant-dsc-runner", "ps1"])
|
237
230
|
begin
|
238
231
|
file.write(script)
|
@@ -17,10 +17,15 @@ $env:PSModulePath="$absoluteModulePaths;${env:PSModulePath}"
|
|
17
17
|
|
18
18
|
<% if !options[:module_install].empty? %>
|
19
19
|
Write-Host "Ensure Modules"
|
20
|
+
Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue -ErrorVariable NuGetError | Out-Null
|
21
|
+
if ($NuGetError) {
|
22
|
+
Write-Host "Install Package Provider Nuget"
|
23
|
+
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
|
24
|
+
}
|
20
25
|
if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne "Trusted") {
|
21
26
|
Set-PSRepository -Name PSGallery -InstallationPolicy "Trusted"
|
22
27
|
}
|
23
|
-
# Install-
|
28
|
+
# Install-Module only installs if the module is not already installed
|
24
29
|
"<%= options[:module_install] %>".Split(";") | foreach { Install-Module $_ }
|
25
30
|
<% end %>
|
26
31
|
|
data/lib/vagrant-dsc/version.rb
CHANGED
@@ -338,14 +338,8 @@ describe VagrantPlugins::DSC::Provisioner do
|
|
338
338
|
end
|
339
339
|
|
340
340
|
it "should raise an error if DSC version is invalid" do
|
341
|
-
# shell = double("WinRMShell")
|
342
|
-
# allow(communicator).to receive(:shell).and_return(shell)
|
343
|
-
# allow(communicator).to receive(:create_shell).and_return(shell)
|
344
|
-
|
345
|
-
# TODO: Create an actual Communicator object and mock out methods/calls to isolate this behaviour better
|
346
341
|
expect(communicator).to receive(:test).with("(($PSVersionTable | ConvertTo-json | ConvertFrom-Json).PSVersion.Major) -ge 4", {:error_class=>VagrantPlugins::DSC::DSCError, :error_key=>:dsc_incorrect_PowerShell_version})
|
347
342
|
allow(subject).to receive(:verify_binary).and_return(true)
|
348
|
-
# expect { subject.verify_dsc }.to raise_error("Unable to detect a working DSC environment. Please ensure powershell v4+ is installed, including WMF 4+.")
|
349
343
|
subject.verify_dsc
|
350
344
|
end
|
351
345
|
|
@@ -661,10 +655,15 @@ $env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"
|
|
661
655
|
(\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
662
656
|
|
663
657
|
Write-Host \"Ensure Modules\"
|
658
|
+
Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue -ErrorVariable NuGetError | Out-Null
|
659
|
+
if ($NuGetError) {
|
660
|
+
Write-Host \"Install Package Provider Nuget\"
|
661
|
+
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
|
662
|
+
}
|
664
663
|
if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne \"Trusted\") {
|
665
664
|
Set-PSRepository -Name PSGallery -InstallationPolicy \"Trusted\"
|
666
665
|
}
|
667
|
-
# Install-
|
666
|
+
# Install-Module only installs if the module is not already installed
|
668
667
|
\"xNetworking;xSQLServer\".Split(\";\") | foreach { Install-Module $_ }
|
669
668
|
|
670
669
|
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\" -Resolve)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-dsc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fellows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.2.0
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: DSC Provisioner for Vagrant
|