vagrant-dsc 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/README.md +4 -0
- data/development/Vagrantfile +8 -6
- data/lib/vagrant-dsc/provisioner.rb +2 -0
- data/lib/vagrant-dsc/templates/runner.ps1.erb +3 -2
- data/lib/vagrant-dsc/version.rb +1 -1
- data/spec/provisioner/config_spec.rb +5 -0
- data/spec/provisioner/provisioner_spec.rb +50 -5
- 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: 32a6233f447ba5f18cc19f0f7e55e4856ae2bf67
|
4
|
+
data.tar.gz: 8aa7f0c18bc920583e62bebe13beb33a9e818133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1bbe12cd6c2916092d25b834bf3fb87319774b9b53eb7e3676be67d8a98f3b9183c6c7e0b855c35dccfed057bffa7e569369216e3ed3fbd895b79f9c7f66f0
|
7
|
+
data.tar.gz: a6188461eaa121535bd8e62129257f127c9be8c258f192695807ebf7064406fb553e09a2b266903b693e60f7584125054bfcedbcbc1685519e2ba9966897e209
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -65,6 +65,10 @@ In your Vagrantfile, add the following plugin and configure to your needs:
|
|
65
65
|
#dsc.temp_dir = "/tmp/vagrant-dsc"
|
66
66
|
end
|
67
67
|
```
|
68
|
+
## Example
|
69
|
+
|
70
|
+
There is a [sample](https://github.com/mefellows/vagrant-dsc/tree/master/development) Vagrant setup used for development of this plugin.
|
71
|
+
This is a great real-life example to get you on your way.
|
68
72
|
|
69
73
|
## Roadmap
|
70
74
|
|
data/development/Vagrantfile
CHANGED
@@ -16,16 +16,17 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
16
16
|
# please see the online documentation at vagrantup.com.
|
17
17
|
|
18
18
|
# Every Vagrant virtual environment requires a box to build off of.
|
19
|
-
config.vm.box = "kensykora/windows_2012_r2_standard"
|
19
|
+
#config.vm.box = "kensykora/windows_2012_r2_standard"
|
20
|
+
config.vm.box = "seek-base-v3"
|
20
21
|
|
21
22
|
config.vm.guest = :windows
|
22
23
|
config.vm.communicator = "winrm"
|
23
24
|
|
24
25
|
config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
|
25
26
|
config.vm.network :forwarded_port, guest: 80, host: 8000, id: "web" # Port forward for IIS
|
26
|
-
config.vm.network :forwarded_port, guest: 443, host: 8443, id: "ssl" # Port forward for SSL IIS
|
27
|
+
# config.vm.network :forwarded_port, guest: 443, host: 8443, id: "ssl" # Port forward for SSL IIS
|
27
28
|
config.vm.network :forwarded_port, guest: 22, host: 9222, id: "ssh" # Port forward for SSL IIS
|
28
|
-
|
29
|
+
config.winrm.guest_port = 5985
|
29
30
|
config.vm.provider "virtualbox" do |v|
|
30
31
|
v.gui = true
|
31
32
|
end
|
@@ -45,10 +46,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
45
46
|
# environment to enable local modules to be addressed.
|
46
47
|
#
|
47
48
|
# @return [Array] Set of relative module paths.
|
48
|
-
dsc.module_path = ["manifests", "modules"]
|
49
|
+
# dsc.module_path = ["manifests", "modules"]
|
50
|
+
dsc.module_path = ["modules"]
|
49
51
|
|
50
52
|
# The path relative to `dsc.manifests_path` pointing to the Configuration file
|
51
|
-
dsc.configuration_file = "
|
53
|
+
dsc.configuration_file = "MyWebsite.ps1"
|
52
54
|
|
53
55
|
# The Configuration Command to run. Assumed to be the same as the `dsc.configuration_file`
|
54
56
|
# (sans extension) if not provided.
|
@@ -67,7 +69,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
67
69
|
# Defaults to 'manifests'.
|
68
70
|
#
|
69
71
|
# Path is relative to the folder containing the Vagrantfile.
|
70
|
-
|
72
|
+
dsc.manifests_path = "manifests"
|
71
73
|
|
72
74
|
# The type of synced folders to use when sharing the data
|
73
75
|
# required for the provisioner to work properly.
|
@@ -160,7 +160,9 @@ module VagrantPlugins
|
|
160
160
|
module_paths: @module_paths.map { |k,v| v }.join(";"),
|
161
161
|
mof_path: @config.mof_path,
|
162
162
|
configuration_file: @config.configuration_file,
|
163
|
+
configuration_file_path: "#{@config.manifests_path}/#{File.basename @config.configuration_file}",
|
163
164
|
configuration_name: @config.configuration_name,
|
165
|
+
manifests_path: @config.manifests_path,
|
164
166
|
temp_path: @config.temp_dir,
|
165
167
|
parameters: @config.configuration_params.map { |k,v| "#{k}" + (!v.nil? ? " \"#{v}\"": '') }.join(" ")
|
166
168
|
})
|
@@ -7,14 +7,15 @@
|
|
7
7
|
#
|
8
8
|
|
9
9
|
# Set the local PowerShell Module environment path
|
10
|
-
<% if options[:module_paths] %>
|
10
|
+
<% if !options[:module_paths].empty? %>
|
11
11
|
$absoluteModulePaths = [string]::Join(";", ("<%= options[:module_paths] %>".Split(";") | ForEach-Object { $_ | Resolve-Path }))
|
12
12
|
|
13
13
|
echo "Adding to path: $absoluteModulePaths"
|
14
14
|
$env:PSModulePath="$absoluteModulePaths;${env:PSModulePath}"
|
15
|
+
("<%= options[:module_paths] %>".Split(";") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
15
16
|
<% end %>
|
16
17
|
|
17
|
-
$script = $(Join-Path "<%= options[:temp_path] %>" "<%= options[:
|
18
|
+
$script = $(Join-Path "<%= options[:temp_path] %>" "<%= options[:configuration_file_path] %>" -Resolve)
|
18
19
|
echo "PSModulePath Configured: ${env:PSModulePath}"
|
19
20
|
echo "Running Configuration file: ${script}"
|
20
21
|
|
data/lib/vagrant-dsc/version.rb
CHANGED
@@ -101,6 +101,11 @@ describe VagrantPlugins::DSC::Config do
|
|
101
101
|
expect(subject.expanded_module_paths('/path/to/vagrant/')).to eq(["/path/to/vagrant/foo/modules"])
|
102
102
|
end
|
103
103
|
|
104
|
+
it "should generate a module path on the host machine relative to the Vagrantfile with relative paths" do
|
105
|
+
subject.module_path = "../modules"
|
106
|
+
expect(subject.expanded_module_paths('/path/to/vagrant/')).to eq(["/path/to/modules"])
|
107
|
+
end
|
108
|
+
|
104
109
|
it "should generate module paths on the host machine relative to the Vagrantfile" do
|
105
110
|
subject.module_path = ["dont/exist", "also/dont/exist"]
|
106
111
|
expect(subject.expanded_module_paths('/path/to/vagrant/')).to eq(["/path/to/vagrant/dont/exist", "/path/to/vagrant/also/dont/exist"])
|
@@ -244,7 +244,7 @@ describe VagrantPlugins::DSC::Provisioner do
|
|
244
244
|
|
245
245
|
end
|
246
246
|
|
247
|
-
|
247
|
+
context "with default parameters" do
|
248
248
|
it "should generate a valid powershell command" do
|
249
249
|
script = subject.generate_dsc_runner_script
|
250
250
|
expect_script = "#
|
@@ -260,8 +260,50 @@ $absoluteModulePaths = [string]::Join(\";\", (\"/tmp/vagrant-dsc-1/modules-0;/tm
|
|
260
260
|
|
261
261
|
echo \"Adding to path: $absoluteModulePaths\"
|
262
262
|
$env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"
|
263
|
+
(\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
263
264
|
|
264
|
-
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\")
|
265
|
+
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\" -Resolve)
|
266
|
+
echo \"PSModulePath Configured: ${env:PSModulePath}\"
|
267
|
+
echo \"Running Configuration file: ${script}\"
|
268
|
+
|
269
|
+
# Generate the MOF file, only if a MOF path not already provided.
|
270
|
+
# Import the Manifest
|
271
|
+
. $script
|
272
|
+
|
273
|
+
cd \"/tmp/vagrant-dsc-1\"
|
274
|
+
$StagingPath = $(Join-Path \"/tmp/vagrant-dsc-1\" \"staging\")
|
275
|
+
$response = MyWebsite -OutputPath $StagingPath 4>&1 5>&1 | Out-String
|
276
|
+
|
277
|
+
# Start a DSC Configuration run
|
278
|
+
$response += Start-DscConfiguration -Force -Wait -Verbose -Path $StagingPath 4>&1 5>&1 | Out-String
|
279
|
+
$response"
|
280
|
+
|
281
|
+
expect(script).to eq(expect_script)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
context "with a relative manifests_path" do
|
286
|
+
it "should generate a valid powershell command" do
|
287
|
+
root_config.manifests_path = "../manifests"
|
288
|
+
root_config.configuration_file = configuration_file
|
289
|
+
|
290
|
+
script = subject.generate_dsc_runner_script
|
291
|
+
expect_script = "#
|
292
|
+
# DSC Runner.
|
293
|
+
#
|
294
|
+
# Bootstraps the DSC environment, sets up configuration data
|
295
|
+
# and runs the DSC Configuration.
|
296
|
+
#
|
297
|
+
#
|
298
|
+
|
299
|
+
# Set the local PowerShell Module environment path
|
300
|
+
$absoluteModulePaths = [string]::Join(\";\", (\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { $_ | Resolve-Path }))
|
301
|
+
|
302
|
+
echo \"Adding to path: $absoluteModulePaths\"
|
303
|
+
$env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"
|
304
|
+
(\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
305
|
+
|
306
|
+
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"../manifests/MyWebsite.ps1\" -Resolve)
|
265
307
|
echo \"PSModulePath Configured: ${env:PSModulePath}\"
|
266
308
|
echo \"Running Configuration file: ${script}\"
|
267
309
|
|
@@ -299,8 +341,9 @@ $absoluteModulePaths = [string]::Join(\";\", (\"/tmp/vagrant-dsc-1/modules-0;/tm
|
|
299
341
|
|
300
342
|
echo \"Adding to path: $absoluteModulePaths\"
|
301
343
|
$env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"
|
344
|
+
(\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
302
345
|
|
303
|
-
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\")
|
346
|
+
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\" -Resolve)
|
304
347
|
echo \"PSModulePath Configured: ${env:PSModulePath}\"
|
305
348
|
echo \"Running Configuration file: ${script}\"
|
306
349
|
|
@@ -336,8 +379,9 @@ $absoluteModulePaths = [string]::Join(\";\", (\"/tmp/vagrant-dsc-1/modules-0;/tm
|
|
336
379
|
|
337
380
|
echo \"Adding to path: $absoluteModulePaths\"
|
338
381
|
$env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"
|
382
|
+
(\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
339
383
|
|
340
|
-
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\")
|
384
|
+
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\" -Resolve)
|
341
385
|
echo \"PSModulePath Configured: ${env:PSModulePath}\"
|
342
386
|
echo \"Running Configuration file: ${script}\"
|
343
387
|
|
@@ -376,8 +420,9 @@ $absoluteModulePaths = [string]::Join(\";\", (\"/tmp/vagrant-dsc-1/modules-0;/tm
|
|
376
420
|
|
377
421
|
echo \"Adding to path: $absoluteModulePaths\"
|
378
422
|
$env:PSModulePath=\"$absoluteModulePaths;${env:PSModulePath}\"
|
423
|
+
(\"/tmp/vagrant-dsc-1/modules-0;/tmp/vagrant-dsc-1/modules-1\".Split(\";\") | ForEach-Object { gci -Recurse $_ | ForEach-Object { Unblock-File $_.FullName} })
|
379
424
|
|
380
|
-
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\")
|
425
|
+
$script = $(Join-Path \"/tmp/vagrant-dsc-1\" \"manifests/MyWebsite.ps1\" -Resolve)
|
381
426
|
echo \"PSModulePath Configured: ${env:PSModulePath}\"
|
382
427
|
echo \"Running Configuration file: ${script}\"
|
383
428
|
|
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.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fellows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.4.1
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: DSC Provisioner for Vagrant
|