knife-windows 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +26 -26
- data/CHANGELOG.md +131 -121
- data/DOC_CHANGES.md +22 -14
- data/Gemfile +14 -13
- data/README.md +400 -392
- data/RELEASE_NOTES.md +2 -26
- data/appveyor.yml +39 -39
- data/ci.gemfile +16 -16
- data/knife-windows.gemspec +25 -25
- data/lib/chef/knife/bootstrap/windows-chef-client-msi.erb +246 -233
- data/lib/chef/knife/bootstrap_windows_base.rb +443 -454
- data/lib/chef/knife/bootstrap_windows_ssh.rb +116 -115
- data/lib/chef/knife/bootstrap_windows_winrm.rb +102 -95
- data/lib/chef/knife/core/windows_bootstrap_context.rb +378 -378
- data/lib/chef/knife/knife_windows_base.rb +33 -33
- data/lib/chef/knife/windows_cert_generate.rb +155 -155
- data/lib/chef/knife/windows_cert_install.rb +68 -68
- data/lib/chef/knife/windows_helper.rb +36 -36
- data/lib/chef/knife/windows_listener_create.rb +107 -107
- data/lib/chef/knife/winrm.rb +122 -122
- data/lib/chef/knife/winrm_base.rb +123 -117
- data/lib/chef/knife/winrm_knife_base.rb +306 -305
- data/lib/chef/knife/winrm_session.rb +97 -91
- data/lib/chef/knife/winrm_shared_options.rb +47 -47
- data/lib/chef/knife/wsman_endpoint.rb +44 -44
- data/lib/chef/knife/wsman_test.rb +118 -118
- data/lib/knife-windows/path_helper.rb +234 -234
- data/lib/knife-windows/version.rb +6 -6
- data/spec/assets/win_template_rendered_with_bootstrap_install_command.txt +223 -223
- data/spec/assets/win_template_rendered_with_bootstrap_install_command_on_12_5_client.txt +223 -223
- data/spec/assets/win_template_rendered_without_bootstrap_install_command.txt +335 -335
- data/spec/assets/win_template_rendered_without_bootstrap_install_command_on_12_5_client.txt +335 -335
- data/spec/dummy_winrm_connection.rb +21 -0
- data/spec/functional/bootstrap_download_spec.rb +236 -241
- data/spec/spec_helper.rb +94 -94
- data/spec/unit/knife/bootstrap_options_spec.rb +157 -155
- data/spec/unit/knife/bootstrap_template_spec.rb +98 -98
- data/spec/unit/knife/bootstrap_windows_winrm_spec.rb +423 -426
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +177 -177
- data/spec/unit/knife/windows_cert_generate_spec.rb +90 -90
- data/spec/unit/knife/windows_cert_install_spec.rb +51 -51
- data/spec/unit/knife/windows_listener_create_spec.rb +76 -76
- data/spec/unit/knife/winrm_session_spec.rb +71 -76
- data/spec/unit/knife/winrm_spec.rb +500 -508
- data/spec/unit/knife/wsman_test_spec.rb +209 -209
- metadata +16 -17
- data/spec/dummy_winrm_service.rb +0 -24
@@ -1,209 +1,209 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Steven Murawski (<smurawski@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require 'spec_helper'
|
20
|
-
|
21
|
-
describe Chef::Knife::WsmanTest do
|
22
|
-
let(:http_client_mock) { HTTPClient.new }
|
23
|
-
let(:ssl_policy) { double('DefaultSSLPolicy', :set_custom_certs => nil) }
|
24
|
-
|
25
|
-
before(:all) do
|
26
|
-
Chef::Config.reset
|
27
|
-
end
|
28
|
-
|
29
|
-
before(:each) do
|
30
|
-
response_body = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header/><s:Body><wsmid:IdentifyResponse xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"><wsmid:ProtocolVersion>http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd</wsmid:ProtocolVersion><wsmid:ProductVendor>Microsoft Corporation</wsmid:ProductVendor><wsmid:ProductVersion>OS: 0.0.0 SP: 0.0 Stack: 2.0</wsmid:ProductVersion></wsmid:IdentifyResponse></s:Body></s:Envelope>'
|
31
|
-
http_response_mock = HTTP::Message.new_response(response_body)
|
32
|
-
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
33
|
-
allow(HTTPClient).to receive(:new).and_return(http_client_mock)
|
34
|
-
subject.config[:verbosity] = 0
|
35
|
-
allow(subject.ui).to receive(:ask).and_return('prompted_password')
|
36
|
-
allow(Chef::HTTP::DefaultSSLPolicy).to receive(:new)
|
37
|
-
.with(http_client_mock.ssl_config)
|
38
|
-
.and_return(ssl_policy)
|
39
|
-
end
|
40
|
-
|
41
|
-
subject { Chef::Knife::WsmanTest.new(['-m', 'localhost']) }
|
42
|
-
|
43
|
-
it 'sets the ssl policy' do
|
44
|
-
expect(ssl_policy).to receive(:set_custom_certs).twice
|
45
|
-
subject.run
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'when testing the WSMAN endpoint' do
|
49
|
-
context 'and the service responds' do
|
50
|
-
context 'successfully' do
|
51
|
-
it 'writes a message about a successful connection' do
|
52
|
-
expect(subject.ui).to receive(:msg)
|
53
|
-
subject.run
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'with an invalid body' do
|
58
|
-
it 'warns for a failed connection and exit with a status of 1' do
|
59
|
-
response_body = 'I am invalid'
|
60
|
-
http_response_mock = HTTP::Message.new_response(response_body)
|
61
|
-
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
62
|
-
expect(subject.ui).to receive(:warn)
|
63
|
-
expect(subject.ui).to receive(:error)
|
64
|
-
expect(subject).to receive(:exit).with(1)
|
65
|
-
subject.run
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'with a non-200 code' do
|
70
|
-
it 'warns for a failed connection and exits with a status of 1' do
|
71
|
-
http_response_mock = HTTP::Message.new_response('<resp></resp>')
|
72
|
-
http_response_mock.status = 404
|
73
|
-
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
74
|
-
expect(subject.ui).to receive(:warn)
|
75
|
-
expect(subject.ui).to receive(:error)
|
76
|
-
expect(subject).to receive(:exit).with(1)
|
77
|
-
subject.run
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'and the service does not respond' do
|
83
|
-
error_message = 'A connection attempt failed because the connected party did not properly respond after a period of time.'
|
84
|
-
|
85
|
-
before(:each) do
|
86
|
-
allow(http_client_mock).to receive(:post).and_raise(Exception.new(error_message))
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'exits with a status code of 1' do
|
90
|
-
expect(subject).to receive(:exit).with(1)
|
91
|
-
subject.run
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'writes a warning message for each node it fails to connect to' do
|
95
|
-
expect(subject.ui).to receive(:warn)
|
96
|
-
expect(subject).to receive(:exit).with(1)
|
97
|
-
subject.run
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'writes an error message if it fails to connect to any nodes' do
|
101
|
-
expect(subject.ui).to receive(:error)
|
102
|
-
expect(subject).to receive(:exit).with(1)
|
103
|
-
subject.run
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'when not validating ssl cert' do
|
109
|
-
before(:each) do
|
110
|
-
expect(subject.ui).to receive(:msg)
|
111
|
-
subject.config[:winrm_ssl_verify_mode] = :verify_none
|
112
|
-
subject.config[:winrm_transport] = :ssl
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'sets verify_mode to verify_none' do
|
116
|
-
subject.run
|
117
|
-
expect(http_client_mock.ssl_config.verify_mode).to eq(OpenSSL::SSL::VERIFY_NONE)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context 'when testing the WSMAN endpoint with verbose output' do
|
122
|
-
before(:each) do
|
123
|
-
subject.config[:verbosity] = 1
|
124
|
-
end
|
125
|
-
|
126
|
-
context 'and the service does not respond' do
|
127
|
-
it 'returns an object with an error message' do
|
128
|
-
error_message = 'A connection attempt failed because the connected party did not properly respond after a period of time.'
|
129
|
-
allow(http_client_mock).to receive(:post).and_raise(Exception.new(error_message))
|
130
|
-
expect(subject).to receive(:exit).with(1)
|
131
|
-
expect(subject).to receive(:output) do |output|
|
132
|
-
expect(output.error_message).to match(/#{error_message}/)
|
133
|
-
end
|
134
|
-
subject.run
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
context 'with an invalid body' do
|
139
|
-
it 'includes invalid body in error message' do
|
140
|
-
response_body = 'I am invalid'
|
141
|
-
http_response_mock = HTTP::Message.new_response(response_body)
|
142
|
-
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
143
|
-
expect(subject).to receive(:exit).with(1)
|
144
|
-
expect(subject).to receive(:output) do |output|
|
145
|
-
expect(output.error_message).to match(/#{response_body}/)
|
146
|
-
end
|
147
|
-
subject.run
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
context 'and the target node is Windows Server 2008 R2' do
|
152
|
-
before(:each) do
|
153
|
-
ws2008r2_response_body = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header/><s:Body><wsmid:IdentifyResponse xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"><wsmid:ProtocolVersion>http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd</wsmid:ProtocolVersion><wsmid:ProductVendor>Microsoft Corporation</wsmid:ProductVendor><wsmid:ProductVersion>OS: 0.0.0 SP: 0.0 Stack: 2.0</wsmid:ProductVersion></wsmid:IdentifyResponse></s:Body></s:Envelope>'
|
154
|
-
http_response_mock = HTTP::Message.new_response(ws2008r2_response_body)
|
155
|
-
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'identifies the stack of the product version as 2.0 ' do
|
159
|
-
expect(subject).to receive(:output) do |output|
|
160
|
-
expect(output.product_version).to eq 'OS: 0.0.0 SP: 0.0 Stack: 2.0'
|
161
|
-
end
|
162
|
-
subject.run
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'identifies the protocol version as the current DMTF standard' do
|
166
|
-
expect(subject).to receive(:output) do |output|
|
167
|
-
expect(output.protocol_version).to eq 'http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'
|
168
|
-
end
|
169
|
-
subject.run
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'identifies the vendor as the Microsoft Corporation' do
|
173
|
-
expect(subject).to receive(:output) do |output|
|
174
|
-
expect(output.product_vendor).to eq 'Microsoft Corporation'
|
175
|
-
end
|
176
|
-
subject.run
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context 'and the target node is Windows Server 2012 R2' do
|
181
|
-
before(:each) do
|
182
|
-
ws2012_response_body = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header/><s:Body><wsmid:IdentifyResponse xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"><wsmid:ProtocolVersion>http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd</wsmid:ProtocolVersion><wsmid:ProductVendor>Microsoft Corporation</wsmid:ProductVendor><wsmid:ProductVersion>OS: 0.0.0 SP: 0.0 Stack: 3.0</wsmid:ProductVersion></wsmid:IdentifyResponse></s:Body></s:Envelope>'
|
183
|
-
http_response_mock = HTTP::Message.new_response(ws2012_response_body)
|
184
|
-
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
185
|
-
end
|
186
|
-
|
187
|
-
it 'identifies the stack of the product version as 3.0 ' do
|
188
|
-
expect(subject).to receive(:output) do |output|
|
189
|
-
expect(output.product_version).to eq 'OS: 0.0.0 SP: 0.0 Stack: 3.0'
|
190
|
-
end
|
191
|
-
subject.run
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'identifies the protocol version as the current DMTF standard' do
|
195
|
-
expect(subject).to receive(:output) do |output|
|
196
|
-
expect(output.protocol_version).to eq 'http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'
|
197
|
-
end
|
198
|
-
subject.run
|
199
|
-
end
|
200
|
-
|
201
|
-
it 'identifies the vendor as the Microsoft Corporation' do
|
202
|
-
expect(subject).to receive(:output) do |output|
|
203
|
-
expect(output.product_vendor).to eq 'Microsoft Corporation'
|
204
|
-
end
|
205
|
-
subject.run
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
1
|
+
#
|
2
|
+
# Author:: Steven Murawski (<smurawski@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'spec_helper'
|
20
|
+
|
21
|
+
describe Chef::Knife::WsmanTest do
|
22
|
+
let(:http_client_mock) { HTTPClient.new }
|
23
|
+
let(:ssl_policy) { double('DefaultSSLPolicy', :set_custom_certs => nil) }
|
24
|
+
|
25
|
+
before(:all) do
|
26
|
+
Chef::Config.reset
|
27
|
+
end
|
28
|
+
|
29
|
+
before(:each) do
|
30
|
+
response_body = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header/><s:Body><wsmid:IdentifyResponse xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"><wsmid:ProtocolVersion>http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd</wsmid:ProtocolVersion><wsmid:ProductVendor>Microsoft Corporation</wsmid:ProductVendor><wsmid:ProductVersion>OS: 0.0.0 SP: 0.0 Stack: 2.0</wsmid:ProductVersion></wsmid:IdentifyResponse></s:Body></s:Envelope>'
|
31
|
+
http_response_mock = HTTP::Message.new_response(response_body)
|
32
|
+
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
33
|
+
allow(HTTPClient).to receive(:new).and_return(http_client_mock)
|
34
|
+
subject.config[:verbosity] = 0
|
35
|
+
allow(subject.ui).to receive(:ask).and_return('prompted_password')
|
36
|
+
allow(Chef::HTTP::DefaultSSLPolicy).to receive(:new)
|
37
|
+
.with(http_client_mock.ssl_config)
|
38
|
+
.and_return(ssl_policy)
|
39
|
+
end
|
40
|
+
|
41
|
+
subject { Chef::Knife::WsmanTest.new(['-m', 'localhost']) }
|
42
|
+
|
43
|
+
it 'sets the ssl policy' do
|
44
|
+
expect(ssl_policy).to receive(:set_custom_certs).twice
|
45
|
+
subject.run
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when testing the WSMAN endpoint' do
|
49
|
+
context 'and the service responds' do
|
50
|
+
context 'successfully' do
|
51
|
+
it 'writes a message about a successful connection' do
|
52
|
+
expect(subject.ui).to receive(:msg)
|
53
|
+
subject.run
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'with an invalid body' do
|
58
|
+
it 'warns for a failed connection and exit with a status of 1' do
|
59
|
+
response_body = 'I am invalid'
|
60
|
+
http_response_mock = HTTP::Message.new_response(response_body)
|
61
|
+
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
62
|
+
expect(subject.ui).to receive(:warn)
|
63
|
+
expect(subject.ui).to receive(:error)
|
64
|
+
expect(subject).to receive(:exit).with(1)
|
65
|
+
subject.run
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with a non-200 code' do
|
70
|
+
it 'warns for a failed connection and exits with a status of 1' do
|
71
|
+
http_response_mock = HTTP::Message.new_response('<resp></resp>')
|
72
|
+
http_response_mock.status = 404
|
73
|
+
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
74
|
+
expect(subject.ui).to receive(:warn)
|
75
|
+
expect(subject.ui).to receive(:error)
|
76
|
+
expect(subject).to receive(:exit).with(1)
|
77
|
+
subject.run
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'and the service does not respond' do
|
83
|
+
error_message = 'A connection attempt failed because the connected party did not properly respond after a period of time.'
|
84
|
+
|
85
|
+
before(:each) do
|
86
|
+
allow(http_client_mock).to receive(:post).and_raise(Exception.new(error_message))
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'exits with a status code of 1' do
|
90
|
+
expect(subject).to receive(:exit).with(1)
|
91
|
+
subject.run
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'writes a warning message for each node it fails to connect to' do
|
95
|
+
expect(subject.ui).to receive(:warn)
|
96
|
+
expect(subject).to receive(:exit).with(1)
|
97
|
+
subject.run
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'writes an error message if it fails to connect to any nodes' do
|
101
|
+
expect(subject.ui).to receive(:error)
|
102
|
+
expect(subject).to receive(:exit).with(1)
|
103
|
+
subject.run
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'when not validating ssl cert' do
|
109
|
+
before(:each) do
|
110
|
+
expect(subject.ui).to receive(:msg)
|
111
|
+
subject.config[:winrm_ssl_verify_mode] = :verify_none
|
112
|
+
subject.config[:winrm_transport] = :ssl
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'sets verify_mode to verify_none' do
|
116
|
+
subject.run
|
117
|
+
expect(http_client_mock.ssl_config.verify_mode).to eq(OpenSSL::SSL::VERIFY_NONE)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'when testing the WSMAN endpoint with verbose output' do
|
122
|
+
before(:each) do
|
123
|
+
subject.config[:verbosity] = 1
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'and the service does not respond' do
|
127
|
+
it 'returns an object with an error message' do
|
128
|
+
error_message = 'A connection attempt failed because the connected party did not properly respond after a period of time.'
|
129
|
+
allow(http_client_mock).to receive(:post).and_raise(Exception.new(error_message))
|
130
|
+
expect(subject).to receive(:exit).with(1)
|
131
|
+
expect(subject).to receive(:output) do |output|
|
132
|
+
expect(output.error_message).to match(/#{error_message}/)
|
133
|
+
end
|
134
|
+
subject.run
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context 'with an invalid body' do
|
139
|
+
it 'includes invalid body in error message' do
|
140
|
+
response_body = 'I am invalid'
|
141
|
+
http_response_mock = HTTP::Message.new_response(response_body)
|
142
|
+
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
143
|
+
expect(subject).to receive(:exit).with(1)
|
144
|
+
expect(subject).to receive(:output) do |output|
|
145
|
+
expect(output.error_message).to match(/#{response_body}/)
|
146
|
+
end
|
147
|
+
subject.run
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'and the target node is Windows Server 2008 R2' do
|
152
|
+
before(:each) do
|
153
|
+
ws2008r2_response_body = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header/><s:Body><wsmid:IdentifyResponse xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"><wsmid:ProtocolVersion>http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd</wsmid:ProtocolVersion><wsmid:ProductVendor>Microsoft Corporation</wsmid:ProductVendor><wsmid:ProductVersion>OS: 0.0.0 SP: 0.0 Stack: 2.0</wsmid:ProductVersion></wsmid:IdentifyResponse></s:Body></s:Envelope>'
|
154
|
+
http_response_mock = HTTP::Message.new_response(ws2008r2_response_body)
|
155
|
+
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'identifies the stack of the product version as 2.0 ' do
|
159
|
+
expect(subject).to receive(:output) do |output|
|
160
|
+
expect(output.product_version).to eq 'OS: 0.0.0 SP: 0.0 Stack: 2.0'
|
161
|
+
end
|
162
|
+
subject.run
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'identifies the protocol version as the current DMTF standard' do
|
166
|
+
expect(subject).to receive(:output) do |output|
|
167
|
+
expect(output.protocol_version).to eq 'http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'
|
168
|
+
end
|
169
|
+
subject.run
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'identifies the vendor as the Microsoft Corporation' do
|
173
|
+
expect(subject).to receive(:output) do |output|
|
174
|
+
expect(output.product_vendor).to eq 'Microsoft Corporation'
|
175
|
+
end
|
176
|
+
subject.run
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'and the target node is Windows Server 2012 R2' do
|
181
|
+
before(:each) do
|
182
|
+
ws2012_response_body = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header/><s:Body><wsmid:IdentifyResponse xmlns:wsmid="http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"><wsmid:ProtocolVersion>http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd</wsmid:ProtocolVersion><wsmid:ProductVendor>Microsoft Corporation</wsmid:ProductVendor><wsmid:ProductVersion>OS: 0.0.0 SP: 0.0 Stack: 3.0</wsmid:ProductVersion></wsmid:IdentifyResponse></s:Body></s:Envelope>'
|
183
|
+
http_response_mock = HTTP::Message.new_response(ws2012_response_body)
|
184
|
+
allow(http_client_mock).to receive(:post).and_return(http_response_mock)
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'identifies the stack of the product version as 3.0 ' do
|
188
|
+
expect(subject).to receive(:output) do |output|
|
189
|
+
expect(output.product_version).to eq 'OS: 0.0.0 SP: 0.0 Stack: 3.0'
|
190
|
+
end
|
191
|
+
subject.run
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'identifies the protocol version as the current DMTF standard' do
|
195
|
+
expect(subject).to receive(:output) do |output|
|
196
|
+
expect(output.protocol_version).to eq 'http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd'
|
197
|
+
end
|
198
|
+
subject.run
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'identifies the vendor as the Microsoft Corporation' do
|
202
|
+
expect(subject).to receive(:output) do |output|
|
203
|
+
expect(output.product_vendor).to eq 'Microsoft Corporation'
|
204
|
+
end
|
205
|
+
subject.run
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-windows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Chisamore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: winrm
|
14
|
+
name: winrm-elevated
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.0'
|
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: '1.
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting
|
@@ -46,9 +46,9 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
50
|
-
- .rspec
|
51
|
-
- .travis.yml
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".travis.yml"
|
52
52
|
- CHANGELOG.md
|
53
53
|
- DOC_CHANGES.md
|
54
54
|
- Gemfile
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- spec/assets/win_template_rendered_without_bootstrap_install_command.txt
|
86
86
|
- spec/assets/win_template_rendered_without_bootstrap_install_command_on_12_5_client.txt
|
87
87
|
- spec/assets/win_template_unrendered.txt
|
88
|
-
- spec/
|
88
|
+
- spec/dummy_winrm_connection.rb
|
89
89
|
- spec/functional/bootstrap_download_spec.rb
|
90
90
|
- spec/spec_helper.rb
|
91
91
|
- spec/unit/knife/bootstrap_options_spec.rb
|
@@ -108,20 +108,19 @@ require_paths:
|
|
108
108
|
- lib
|
109
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- -
|
111
|
+
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: 1.9.1
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.6
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting
|
125
125
|
with nodes running Microsoft Windows
|
126
126
|
test_files: []
|
127
|
-
has_rdoc:
|