vagrant-dsc 1.1.1 → 1.1.2

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: 62685e91971c7c7cb5efccec0e81fd8af44e0d20
4
- data.tar.gz: 2bb9b7e13583abed3f226e9734a77d30c4bed9ea
3
+ metadata.gz: 8d8b084bcba884bdf9fca4300290c80e2dc5ad4c
4
+ data.tar.gz: 80b7d911f8205e82ed29dd6164c593db7161263f
5
5
  SHA512:
6
- metadata.gz: 53db6b5272916a49bd32bfb2f512fffb63340565705ef0be7113cebc512904127bf64167b2928466e0a285d41cef6157b1f4d4423f59ce11ff5b932c6d43fab6
7
- data.tar.gz: 8a862de42af21ad8cb703102e2635a6a63bd062f6456ab857d315d57d7aa21651ae1ac1f4aa3fcef57d1d88f2a1878f31aa16bca478023abb6a31a6eae3db089
6
+ metadata.gz: fbc5c0dabb0a1695a724e4d329b7e0e6b77093255c9880617742a66226ec6d54774d369714daec0a2759c8894d9c19700054c677bb921454dc7c858a915d8415
7
+ data.tar.gz: 3655d498d3f0e2df00815c603516af03e5178911eec15e8ca8da873c58ff0071726a39e01a3531eba816c0284410d3face44e213f54dd6a9b2fdcdb88acef08d
@@ -247,17 +247,15 @@ module VagrantPlugins
247
247
  manifest: config.configuration_file))
248
248
 
249
249
  # A bit of an ugly dance, but this is how we get neat, colourised output and exit codes from a Powershell run
250
- last_type = nil
251
- new_line = ""
252
250
  error = false
253
251
  machine.communicate.shell.powershell("powershell -ExecutionPolicy Bypass -OutputFormat Text -file #{DSC_GUEST_RUNNER_PATH}") do |type, data|
254
252
  if !data.chomp.empty?
255
253
  error = true if type == :stderr
256
254
  if [:stderr, :stdout].include?(type)
257
255
  color = type == :stdout ? :green : :red
258
- new_line = "\r\n" if last_type != nil and last_type != type
259
- last_type = type
260
- @machine.ui.info( new_line + data.chomp, color: color, new_line: false, prefix: false)
256
+ # Remove the \r\n since the dsc output uses this if line is to long. A Line break is a simple \n
257
+ data = data.gsub(/\r\n/,"") if type == :stdout
258
+ @machine.ui.info( data.strip(), color: color, prefix: false)
261
259
  end
262
260
  end
263
261
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Dsc
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ describe VagrantPlugins::DSC::Config do
17
17
  before do
18
18
  env = double("environment", root_path: "/tmp/vagrant-dsc-path")
19
19
  config = double("config")
20
- machine.stub(config: config, env: env)
20
+ allow(machine).to receive_messages(config: config, env: env)
21
21
 
22
22
  allow(machine).to receive(:root_path).and_return("/c/foo")
23
23
  end
@@ -65,7 +65,7 @@ describe VagrantPlugins::DSC::Config do
65
65
  it "should detect the fully qualified path to the manifest automatically" do
66
66
  env = double("environment", root_path: "")
67
67
  config = double("config")
68
- machine.stub(config: config, env: env)
68
+ allow(machine).to receive_messages(config: config, env: env)
69
69
  allow(machine).to receive(:root_path).and_return(".")
70
70
 
71
71
  subject.configuration_file = "manifests/MyWebsite.ps1"
@@ -83,7 +83,7 @@ describe VagrantPlugins::DSC::Config do
83
83
  before do
84
84
  env = double("environment", root_path: "")
85
85
  config = double("config")
86
- machine.stub(config: config, env: env)
86
+ allow(machine).to receive_messages(config: config, env: env)
87
87
 
88
88
  allow(machine).to receive(:root_path).and_return("/path/to/vagrant")
89
89
  end
@@ -138,7 +138,7 @@ describe VagrantPlugins::DSC::Config do
138
138
  it "should detect the fully qualified path to the configuration data file automatically" do
