chef 12.21.10-universal-mingw32 → 12.21.12-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/chef/util/dsc/local_configuration_manager.rb +17 -7
- data/lib/chef/version.rb +1 -1
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +60 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51d5d3c4ee24daa9e4c7b3724365abeaed6819ed
|
4
|
+
data.tar.gz: 73274ba7a430f3164a100801c0bbc2ef47cc1b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c66db182d5932a1cd93d8cb853b836570cd366b548a32f9f7ee84a3425b97298677751469c724e59c42d965bc5ed00e5d8ff651bc6af1cc7d316a6bbb70780df
|
7
|
+
data.tar.gz: 4f433acd72fbd8eaf5ddd2e0211e1939f6f4de53a56c9432884a6015092db7645169e84bb36ee94fc93e2aac31d76ad5b4a09d50c09d8432de4621333dfd75af
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
12.21.
|
1
|
+
12.21.12
|
@@ -47,15 +47,13 @@ class Chef::Util::DSC
|
|
47
47
|
|
48
48
|
def run_configuration_cmdlet(configuration_document, apply_configuration, shellout_flags)
|
49
49
|
Chef::Log.debug("DSC: Calling DSC Local Config Manager to #{apply_configuration ? "set" : "test"} configuration document.")
|
50
|
-
test_only_parameters = ! apply_configuration ? "-whatif; if (! $?) { exit 1 }" : ""
|
51
50
|
|
52
51
|
start_operation_timing
|
53
|
-
command_code = lcm_command_code(@configuration_path, test_only_parameters)
|
54
52
|
status = nil
|
55
53
|
|
56
54
|
begin
|
57
55
|
save_configuration_document(configuration_document)
|
58
|
-
cmdlet = ::Chef::Util::Powershell::Cmdlet.new(@node,
|
56
|
+
cmdlet = ::Chef::Util::Powershell::Cmdlet.new(@node, lcm_command(apply_configuration))
|
59
57
|
if apply_configuration
|
60
58
|
status = cmdlet.run!({}, shellout_flags)
|
61
59
|
else
|
@@ -72,10 +70,22 @@ class Chef::Util::DSC
|
|
72
70
|
status
|
73
71
|
end
|
74
72
|
|
75
|
-
def
|
76
|
-
|
77
|
-
|
78
|
-
|
73
|
+
def lcm_command(apply_configuration)
|
74
|
+
common_command_prefix = "$ProgressPreference = 'SilentlyContinue';"
|
75
|
+
ps4_base_command = "#{common_command_prefix} Start-DscConfiguration -path #{@configuration_path} -wait -erroraction 'stop' -force"
|
76
|
+
if apply_configuration
|
77
|
+
ps4_base_command
|
78
|
+
else
|
79
|
+
if ps_version_gte_5?
|
80
|
+
"#{common_command_prefix} Test-DscConfiguration -path #{@configuration_path}"
|
81
|
+
else
|
82
|
+
ps4_base_command + " -whatif; if (! $?) { exit 1 }"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def ps_version_gte_5?
|
88
|
+
Chef::Platform.supported_powershell_version?(@node, 5)
|
79
89
|
end
|
80
90
|
|
81
91
|
def log_what_if_exception(what_if_exception_output)
|
data/lib/chef/version.rb
CHANGED
@@ -63,7 +63,7 @@ EOH
|
|
63
63
|
let(:lcm_standard_error) { nil }
|
64
64
|
let(:lcm_cmdlet_success) { true }
|
65
65
|
|
66
|
-
it "
|
66
|
+
it "successfully returns resource information for normally formatted output when cmdlet the cmdlet succeeds" do
|
67
67
|
test_configuration_result = lcm.test_configuration("config", {})
|
68
68
|
expect(test_configuration_result.class).to be(Array)
|
69
69
|
expect(test_configuration_result.length).to be > 0
|
@@ -71,6 +71,58 @@ EOH
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
context "when running on PowerShell version 5" do
|
75
|
+
let(:lcm_standard_output) { normal_lcm_output }
|
76
|
+
let(:lcm_standard_error) { nil }
|
77
|
+
let(:lcm_cmdlet_success) { true }
|
78
|
+
|
79
|
+
it "successfully returns resource information for normally formatted output when cmdlet the cmdlet succeeds" do
|
80
|
+
allow(lcm).to receive(:ps_version_gte_5?).and_return(true)
|
81
|
+
test_configuration_result = lcm.test_configuration("config", {})
|
82
|
+
expect(test_configuration_result.class).to be(Array)
|
83
|
+
expect(test_configuration_result.length).to be > 0
|
84
|
+
expect(Chef::Log).not_to receive(:warn)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "when running on PowerShell version less than 5" do
|
89
|
+
let(:lcm_standard_output) { normal_lcm_output }
|
90
|
+
let(:lcm_standard_error) { nil }
|
91
|
+
let(:lcm_cmdlet_success) { true }
|
92
|
+
|
93
|
+
it "successfully returns resource information for normally formatted output when cmdlet the cmdlet succeeds" do
|
94
|
+
allow(lcm).to receive(:ps_version_gte_5?).and_return(false)
|
95
|
+
test_configuration_result = lcm.test_configuration("config", {})
|
96
|
+
expect(test_configuration_result.class).to be(Array)
|
97
|
+
expect(test_configuration_result.length).to be > 0
|
98
|
+
expect(Chef::Log).not_to receive(:warn)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "#lcm_command" do
|
103
|
+
let(:common_command_prefix) { "$ProgressPreference = 'SilentlyContinue';" }
|
104
|
+
let(:ps4_base_command) { "#{common_command_prefix} Start-DscConfiguration -path tmp -wait -erroraction 'stop' -force" }
|
105
|
+
let(:lcm_command_ps4) { ps4_base_command + " -whatif; if (! $?) { exit 1 }" }
|
106
|
+
let(:lcm_command_ps5) { "#{common_command_prefix} Test-DscConfiguration -path tmp" }
|
107
|
+
let(:lcm_standard_output) { normal_lcm_output }
|
108
|
+
let(:lcm_standard_error) { nil }
|
109
|
+
let(:lcm_cmdlet_success) { true }
|
110
|
+
|
111
|
+
it "successfully returns command when apply_configuration true" do
|
112
|
+
expect(lcm.send(:lcm_command, true)).to eq(ps4_base_command)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "successfully returns command when PowerShell version 4" do
|
116
|
+
allow(lcm).to receive(:ps_version_gte_5?).and_return(false)
|
117
|
+
expect(lcm.send(:lcm_command, false)).to eq(lcm_command_ps4)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "successfully returns command when PowerShell version 5" do
|
121
|
+
allow(lcm).to receive(:ps_version_gte_5?).and_return(true)
|
122
|
+
expect(lcm.send(:lcm_command, false)).to eq(lcm_command_ps5)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
74
126
|
context "that fails due to missing what-if switch in DSC resource cmdlet implementation" do
|
75
127
|
let(:lcm_standard_output) { "" }
|
76
128
|
let(:lcm_standard_error) { no_whatif_lcm_output }
|
@@ -80,7 +132,7 @@ EOH
|
|
80
132
|
expect(lcm.send(:whatif_not_supported?, no_whatif_lcm_output)).to be_truthy
|
81
133
|
end
|
82
134
|
|
83
|
-
it "
|
135
|
+
it "returns a (possibly empty) array of ResourceInfo instances" do
|
84
136
|
expect(Chef::Log).to receive(:warn).at_least(:once)
|
85
137
|
expect(lcm).to receive(:whatif_not_supported?).and_call_original
|
86
138
|
test_configuration_result = nil
|
@@ -94,14 +146,14 @@ EOH
|
|
94
146
|
let(:lcm_standard_error) { dsc_resource_import_failure_output }
|
95
147
|
let(:lcm_cmdlet_success) { false }
|
96
148
|
|
97
|
-
it "
|
149
|
+
it "logs a warning if the message is formatted as expected when a resource import failure occurs" do
|
98
150
|
expect(Chef::Log).to receive(:warn).at_least(:once)
|
99
151
|
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
|
100
152
|
test_configuration_result = nil
|
101
153
|
expect { test_configuration_result = lcm.test_configuration("config", {}) }.not_to raise_error
|
102
154
|
end
|
103
155
|
|
104
|
-
it "
|
156
|
+
it "returns a (possibly empty) array of ResourceInfo instances" do
|
105
157
|
expect(Chef::Log).to receive(:warn).at_least(:once)
|
106
158
|
test_configuration_result = nil
|
107
159
|
expect { test_configuration_result = lcm.test_configuration("config", {}) }.not_to raise_error
|
@@ -114,7 +166,7 @@ EOH
|
|
114
166
|
let(:lcm_standard_error) { "Abort, Retry, Fail?" }
|
115
167
|
let(:lcm_cmdlet_success) { false }
|
116
168
|
|
117
|
-
it "
|
169
|
+
it "logs a warning" do
|
118
170
|
expect(Chef::Log).to receive(:warn).at_least(:once)
|
119
171
|
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
|
120
172
|
expect { lcm.test_configuration("config", {}) }.not_to raise_error
|
@@ -122,15 +174,15 @@ EOH
|
|
122
174
|
end
|
123
175
|
end
|
124
176
|
|
125
|
-
it "
|
177
|
+
it "identify a correctly formatted error message as a resource import failure" do
|
126
178
|
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output)).to be(true)
|
127
179
|
end
|
128
180
|
|
129
|
-
it "
|
181
|
+
it "does not identify an incorrectly formatted error message as a resource import failure" do
|
130
182
|
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("module", "gibberish"))).to be(false)
|
131
183
|
end
|
132
184
|
|
133
|
-
it "
|
185
|
+
it "does not identify a message without a CimException reference as a resource import failure" do
|
134
186
|
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("CimException", "ArgumentException"))).to be(false)
|
135
187
|
end
|
136
188
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.21.
|
4
|
+
version: 12.21.12
|
5
5
|
platform: universal-mingw32
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 12.21.
|
19
|
+
version: 12.21.12
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 12.21.
|
26
|
+
version: 12.21.12
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixlib-cli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|