knife-winops 2.0.0 → 2.1.0
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 +5 -5
- data/lib/chef/knife/{bootstrap → winops_bootstrap}/Chef_bootstrap.erb +0 -0
- data/lib/chef/knife/{bootstrap → winops_bootstrap}/bootstrap.ps1 +0 -0
- data/lib/chef/knife/{bootstrap → winops_bootstrap}/tail.cmd +0 -0
- data/lib/chef/knife/{bootstrap/windows-chef-client-msi.erb → winops_bootstrap/windows-bootstrap-template.erb} +0 -0
- data/lib/chef/knife/{bootstrap_windows_base.rb → winops_bootstrap_windows_base.rb} +7 -7
- data/lib/chef/knife/{bootstrap_windows_ssh.rb → winops_bootstrap_windows_ssh.rb} +4 -4
- data/lib/chef/knife/{bootstrap_windows_winrm.rb → winops_bootstrap_windows_winrm.rb} +9 -9
- data/lib/chef/knife/{core → winops_core}/windows_bootstrap_context.rb +6 -6
- data/lib/chef/knife/{knife_windows_base.rb → winops_knife_windows_base.rb} +1 -1
- data/lib/chef/knife/{windows_cert_generate.rb → winops_windows_cert_generate.rb} +1 -1
- data/lib/chef/knife/{windows_cert_install.rb → winops_windows_cert_install.rb} +1 -1
- data/lib/chef/knife/{windows_helper.rb → winops_windows_helper.rb} +6 -6
- data/lib/chef/knife/{windows_listener_create.rb → winops_windows_listener_create.rb} +1 -1
- data/lib/chef/knife/{winrm.rb → winops_winrm.rb} +8 -8
- data/lib/chef/knife/{winrm_base.rb → winops_winrm_base.rb} +1 -1
- data/lib/chef/knife/{winrm_knife_base.rb → winops_winrm_knife_base.rb} +9 -9
- data/lib/chef/knife/{winrm_session.rb → winops_winrm_session.rb} +0 -0
- data/lib/chef/knife/{winrm_shared_options.rb → winops_winrm_shared_options.rb} +1 -1
- data/lib/chef/knife/{wsman_endpoint.rb → winops_wsman_endpoint.rb} +0 -0
- data/lib/chef/knife/{wsman_test.rb → winops_wsman_test.rb} +3 -3
- data/lib/knife-winops/version.rb +1 -1
- data/spec/assets/fake_trusted_certs/excluded.txt +1 -1
- data/spec/functional/bootstrap_download_spec.rb +14 -14
- data/spec/spec_helper.rb +3 -3
- data/spec/unit/knife/bootstrap_options_spec.rb +4 -4
- data/spec/unit/knife/bootstrap_template_spec.rb +3 -3
- data/spec/unit/knife/bootstrap_windows_winrm_spec.rb +2 -2
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +8 -8
- data/spec/unit/knife/windows_cert_generate_spec.rb +1 -1
- data/spec/unit/knife/windows_cert_install_spec.rb +1 -1
- data/spec/unit/knife/windows_listener_create_spec.rb +1 -1
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 81311adb8994d58d394aeacf0c1664f3208ae70cf3aaed942aa424ebf91f209b
|
4
|
+
data.tar.gz: 89e50b1242e5315c71a5443955db88e5bb63bb3c2b0a5584f018b7c87b1ee31b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2065d5f93af00dc0b68c0f9b9b32c174db7807cf8efeb2ba711e7e53ad47d6eb34f80279f1a031d04775f96fb30f24fdf8ceb3465895b5fade2bc88f572547ca
|
7
|
+
data.tar.gz: 610d84f4bb62f1702de378cafcb2dbfe6d0d8e86d6c9b0e836230d4a890c7fd99e3a192d43cc56ded3e7096a2950eae98e6eecadb6732cd21609070f974590a5
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -19,16 +19,16 @@
|
|
19
19
|
require 'chef/knife'
|
20
20
|
require 'chef/knife/bootstrap'
|
21
21
|
require 'chef/encrypted_data_bag_item'
|
22
|
-
require 'chef/knife/
|
23
|
-
require 'chef/knife/
|
22
|
+
require 'chef/knife/winops_core/windows_bootstrap_context'
|
23
|
+
require 'chef/knife/winops_knife_windows_base'
|
24
24
|
# Chef 11 PathHelper doesn't have #home
|
25
25
|
#require 'chef/util/path_helper'
|
26
26
|
|
27
27
|
class Chef
|
28
28
|
class Knife
|
29
|
-
module
|
29
|
+
module BootstrapWindowsCore
|
30
30
|
|
31
|
-
include Chef::Knife::
|
31
|
+
include Chef::Knife::KnifeWindowsCore
|
32
32
|
|
33
33
|
# :nodoc:
|
34
34
|
# Would prefer to do this in a rational way, but can't be done b/c of
|
@@ -231,7 +231,7 @@ class Chef
|
|
231
231
|
end
|
232
232
|
|
233
233
|
def default_bootstrap_template
|
234
|
-
"windows-
|
234
|
+
"windows-bootstrap-template"
|
235
235
|
end
|
236
236
|
|
237
237
|
def bootstrap_template
|
@@ -258,7 +258,7 @@ class Chef
|
|
258
258
|
bootstrap_files << File.join(File.dirname(__FILE__), 'bootstrap/templates', "#{template}.erb")
|
259
259
|
bootstrap_files << File.join(Knife.chef_config_dir, "bootstrap", "#{template}.erb") if Chef::Knife.chef_config_dir
|
260
260
|
::Knife::Windows::PathHelper.all_homes('.chef', 'bootstrap', "#{template}.erb") { |p| bootstrap_files << p }
|
261
|
-
bootstrap_files << Gem.find_files(File.join("chef","knife","
|
261
|
+
bootstrap_files << Gem.find_files(File.join("chef","knife","winops_bootstrap","#{template}.erb"))
|
262
262
|
bootstrap_files.flatten!
|
263
263
|
|
264
264
|
template = Array(bootstrap_files).find do |bootstrap_template|
|
@@ -277,7 +277,7 @@ class Chef
|
|
277
277
|
end
|
278
278
|
|
279
279
|
def bootstrap_context
|
280
|
-
@bootstrap_context ||= Knife::Core::
|
280
|
+
@bootstrap_context ||= Knife::Core::WinBootstrapContext.new(config, config[:run_list], Chef::Config)
|
281
281
|
end
|
282
282
|
|
283
283
|
def load_correct_secret
|
@@ -16,16 +16,16 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require 'chef/knife/
|
19
|
+
require 'chef/knife/winops_bootstrap_windows_base'
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Knife
|
23
|
-
class
|
23
|
+
class BootstrapWindowsSSH < Bootstrap
|
24
24
|
|
25
|
-
include Chef::Knife::
|
25
|
+
include Chef::Knife::BootstrapWindowsCore
|
26
26
|
|
27
27
|
deps do
|
28
|
-
require 'chef/knife/
|
28
|
+
require 'chef/knife/winops_core/windows_bootstrap_context'
|
29
29
|
require 'chef/json_compat'
|
30
30
|
require 'tempfile'
|
31
31
|
require 'highline'
|
@@ -16,22 +16,22 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require 'chef/knife/
|
20
|
-
require 'chef/knife/
|
21
|
-
require 'chef/knife/
|
22
|
-
require 'chef/knife/
|
19
|
+
require 'chef/knife/winops_bootstrap_windows_base'
|
20
|
+
require 'chef/knife/winops_winrm'
|
21
|
+
require 'chef/knife/winops_winrm_base'
|
22
|
+
require 'chef/knife/winops_winrm_knife_base'
|
23
23
|
|
24
24
|
|
25
25
|
class Chef
|
26
26
|
class Knife
|
27
|
-
class
|
27
|
+
class BootstrapWindowsWinRM < Bootstrap
|
28
28
|
|
29
|
-
include Chef::Knife::
|
30
|
-
include Chef::Knife::
|
31
|
-
include Chef::Knife::
|
29
|
+
include Chef::Knife::BootstrapWindowsCore
|
30
|
+
include Chef::Knife::WinrmCore
|
31
|
+
include Chef::Knife::WinrmCommandCommon
|
32
32
|
|
33
33
|
deps do
|
34
|
-
require 'chef/knife/
|
34
|
+
require 'chef/knife/winops_core/windows_bootstrap_context'
|
35
35
|
require 'chef/json_compat'
|
36
36
|
require 'tempfile'
|
37
37
|
Chef::Knife::Winrm.load_deps
|
@@ -20,7 +20,7 @@ require 'chef/knife/core/bootstrap_context'
|
|
20
20
|
# Chef::Util::PathHelper in Chef 11 is a bit juvenile still
|
21
21
|
require 'knife-winops/path_helper'
|
22
22
|
# require 'chef/util/path_helper'
|
23
|
-
require 'chef/knife/
|
23
|
+
require 'chef/knife/winops_core/windows_bootstrap_context'
|
24
24
|
|
25
25
|
class Chef
|
26
26
|
class Knife
|
@@ -31,7 +31,7 @@ class Chef
|
|
31
31
|
# * @config - a hash of knife's config values
|
32
32
|
# * @run_list - the run list for the node to boostrap
|
33
33
|
#
|
34
|
-
class
|
34
|
+
class WinBootstrapContext < BootstrapContext
|
35
35
|
PathHelper = ::Knife::Windows::PathHelper
|
36
36
|
|
37
37
|
attr_accessor :client_pem
|
@@ -224,23 +224,23 @@ filename_in_envvar
|
|
224
224
|
end
|
225
225
|
|
226
226
|
def win_cmd_tail(target_filename)
|
227
|
-
cmd_tail_file = Gem.find_files(File.join('chef', 'knife', '
|
227
|
+
cmd_tail_file = Gem.find_files(File.join('chef', 'knife', 'winops_bootstrap', 'tail.cmd')).first
|
228
228
|
cmd_tail_content = IO.read(cmd_tail_file)
|
229
229
|
win_parse_file_content(cmd_tail_content, target_filename)
|
230
230
|
end
|
231
231
|
|
232
232
|
def bootstrap_context
|
233
|
-
@bootstrap_context ||= Knife::Core::
|
233
|
+
@bootstrap_context ||= Knife::Core::WinBootstrapContext.new(@config, @config[:run_list], Chef::Config)
|
234
234
|
end
|
235
235
|
|
236
236
|
def win_ps_bootstrap(target_filename)
|
237
|
-
ps_bootstrap_file = Gem.find_files(File.join('chef', 'knife', '
|
237
|
+
ps_bootstrap_file = Gem.find_files(File.join('chef', 'knife', 'winops_bootstrap', 'bootstrap.ps1')).first
|
238
238
|
ps_bootstrap_content = IO.read(ps_bootstrap_file)
|
239
239
|
win_parse_file_content(ps_bootstrap_content, target_filename)
|
240
240
|
end
|
241
241
|
|
242
242
|
def win_schedtask_xml(target_filename)
|
243
|
-
sched_xml_file = Gem.find_files(File.join('chef', 'knife', '
|
243
|
+
sched_xml_file = Gem.find_files(File.join('chef', 'knife', 'winops_bootstrap', 'Chef_bootstrap.erb')).first
|
244
244
|
sched_xml_file_content = IO.read(sched_xml_file).chomp
|
245
245
|
win_parse_file_content(Erubis::Eruby.new(sched_xml_file_content).evaluate(bootstrap_context), target_filename)
|
246
246
|
end
|
@@ -17,17 +17,17 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'chef/knife'
|
20
|
-
require 'chef/knife/
|
21
|
-
require 'chef/knife/
|
22
|
-
require 'chef/knife/
|
23
|
-
require 'chef/knife/
|
20
|
+
require 'chef/knife/winops_winrm'
|
21
|
+
require 'chef/knife/winops_bootstrap_windows_ssh'
|
22
|
+
require 'chef/knife/winops_bootstrap_windows_winrm'
|
23
|
+
require 'chef/knife/winops_wsman_test'
|
24
24
|
|
25
25
|
class Chef
|
26
26
|
class Knife
|
27
27
|
class WindowsHelper < Knife
|
28
28
|
|
29
|
-
banner "#{
|
30
|
-
"#{
|
29
|
+
banner "#{BootstrapWindowsWinRM.banner}\n" +
|
30
|
+
"#{BootstrapWindowsSSH.banner}\n" +
|
31
31
|
"#{Winrm.banner}\n" +
|
32
32
|
"#{WsmanTest.banner}"
|
33
33
|
end
|
@@ -17,19 +17,19 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'chef/knife'
|
20
|
-
require 'chef/knife/
|
21
|
-
require 'chef/knife/
|
22
|
-
require 'chef/knife/
|
23
|
-
require 'chef/knife/
|
24
|
-
require 'chef/knife/
|
25
|
-
require 'chef/knife/
|
20
|
+
require 'chef/knife/winops_winrm_knife_base'
|
21
|
+
require 'chef/knife/winops_windows_cert_generate'
|
22
|
+
require 'chef/knife/winops_windows_cert_install'
|
23
|
+
require 'chef/knife/winops_windows_listener_create'
|
24
|
+
require 'chef/knife/winops_winrm_session'
|
25
|
+
require 'chef/knife/winops_knife_windows_base'
|
26
26
|
|
27
27
|
class Chef
|
28
28
|
class Knife
|
29
29
|
class Winrm < Knife
|
30
30
|
|
31
|
-
include Chef::Knife::
|
32
|
-
include Chef::Knife::
|
31
|
+
include Chef::Knife::WinrmCommandCommon
|
32
|
+
include Chef::Knife::KnifeWindowsCore
|
33
33
|
|
34
34
|
deps do
|
35
35
|
require 'readline'
|
@@ -18,13 +18,13 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
require 'chef/knife'
|
21
|
-
require 'chef/knife/
|
22
|
-
require 'chef/knife/
|
23
|
-
require 'chef/knife/
|
21
|
+
require 'chef/knife/winops_winrm_base'
|
22
|
+
require 'chef/knife/winops_winrm_shared_options'
|
23
|
+
require 'chef/knife/winops_knife_windows_base'
|
24
24
|
|
25
25
|
class Chef
|
26
26
|
class Knife
|
27
|
-
module
|
27
|
+
module WinrmCommandCommon
|
28
28
|
|
29
29
|
FAILED_BASIC_HINT ||= "Hint: Please check winrm configuration 'winrm get winrm/config/service' AllowUnencrypted flag on remote server."
|
30
30
|
FAILED_NOT_BASIC_HINT ||= <<-eos.gsub /^\s+/, ""
|
@@ -38,16 +38,16 @@ class Chef
|
|
38
38
|
|
39
39
|
@@ssl_warning_given = false
|
40
40
|
|
41
|
-
include Chef::Knife::
|
42
|
-
include Chef::Knife::
|
43
|
-
include Chef::Knife::
|
41
|
+
include Chef::Knife::WinrmCore
|
42
|
+
include Chef::Knife::WinrmOptions
|
43
|
+
include Chef::Knife::KnifeWindowsCore
|
44
44
|
|
45
45
|
def validate_winrm_options!
|
46
46
|
winrm_auth_protocol = locate_config_value(:winrm_authentication_protocol)
|
47
47
|
|
48
|
-
if ! Chef::Knife::
|
48
|
+
if ! Chef::Knife::WinrmCore::WINRM_AUTH_PROTOCOL_LIST.include?(winrm_auth_protocol)
|
49
49
|
ui.error "Invalid value '#{winrm_auth_protocol}' for --winrm-authentication-protocol option."
|
50
|
-
ui.info "Valid values are #{Chef::Knife::
|
50
|
+
ui.info "Valid values are #{Chef::Knife::WinrmCore::WINRM_AUTH_PROTOCOL_LIST.join(",")}."
|
51
51
|
exit 1
|
52
52
|
end
|
53
53
|
|
File without changes
|
File without changes
|
@@ -18,14 +18,14 @@
|
|
18
18
|
|
19
19
|
require 'httpclient'
|
20
20
|
require 'chef/knife'
|
21
|
-
require 'chef/knife/
|
22
|
-
require 'chef/knife/
|
21
|
+
require 'chef/knife/winops_winrm_knife_base'
|
22
|
+
require 'chef/knife/winops_wsman_endpoint'
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Knife
|
26
26
|
class WsmanTest < Knife
|
27
27
|
|
28
|
-
include Chef::Knife::
|
28
|
+
include Chef::Knife::WinrmCommandCommon
|
29
29
|
|
30
30
|
deps do
|
31
31
|
require 'chef/search/query'
|
data/lib/knife-winops/version.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
This file should be excluded in the output of
|
2
|
-
Chef::Knife::Core::
|
2
|
+
Chef::Knife::Core::WinBootstrapContext#trusted_certs_script
|
@@ -53,7 +53,7 @@ describe 'Knife::Windows::Core msi download functionality for knife Windows winr
|
|
53
53
|
@local_file_download_destination = "#{@temp_directory}/chef-client-latest.msi"
|
54
54
|
|
55
55
|
source_code_directory = File.dirname(__FILE__)
|
56
|
-
@template_file_path ="#{source_code_directory}/../../lib/chef/knife/
|
56
|
+
@template_file_path ="#{source_code_directory}/../../lib/chef/knife/winops_bootstrap/windows-chef-client-msi.erb"
|
57
57
|
end
|
58
58
|
|
59
59
|
after(:all) do
|
@@ -64,7 +64,7 @@ describe 'Knife::Windows::Core msi download functionality for knife Windows winr
|
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "running on any version of the Windows OS", :windows_only do
|
67
|
-
let(:mock_bootstrap_context) { Chef::Knife::Core::
|
67
|
+
let(:mock_bootstrap_context) { Chef::Knife::Core::WinBootstrapContext.new({ }, nil, { :knife => {} }) }
|
68
68
|
let(:mock_winrm) { Chef::Knife::Winrm.new }
|
69
69
|
|
70
70
|
before do
|
@@ -86,7 +86,7 @@ describe 'Knife::Windows::Core msi download functionality for knife Windows winr
|
|
86
86
|
allow(mock_winrm.ui).to receive(:ask).and_return(nil)
|
87
87
|
allow(Chef::Knife::Winrm).to receive(:new).and_return(mock_winrm)
|
88
88
|
|
89
|
-
allow(Chef::Knife::Core::
|
89
|
+
allow(Chef::Knife::Core::WinBootstrapContext).to receive(:new).and_return(mock_bootstrap_context)
|
90
90
|
Chef::Config[:knife] = {:winrm_transport => 'plaintext', :chef_node_name => 'foo.example.com', :winrm_authentication_protocol => 'negotiate'}
|
91
91
|
end
|
92
92
|
|
@@ -95,7 +95,7 @@ describe 'Knife::Windows::Core msi download functionality for knife Windows winr
|
|
95
95
|
end
|
96
96
|
|
97
97
|
context "when provided a custom msi_url to fetch from" do
|
98
|
-
let(:mock_bootstrap_context) { Chef::Knife::Core::
|
98
|
+
let(:mock_bootstrap_context) { Chef::Knife::Core::WinBootstrapContext.new(
|
99
99
|
{ :msi_url => "file:///C:/Windows/System32/xcopy.exe" }, nil, { :knife => {} }) }
|
100
100
|
it "downloads the chef-client MSI from a custom path during winrm bootstrap" do
|
101
101
|
run_download_scenario
|
@@ -103,7 +103,7 @@ describe 'Knife::Windows::Core msi download functionality for knife Windows winr
|
|
103
103
|
end
|
104
104
|
|
105
105
|
context "when provided a custom msi_url with space in path to fetch from" do
|
106
|
-
let(:mock_bootstrap_context) { Chef::Knife::Core::
|
106
|
+
let(:mock_bootstrap_context) { Chef::Knife::Core::WinBootstrapContext.new(
|
107
107
|
{ :msi_url => "file:///C:/Program Files/Windows NT/Accessories/wordpad.exe" }, nil, { :knife => {} }) }
|
108
108
|
it "downloads the chef-client MSI from a custom path with spaces during winrm bootstrap" do
|
109
109
|
run_download_scenario
|
@@ -125,7 +125,7 @@ describe 'Knife::Windows::Core msi download functionality for knife Windows winr
|
|
125
125
|
def run_download_scenario
|
126
126
|
clean_test_case
|
127
127
|
|
128
|
-
winrm_bootstrapper = Chef::Knife::
|
128
|
+
winrm_bootstrapper = Chef::Knife::BootstrapWindowsWinRM.new([ "127.0.0.1" ])
|
129
129
|
winrm_bootstrapper.client_builder = instance_double("Chef::Knife::Bootstrap::ClientBuilder", :run => nil, :client_path => nil)
|
130
130
|
|
131
131
|
allow(WinRM::Connection).to receive(:new).and_return(Dummy::Connection.new)
|
@@ -148,9 +148,9 @@ end
|
|
148
148
|
|
149
149
|
describe "bootstrap_install_command functionality through WinRM protocol" do
|
150
150
|
context "bootstrap_install_command option is not specified" do
|
151
|
-
let(:bootstrap) { Chef::Knife::
|
151
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsWinRM.new([]) }
|
152
152
|
before do
|
153
|
-
@template_file_path ="../../lib/chef/knife/
|
153
|
+
@template_file_path ="../../lib/chef/knife/winops_bootstrap/windows-chef-client-msi.erb"
|
154
154
|
@template_input = sample_data(@template_file_path)
|
155
155
|
end
|
156
156
|
|
@@ -172,10 +172,10 @@ describe "bootstrap_install_command functionality through WinRM protocol" do
|
|
172
172
|
end
|
173
173
|
|
174
174
|
context "bootstrap_install_command option is specified" do
|
175
|
-
let(:bootstrap) { Chef::Knife::
|
175
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsWinRM.new(['--bootstrap-install-command', 'chef-client -o recipe[cbk1::rec2]']) }
|
176
176
|
before do
|
177
177
|
bootstrap.config[:bootstrap_install_command] = "chef-client -o recipe[cbk1::rec2]"
|
178
|
-
@template_file_path ="../../lib/chef/knife/
|
178
|
+
@template_file_path ="../../lib/chef/knife/winops_bootstrap/windows-chef-client-msi.erb"
|
179
179
|
@template_input = sample_data(@template_file_path)
|
180
180
|
end
|
181
181
|
|
@@ -198,9 +198,9 @@ end
|
|
198
198
|
|
199
199
|
describe "bootstrap_install_command functionality through SSH protocol", :chef_lt_12_5_only => true do
|
200
200
|
context "bootstrap_install_command option is not specified" do
|
201
|
-
let(:bootstrap) { Chef::Knife::
|
201
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsSSH.new([]) }
|
202
202
|
before do
|
203
|
-
@template_file_path ="../../lib/chef/knife/
|
203
|
+
@template_file_path ="../../lib/chef/knife/winops_bootstrap/windows-chef-client-msi.erb"
|
204
204
|
@template_input = sample_data(@template_file_path)
|
205
205
|
end
|
206
206
|
|
@@ -210,10 +210,10 @@ describe "bootstrap_install_command functionality through SSH protocol", :chef_l
|
|
210
210
|
end
|
211
211
|
|
212
212
|
context "bootstrap_install_command option is specified" do
|
213
|
-
let(:bootstrap) { Chef::Knife::
|
213
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsSSH.new(['--bootstrap-install-command', 'chef-client -o recipe[cbk1::rec2]']) }
|
214
214
|
before do
|
215
215
|
bootstrap.config[:bootstrap_install_command] = "chef-client -o recipe[cbk1::rec2]"
|
216
|
-
@template_file_path ="../../lib/chef/knife/
|
216
|
+
@template_file_path ="../../lib/chef/knife/winops_bootstrap/windows-chef-client-msi.erb"
|
217
217
|
@template_input = sample_data(@template_file_path)
|
218
218
|
end
|
219
219
|
|
data/spec/spec_helper.rb
CHANGED
@@ -21,9 +21,9 @@ def windows?
|
|
21
21
|
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
|
22
22
|
end
|
23
23
|
|
24
|
-
require_relative '../lib/chef/knife/
|
25
|
-
require_relative '../lib/chef/knife/
|
26
|
-
require_relative '../lib/chef/knife/
|
24
|
+
require_relative '../lib/chef/knife/winops_core/windows_bootstrap_context'
|
25
|
+
require_relative '../lib/chef/knife/winops_bootstrap_windows_winrm'
|
26
|
+
require_relative '../lib/chef/knife/winops_bootstrap_windows_ssh'
|
27
27
|
require_relative '../lib/chef/knife/wsman_test'
|
28
28
|
|
29
29
|
if windows?
|
@@ -68,8 +68,8 @@ expected: #{expected}
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
context 'when compared to
|
72
|
-
let(:win_bootstrap) { Chef::Knife::
|
71
|
+
context 'when compared to BootstrapWindowsWinRM' do
|
72
|
+
let(:win_bootstrap) { Chef::Knife::BootstrapWindowsWinRM.new }
|
73
73
|
|
74
74
|
# opt_map: Hash of symbols in windows mapping to symbols in core. Name checks are
|
75
75
|
# ignored for these.
|
@@ -126,8 +126,8 @@ expected: #{expected}
|
|
126
126
|
include_examples 'compare_options'
|
127
127
|
end
|
128
128
|
|
129
|
-
context 'when compared to
|
130
|
-
let(:win_bootstrap) { Chef::Knife::
|
129
|
+
context 'when compared to BootstrapWindowsSSH' do
|
130
|
+
let(:win_bootstrap) { Chef::Knife::BootstrapWindowsSSH.new }
|
131
131
|
|
132
132
|
# opt_map: Hash of symbols in windows mapping to symbols in core. Name checks are
|
133
133
|
# ignored for these.
|
@@ -16,11 +16,11 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
|
19
|
-
TEMPLATE_FILE = File.expand_path(File.dirname(__FILE__)) + "/../../../lib/chef/knife/
|
19
|
+
TEMPLATE_FILE = File.expand_path(File.dirname(__FILE__)) + "/../../../lib/chef/knife/winops_bootstrap/windows-chef-client-msi.erb"
|
20
20
|
|
21
21
|
require 'spec_helper'
|
22
22
|
|
23
|
-
describe Chef::Knife::
|
23
|
+
describe Chef::Knife::BootstrapWindowsWinRM do
|
24
24
|
let(:template_file) { TEMPLATE_FILE }
|
25
25
|
let(:options) { [] }
|
26
26
|
let(:rendered_template) do
|
@@ -44,7 +44,7 @@ describe Chef::Knife::BootstrapWindowsWinrm do
|
|
44
44
|
|
45
45
|
before(:each) do
|
46
46
|
Chef::Log.logger = Logger.new(StringIO.new)
|
47
|
-
@knife = Chef::Knife::
|
47
|
+
@knife = Chef::Knife::BootstrapWindowsWinRM.new
|
48
48
|
# Merge default settings in.
|
49
49
|
@knife.merge_configs
|
50
50
|
@knife.config[:template_file] = template_file
|
@@ -21,7 +21,7 @@ require 'winrm/output'
|
|
21
21
|
|
22
22
|
Chef::Knife::Winrm.load_deps
|
23
23
|
|
24
|
-
describe Chef::Knife::
|
24
|
+
describe Chef::Knife::BootstrapWindowsWinRM do
|
25
25
|
before do
|
26
26
|
Chef::Config.reset
|
27
27
|
bootstrap.config[:run_list] = []
|
@@ -45,7 +45,7 @@ describe Chef::Knife::BootstrapWindowsWinrm do
|
|
45
45
|
host: "localhost"
|
46
46
|
}
|
47
47
|
end
|
48
|
-
let(:bootstrap) { Chef::Knife::
|
48
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsWinRM.new(['winrm', '-d', 'windows-chef-client-msi', '-x', session_opts[:user], '-P', session_opts[:password], session_opts[:host]]) }
|
49
49
|
let(:session) { Chef::Knife::WinrmSession.new(session_opts) }
|
50
50
|
let(:arch_session_result) {
|
51
51
|
o = WinRM::Output.new
|
@@ -17,12 +17,12 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'spec_helper'
|
20
|
-
require 'chef/knife/
|
21
|
-
describe Chef::Knife::Core::
|
22
|
-
let(:mock_bootstrap_context) { Chef::Knife::Core::
|
20
|
+
require 'chef/knife/winops_core/windows_bootstrap_context'
|
21
|
+
describe Chef::Knife::Core::WinBootstrapContext do
|
22
|
+
let(:mock_bootstrap_context) { Chef::Knife::Core::WinBootstrapContext.new({ }, nil, { :knife => {} }) }
|
23
23
|
|
24
24
|
before do
|
25
|
-
allow(Chef::Knife::Core::
|
25
|
+
allow(Chef::Knife::Core::WinBootstrapContext).to receive(:new).and_return(mock_bootstrap_context)
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "fips" do
|
@@ -242,7 +242,7 @@ EXPECTED
|
|
242
242
|
|
243
243
|
describe "bootstrap_install_command for bootstrap through WinRM" do
|
244
244
|
context "when bootstrap_install_command option is passed on CLI" do
|
245
|
-
let(:bootstrap) { Chef::Knife::
|
245
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsWinRM.new(['--bootstrap-install-command', 'chef-client']) }
|
246
246
|
before do
|
247
247
|
bootstrap.config[:bootstrap_install_command] = "chef-client"
|
248
248
|
end
|
@@ -258,7 +258,7 @@ EXPECTED
|
|
258
258
|
end
|
259
259
|
|
260
260
|
context "when bootstrap_install_command option is not passed on CLI" do
|
261
|
-
let(:bootstrap) { Chef::Knife::
|
261
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsWinRM.new([]) }
|
262
262
|
it "does not set the bootstrap_install_command option under Chef::Config::Knife object" do
|
263
263
|
expect(Chef::Config[:knife][:bootstrap_install_command]). to eq(nil)
|
264
264
|
end
|
@@ -267,7 +267,7 @@ EXPECTED
|
|
267
267
|
|
268
268
|
describe "bootstrap_install_command for bootstrap through SSH" do
|
269
269
|
context "when bootstrap_install_command option is passed on CLI" do
|
270
|
-
let(:bootstrap) { Chef::Knife::
|
270
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsSSH.new(['--bootstrap-install-command', 'chef-client']) }
|
271
271
|
before do
|
272
272
|
bootstrap.config[:bootstrap_install_command] = "chef-client"
|
273
273
|
end
|
@@ -283,7 +283,7 @@ EXPECTED
|
|
283
283
|
end
|
284
284
|
|
285
285
|
context "when bootstrap_install_command option is not passed on CLI" do
|
286
|
-
let(:bootstrap) { Chef::Knife::
|
286
|
+
let(:bootstrap) { Chef::Knife::BootstrapWindowsSSH.new([]) }
|
287
287
|
it "does not set the bootstrap_install_command option under Chef::Config::Knife object" do
|
288
288
|
expect(Chef::Config[:knife][:bootstrap_install_command]). to eq(nil)
|
289
289
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-winops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robbert-Jan Sperna Weiland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: winrm
|
@@ -73,26 +73,26 @@ files:
|
|
73
73
|
- appveyor.yml
|
74
74
|
- ci.gemfile
|
75
75
|
- knife-winops.gemspec
|
76
|
-
- lib/chef/knife/
|
77
|
-
- lib/chef/knife/
|
78
|
-
- lib/chef/knife/
|
79
|
-
- lib/chef/knife/
|
80
|
-
- lib/chef/knife/
|
81
|
-
- lib/chef/knife/
|
82
|
-
- lib/chef/knife/
|
83
|
-
- lib/chef/knife/
|
84
|
-
- lib/chef/knife/
|
85
|
-
- lib/chef/knife/
|
86
|
-
- lib/chef/knife/
|
87
|
-
- lib/chef/knife/
|
88
|
-
- lib/chef/knife/
|
89
|
-
- lib/chef/knife/
|
90
|
-
- lib/chef/knife/
|
91
|
-
- lib/chef/knife/
|
92
|
-
- lib/chef/knife/
|
93
|
-
- lib/chef/knife/
|
94
|
-
- lib/chef/knife/
|
95
|
-
- lib/chef/knife/
|
76
|
+
- lib/chef/knife/winops_bootstrap/Chef_bootstrap.erb
|
77
|
+
- lib/chef/knife/winops_bootstrap/bootstrap.ps1
|
78
|
+
- lib/chef/knife/winops_bootstrap/tail.cmd
|
79
|
+
- lib/chef/knife/winops_bootstrap/windows-bootstrap-template.erb
|
80
|
+
- lib/chef/knife/winops_bootstrap_windows_base.rb
|
81
|
+
- lib/chef/knife/winops_bootstrap_windows_ssh.rb
|
82
|
+
- lib/chef/knife/winops_bootstrap_windows_winrm.rb
|
83
|
+
- lib/chef/knife/winops_core/windows_bootstrap_context.rb
|
84
|
+
- lib/chef/knife/winops_knife_windows_base.rb
|
85
|
+
- lib/chef/knife/winops_windows_cert_generate.rb
|
86
|
+
- lib/chef/knife/winops_windows_cert_install.rb
|
87
|
+
- lib/chef/knife/winops_windows_helper.rb
|
88
|
+
- lib/chef/knife/winops_windows_listener_create.rb
|
89
|
+
- lib/chef/knife/winops_winrm.rb
|
90
|
+
- lib/chef/knife/winops_winrm_base.rb
|
91
|
+
- lib/chef/knife/winops_winrm_knife_base.rb
|
92
|
+
- lib/chef/knife/winops_winrm_session.rb
|
93
|
+
- lib/chef/knife/winops_winrm_shared_options.rb
|
94
|
+
- lib/chef/knife/winops_wsman_endpoint.rb
|
95
|
+
- lib/chef/knife/winops_wsman_test.rb
|
96
96
|
- lib/knife-winops/path_helper.rb
|
97
97
|
- lib/knife-winops/version.rb
|
98
98
|
- spec/assets/fake_trusted_certs/excluded.txt
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.6
|
135
|
+
rubygems_version: 2.7.6
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting
|