139
139
  env = double("environment", root_path: "")
140
140
  config = double("config")
141
- machine.stub(config: config, env: env)
141
+ allow(machine).to receive_messages(config: config, env: env)
142
142
  allow(machine).to receive(:root_path).and_return(".")
143
143
 
144
144
  subject.configuration_data_file = "manifests/foo.psd1"
@@ -23,7 +23,7 @@ describe VagrantPlugins::DSC::Provisioner do
23
23
  describe "configure" do
24
24
  before do
25
25
  allow(machine).to receive(:root_config).and_return(root_config)
26
- machine.stub(config: root_config, env: env)
26
+ allow(machine).to receive_messages(config: root_config, env: env)
27
27
  root_config.module_path = module_path
28
28
  root_config.configuration_file = configuration_file
29
29
  root_config.finalize!
@@ -79,7 +79,7 @@ describe VagrantPlugins::DSC::Provisioner do
79
79
 
80
80
  before do
81
81
  allow(machine).to receive(:root_config).and_return(root_config)
82
- machine.stub(config: root_config, env: env, communicate: communicator)
82
+ allow(machine).to receive_messages(config: root_config, env: env, communicate: communicator)
83
83
  root_config.module_path = module_path
84
84
  root_config.configuration_file = configuration_file
85
85
  root_config.finalize!
@@ -123,7 +123,7 @@ describe VagrantPlugins::DSC::Provisioner do
123
123
  root_config.validate(machine)
124
124
  subject.configure(root_config)
125
125
  # allow(root_config).to receive(:vm).and_return(vm)
126
- machine.stub(config: root_config, env: env, communicate: communicator, guest: guest)
126
+ allow(machine).to receive_messages(config: root_config, env: env, communicate: communicator, guest: guest)
127
127
  end
128
128
 
129
129
  it "should allow reboot capability when capability exists" do
@@ -357,7 +357,7 @@ describe VagrantPlugins::DSC::Provisioner do
357
357
 
358
358
  allow(machine).to receive(:root_config).and_return(root_config)
359
359
  root_config.configuration_file = configuration_file
360
- machine.stub(config: root_config, env: env)
360
+ allow(machine).to receive_messages(config: root_config, env: env)
361
361
  root_config.module_path = module_path
362
362
  root_config.configuration_file = configuration_file
363
363
  root_config.finalize!
@@ -584,7 +584,7 @@ del $StagingPath\\*.mof
584
584
  allow(machine).to receive(:root_config).and_return(root_config)
585
585
  root_config.configuration_file = configuration_file
586
586
  root_config.configuration_data_file = configuration_data_file
587
- machine.stub(config: root_config, env: env)
587
+ allow(machine).to receive_messages(config: root_config, env: env)
588
588
  root_config.module_path = module_path
589
589
  root_config.configuration_file = configuration_file
590
590
  root_config.finalize!
@@ -695,7 +695,7 @@ del $StagingPath\\*.mof
695
695
  script = "myscript"
696
696
  path = "/local/runner/path"
697
697
  guest_path = "c:/tmp/vagrant-dsc-runner.ps1"
698
- machine.stub(config: root_config, env: env, communicate: communicator)
698
+ allow(machine).to receive_messages(config: root_config, env: env, communicate: communicator)
699
699
  file = double("file")
700
700
  allow(file).to receive(:path).and_return(path)
701
701
  allow(Tempfile).to receive(:new) { file }
@@ -716,7 +716,7 @@ del $StagingPath\\*.mof
716
716
  expect(shell).to receive(:powershell).with("powershell -ExecutionPolicy Bypass -OutputFormat Text -file c:/tmp/vagrant-dsc-runner.ps1").and_yield(:stdout, "provisioned!")
717
717
  root_config.configuration_file = configuration_file
718
718
  expect(ui).to receive(:info).with("\"Running DSC Provisioner with manifests/MyWebsite.ps1...\"")
719
- expect(ui).to receive(:info).with("provisioned!", {color: :green, new_line: false, prefix: false}).once
719
+ expect(ui).to receive(:info).with("provisioned!", {color: :green, prefix: false}).once
720
720
 
