vagrant-dsc 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -5
- data/development/Vagrantfile +3 -4
- data/lib/vagrant-dsc/provisioner.rb +11 -15
- data/lib/vagrant-dsc/version.rb +1 -1
- data/spec/provisioner/provisioner_spec.rb +13 -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: a27d30fb1437143bb3969c933581d2a78549134e
|
4
|
+
data.tar.gz: e45f109d21e48ad8d6226f3fa729b89993fffea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf2163219c6c17f22d78494b28897ac0c203f2e51658ec509abd19556260b6224c49b02dfd71169a6de6424dc7015b03a9c5131280fe5cb788d9c13bc13e348
|
7
|
+
data.tar.gz: d05416921b9d639382e006e4bae98bda92c1776ee7a45692257ec120f9b0f2c3a80b0056d9703f74133ee9ae4aa3a63346a90e7d4d2d574951303f2312fbed0e
|
data/README.md
CHANGED
@@ -22,6 +22,7 @@ In your Vagrantfile, add the following plugin and configure to your needs:
|
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
config.vm.provision "dsc" do |dsc|
|
25
|
+
|
25
26
|
# The path relative to `dsc.manifests_path` pointing to the Configuration file
|
26
27
|
dsc.configuration_file = "MyWebsite.ps1"
|
27
28
|
|
@@ -35,16 +36,22 @@ In your Vagrantfile, add the following plugin and configure to your needs:
|
|
35
36
|
# To pass in flags, simply set the value to `nil`
|
36
37
|
dsc.configuration_params = {"-MachineName" => "localhost", "-EnableDebug" => nil}
|
37
38
|
|
39
|
+
# A path relative to the Vagrantfile pointing to a Configuration Data file.
|
40
|
+
#
|
41
|
+
# See https://technet.microsoft.com/en-us/library/dn249925.aspx for details
|
42
|
+
# on how to parameterise your Configuration files.
|
43
|
+
dsc.configuration_data_file = "manifests/MyConfig.psd1"
|
44
|
+
|
38
45
|
# Relative path to a folder containing a pre-generated MOF file.
|
39
46
|
#
|
40
47
|
# Path is relative to the folder containing the Vagrantfile.
|
41
|
-
|
48
|
+
dsc.mof_path = "mof_output"
|
42
49
|
|
43
50
|
# Relative path to the folder containing the root Configuration manifest file.
|
44
51
|
# Defaults to 'manifests'.
|
45
52
|
#
|
46
53
|
# Path is relative to the folder containing the Vagrantfile.
|
47
|
-
|
54
|
+
dsc.manifests_path = "manifests"
|
48
55
|
|
49
56
|
# Set of module paths relative to the Vagrantfile dir.
|
50
57
|
#
|
@@ -52,17 +59,17 @@ In your Vagrantfile, add the following plugin and configure to your needs:
|
|
52
59
|
# environment to enable local modules to be addressed.
|
53
60
|
#
|
54
61
|
# @return [Array] Set of relative module paths.
|
55
|
-
|
62
|
+
dsc.module_path = ["manifests", "modules"]
|
56
63
|
|
57
64
|
# The type of synced folders to use when sharing the data
|
58
65
|
# required for the provisioner to work properly.
|
59
66
|
#
|
60
67
|
# By default this will use the default synced folder type.
|
61
68
|
# For example, you can set this to "nfs" to use NFS synced folders.
|
62
|
-
|
69
|
+
dsc.synced_folder_type = "nfs"
|
63
70
|
|
64
71
|
# Temporary working directory on the guest machine.
|
65
|
-
|
72
|
+
dsc.temp_dir = "/tmp/vagrant-dsc"
|
66
73
|
end
|
67
74
|
```
|
68
75
|
## Example
|
@@ -70,6 +77,10 @@ In your Vagrantfile, add the following plugin and configure to your needs:
|
|
70
77
|
There is a [sample](https://github.com/mefellows/vagrant-dsc/tree/master/development) Vagrant setup used for development of this plugin.
|
71
78
|
This is a great real-life example to get you on your way.
|
72
79
|
|
80
|
+
## Creating Windows Vagrant boxes
|
81
|
+
|
82
|
+
Look at some example Packer templates [here](https://github.com/mefellows/packer-windows-templates/).
|
83
|
+
|
73
84
|
## Roadmap
|
74
85
|
|
75
86
|
* Support DSC Pull Server provisioning
|
data/development/Vagrantfile
CHANGED
@@ -6,7 +6,7 @@ $shell_script = <<SCRIPT
|
|
6
6
|
#choco install seek-dsc
|
7
7
|
(New-Object System.Net.WebClient).DownloadFile('https://gallery.technet.microsoft.com/scriptcenter/xWebAdministration-Module-3c8bb6be/file/131367/3/xWebAdministration_1.3.2.zip','c:\\xwebadmin.zip')
|
8
8
|
choco install 7zip
|
9
|
-
|
9
|
+
& 'C:\\Program Files\\7-Zip\\7z.exe' x -y C:\\xwebadmin.zip -o'C:\\Program Files\\WindowsPowerShell\\Modules'
|
10
10
|
Get-DSCResource
|
11
11
|
SCRIPT
|
12
12
|
|
@@ -19,9 +19,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
19
19
|
# please see the online documentation at vagrantup.com.
|
20
20
|
|
21
21
|
# Every Vagrant virtual environment requires a box to build off of.
|
22
|
-
|
23
|
-
|
24
|
-
config.vm.box = "windows2012r2"
|
22
|
+
config.vm.box = "mfellows/windows2012r2"
|
23
|
+
config.vm.box_version = "1.0.1"
|
25
24
|
|
26
25
|
config.vm.guest = :windows
|
27
26
|
config.vm.communicator = "winrm"
|
@@ -191,32 +191,28 @@ module VagrantPlugins
|
|
191
191
|
|
192
192
|
# Runs the DSC Configuration on the guest machine.
|
193
193
|
def run_dsc_apply
|
194
|
-
command = ". '#{DSC_GUEST_RUNNER_PATH}'"
|
195
194
|
|
196
195
|
@machine.ui.info(I18n.t(
|
197
196
|
"vagrant_dsc.running_dsc",
|
198
197
|
manifest: config.configuration_file))
|
199
198
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
}
|
206
|
-
|
207
|
-
@machine.communicate.sudo(command, opts) do |type, data|
|
199
|
+
# A bit of an ugly dance, but this is how we get neat, colourised output and exit codes from a Powershell run
|
200
|
+
last_type = nil
|
201
|
+
new_line = ""
|
202
|
+
error = false
|
203
|
+
machine.communicate.shell.powershell("powershell -ExecutionPolicy Bypass -OutputFormat Text -file #{DSC_GUEST_RUNNER_PATH}") do |type, data|
|
208
204
|
if !data.chomp.empty?
|
205
|
+
error = true if type == :stderr
|
209
206
|
if [:stderr, :stdout].include?(type)
|
210
|
-
# Output the data with the proper color based on the stream.
|
211
|
-
# TODO: Seems the WinRM communicator or a bug in my powershell code
|
212
|
-
# precludes from errors coming back in the :stderr stream
|
213
207
|
color = type == :stdout ? :green : :red
|
214
|
-
|
215
|
-
|
216
|
-
|
208
|
+
new_line = "\r\n" if last_type != nil and last_type != type
|
209
|
+
last_type = type
|
210
|
+
@machine.ui.info( new_line + data.chomp, color: color, new_line: false, prefix: false)
|
217
211
|
end
|
218
212
|
end
|
219
213
|
end
|
214
|
+
|
215
|
+
error == false
|
220
216
|
end
|
221
217
|
|
222
218
|
# Verify that the shared folders have been properly configured
|
data/lib/vagrant-dsc/version.rb
CHANGED
@@ -11,6 +11,7 @@ describe VagrantPlugins::DSC::Provisioner do
|
|
11
11
|
let(:machine) { double("machine", ui: ui) }
|
12
12
|
let(:env) { double("environment", root_path: root_path, ui: ui) }
|
13
13
|
let(:vm) { double ("vm") }
|
14
|
+
let(:shell) { double ("shell") }
|
14
15
|
let(:communicator) { double ("communicator") }
|
15
16
|
let(:guest) { double ("guest") }
|
16
17
|
let(:configuration_file) { "manifests/MyWebsite.ps1" }
|
@@ -523,21 +524,26 @@ $response"
|
|
523
524
|
|
524
525
|
describe "Apply DSC" do
|
525
526
|
it "should invoke the DSC Runner and notify the User of provisioning status" do
|
526
|
-
|
527
|
-
expect(ui).to receive(:info).with("provisioned!", {color: :green, new_line: false, prefix: false}).once
|
527
|
+
allow(communicator).to receive(:shell).and_return(shell)
|
528
528
|
allow(machine).to receive(:communicate).and_return(communicator)
|
529
|
-
expect(
|
529
|
+
expect(shell).to receive(:powershell).with("powershell -ExecutionPolicy Bypass -OutputFormat Text -file c:/tmp/vagrant-dsc-runner.ps1").and_yield(:stdout, "provisioned!")
|
530
|
+
root_config.configuration_file = configuration_file
|
531
|
+
expect(ui).to receive(:info).with("\"Running DSC Provisioner with manifests/MyWebsite.ps1...\"")
|
532
|
+
expect(ui).to receive(:info).with("provisioned!", {color: :green, new_line: false, prefix: false}).once
|
530
533
|
|
531
534
|
subject.run_dsc_apply
|
532
535
|
end
|
533
536
|
|
534
537
|
it "should show error output in red" do
|
535
|
-
expect(ui).to receive(:info).with(any_args).once
|
536
|
-
expect(ui).to receive(:info).with("provisioned!", {color: :red, new_line: false, prefix: false}).once
|
537
538
|
allow(machine).to receive(:communicate).and_return(communicator)
|
538
|
-
|
539
|
+
allow(communicator).to receive(:shell).and_return(shell)
|
540
|
+
|
541
|
+
root_config.configuration_file = configuration_file
|
542
|
+
expect(ui).to receive(:info).with("\"Running DSC Provisioner with manifests/MyWebsite.ps1...\"")
|
543
|
+
expect(ui).to receive(:info).with("not provisioned!", {color: :red, new_line: false, prefix: false}).once
|
544
|
+
expect(shell).to receive(:powershell).with("powershell -ExecutionPolicy Bypass -OutputFormat Text -file c:/tmp/vagrant-dsc-runner.ps1").and_yield(:stderr, "not provisioned!")
|
539
545
|
|
540
546
|
subject.run_dsc_apply
|
541
547
|
end
|
542
548
|
end
|
543
|
-
end
|
549
|
+
end
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fellows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.0.14
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: DSC Provisioner for Vagrant
|