721
721
  subject.run_dsc_apply
722
722
  end
@@ -727,10 +727,32 @@ del $StagingPath\\*.mof
727
727
 
728
728
  root_config.configuration_file = configuration_file
729
729
  expect(ui).to receive(:info).with("\"Running DSC Provisioner with manifests/MyWebsite.ps1...\"")
730
- expect(ui).to receive(:info).with("not provisioned!", {color: :red, new_line: false, prefix: false}).once
730
+ expect(ui).to receive(:info).with("not provisioned!", {color: :red, prefix: false}).once
731
731
  expect(shell).to receive(:powershell).with("powershell -ExecutionPolicy Bypass -OutputFormat Text -file c:/tmp/vagrant-dsc-runner.ps1").and_yield(:stderr, "not provisioned!")
732
732
 
733
733
  subject.run_dsc_apply
734
734
  end
735
+
736
+ it "should format DSC Output correct" do
737
+ allow(machine).to receive(:communicate).and_return(communicator)
738
+ allow(communicator).to receive(:shell).and_return(shell)
739
+
740
+ root_config.configuration_file = configuration_file
741
+ expect(ui).not_to receive(:info).with(/\r\n/, any_args)
742
+ expect(ui).not_to receive(:info).with(/^\n/, any_args)
743
+ expect(ui).not_to receive(:info).with(/\n$/, any_args)
744
+ expect(shell).to receive(:powershell)
745
+ .and_yield(:stout, "PSModulePath Configured: C:\\Users\\vagrant\\Documents\\WindowsPowerShell\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules")
746
+ .and_yield(:stout, "\r\nRunning Configuration file: C:\\tmp\\vagrant-dsc-3\\manifests\\Reboot.ps1\r\n")
747
+ .and_yield(:stout, "\r\n Directory: C:\\tmp\\vagrant-dsc-3\\staging\r\n\r\n\r\nMode LastWriteTime Length Name \r\n---- ------------- ------ ---- \r\n-a---- 10/17/2016 7:09 AM 3420 localhost.mof \r\n")
748
+ .and_yield(:stout, "VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = \r\nSendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = \r\nroot/Microsoft/Windows/DesiredStateConfiguration'.")
749
+ .and_yield(:stout, "VERBOSE: An LCM method call arrived from computer WIN-QRTPA0OO7EK with user sid \r\nS-1-5-21-678342207-3002680417-1007590926-1000.\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ Start Set ]\n")
750
+ .and_yield(:stout, "VERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ Start Resource ] [[Script]Reboot]")
751
+ .and_yield(:stout, "\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ Start Test ] [[Script]Reboot]\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ End Test ] [[Script]Reboot] in 0.0000 seconds.\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ Skip Set ] [[Script]Reboot]\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ End Resource ] [[Script]Reboot]\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ Start Resource ] [[Script]Error]\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ Start Test ] [[Script]Error]\nVERBOSE: [WIN-QRTPA0OO7EK]: LCM: [ End Test ] [[Script]Error] in 0.0000 seconds.\n")
752
+ .and_yield(:stderr, "PowerShell DSC resource MSFT_ScriptResource failed to execute Test-TargetResource functionality with error message: \r\n")
753
+ .and_yield(:stderr, "\nVERBOSE: Operation 'Invoke CimMethod' complete.\nVERBOSE: Time taken for configuration job to complete is 0.198 seconds\n\r\n\r\n")
754
+
755
+ subject.run_dsc_apply
756
+ end
735
757
  end
736
758
  end
data/spec/spec_helper.rb CHANGED
@@ -6,10 +6,10 @@ require 'vagrant-dsc/plugin'
6
6
  require 'rspec/its'
7
7
  require 'base'
8
8
 
9
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
9
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
10
10
  SimpleCov::Formatter::HTMLFormatter,
11
11
  Coveralls::SimpleCov::Formatter
12
- ]
12
+ ])
13
13
 
14
14
  SimpleCov.start do
15
15
  coverage_dir('tmp/coverage')
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.1
4
+ version: 1.1.2
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-19 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake