knife-windows 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -5
- data/.travis.yml +26 -26
- data/CHANGELOG.md +112 -108
- data/DOC_CHANGES.md +14 -14
- data/Gemfile +12 -12
- data/LICENSE +201 -201
- data/README.md +391 -385
- data/RELEASE_NOTES.md +34 -34
- data/Rakefile +21 -21
- data/appveyor.yml +42 -42
- data/ci.gemfile +15 -15
- data/features/knife_help.feature +20 -20
- data/features/support/env.rb +5 -5
- data/knife-windows.gemspec +25 -25
- data/lib/chef/knife/bootstrap/windows-chef-client-msi.erb +233 -247
- data/lib/chef/knife/bootstrap_windows_base.rb +449 -415
- data/lib/chef/knife/bootstrap_windows_ssh.rb +115 -115
- data/lib/chef/knife/bootstrap_windows_winrm.rb +95 -95
- data/lib/chef/knife/core/windows_bootstrap_context.rb +372 -366
- 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 +117 -117
- data/lib/chef/knife/winrm_knife_base.rb +305 -303
- data/lib/chef/knife/winrm_session.rb +88 -87
- 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 +117 -117
- 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 +217 -217
- data/spec/assets/win_template_rendered_with_bootstrap_install_command_on_12_5_client.txt +217 -217
- data/spec/assets/win_template_rendered_without_bootstrap_install_command.txt +329 -329
- data/spec/assets/win_template_rendered_without_bootstrap_install_command_on_12_5_client.txt +329 -329
- data/spec/assets/win_template_unrendered.txt +246 -246
- data/spec/functional/bootstrap_download_spec.rb +241 -234
- data/spec/spec_helper.rb +94 -93
- data/spec/unit/knife/bootstrap_options_spec.rb +155 -155
- data/spec/unit/knife/bootstrap_template_spec.rb +98 -92
- data/spec/unit/knife/bootstrap_windows_winrm_spec.rb +341 -295
- 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 +65 -65
- data/spec/unit/knife/winrm_spec.rb +516 -516
- data/spec/unit/knife/wsman_test_spec.rb +202 -202
- metadata +23 -4
@@ -1,92 +1,98 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Chirag Jog (<chirag@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013 Chirag Jog
|
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
|
-
TEMPLATE_FILE = File.expand_path(File.dirname(__FILE__)) + "/../../../lib/chef/knife/bootstrap/windows-chef-client-msi.erb"
|
20
|
-
|
21
|
-
require 'spec_helper'
|
22
|
-
|
23
|
-
describe Chef::Knife::BootstrapWindowsWinrm do
|
24
|
-
let(:template_file) { TEMPLATE_FILE }
|
25
|
-
let(:options) { [] }
|
26
|
-
let(:rendered_template) do
|
27
|
-
knife.instance_variable_set("@template_file", template_file)
|
28
|
-
knife.parse_options(options)
|
29
|
-
# Avoid referencing a validation keyfile we won't find during #render_template
|
30
|
-
template = IO.read(template_file).chomp
|
31
|
-
knife.render_template(template)
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
@
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
Chef::Config
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@knife.
|
50
|
-
@
|
51
|
-
|
52
|
-
@
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
let(:options){ ["--bootstrap-proxy", "", "--bootstrap-no-proxy", setting] }
|
59
|
-
|
60
|
-
context "via --bootstrap-no-proxy" do
|
61
|
-
let(:setting) { "api.
|
62
|
-
|
63
|
-
it "renders the client.rb with a single FQDN no_proxy entry" do
|
64
|
-
expect(rendered_template).to match(%r{.*no_proxy\s*\"api.
|
65
|
-
end
|
66
|
-
end
|
67
|
-
context "via --bootstrap-no-proxy multiple" do
|
68
|
-
let(:setting) { "api.
|
69
|
-
|
70
|
-
it "renders the client.rb with comma-separated FQDN and wildcard IP address no_proxy entries" do
|
71
|
-
expect(rendered_template).to match(%r{.*no_proxy\s*"api.
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "specifying --msi-url" do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
1
|
+
#
|
2
|
+
# Author:: Chirag Jog (<chirag@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Chirag Jog
|
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
|
+
TEMPLATE_FILE = File.expand_path(File.dirname(__FILE__)) + "/../../../lib/chef/knife/bootstrap/windows-chef-client-msi.erb"
|
20
|
+
|
21
|
+
require 'spec_helper'
|
22
|
+
|
23
|
+
describe Chef::Knife::BootstrapWindowsWinrm do
|
24
|
+
let(:template_file) { TEMPLATE_FILE }
|
25
|
+
let(:options) { [] }
|
26
|
+
let(:rendered_template) do
|
27
|
+
knife.instance_variable_set("@template_file", template_file)
|
28
|
+
knife.parse_options(options)
|
29
|
+
# Avoid referencing a validation keyfile we won't find during #render_template
|
30
|
+
template = IO.read(template_file).chomp
|
31
|
+
knife.render_template(template)
|
32
|
+
end
|
33
|
+
subject(:knife) { described_class.new }
|
34
|
+
|
35
|
+
before(:all) do
|
36
|
+
@original_config = Chef::Config.hash_dup
|
37
|
+
@original_knife_config = Chef::Config[:knife].dup
|
38
|
+
end
|
39
|
+
|
40
|
+
after(:all) do
|
41
|
+
Chef::Config.configuration = @original_config
|
42
|
+
Chef::Config[:knife] = @original_knife_config
|
43
|
+
end
|
44
|
+
|
45
|
+
before(:each) do
|
46
|
+
Chef::Log.logger = Logger.new(StringIO.new)
|
47
|
+
@knife = Chef::Knife::BootstrapWindowsWinrm.new
|
48
|
+
# Merge default settings in.
|
49
|
+
@knife.merge_configs
|
50
|
+
@knife.config[:template_file] = template_file
|
51
|
+
@stdout = StringIO.new
|
52
|
+
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
|
53
|
+
@stderr = StringIO.new
|
54
|
+
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "specifying no_proxy with various entries" do
|
58
|
+
let(:options){ ["--bootstrap-proxy", "", "--bootstrap-no-proxy", setting] }
|
59
|
+
|
60
|
+
context "via --bootstrap-no-proxy" do
|
61
|
+
let(:setting) { "api.chef.io" }
|
62
|
+
|
63
|
+
it "renders the client.rb with a single FQDN no_proxy entry" do
|
64
|
+
expect(rendered_template).to match(%r{.*no_proxy\s*\"api.chef.io\".*})
|
65
|
+
end
|
66
|
+
end
|
67
|
+
context "via --bootstrap-no-proxy multiple" do
|
68
|
+
let(:setting) { "api.chef.io,172.16.10.*" }
|
69
|
+
|
70
|
+
it "renders the client.rb with comma-separated FQDN and wildcard IP address no_proxy entries" do
|
71
|
+
expect(rendered_template).to match(%r{.*no_proxy\s*"api.chef.io,172.16.10.\*".*})
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "specifying --msi-url" do
|
77
|
+
context "with explicitly provided --msi-url" do
|
78
|
+
let(:options) { ["--msi-url", "file:///something.msi"] }
|
79
|
+
|
80
|
+
it "bootstrap batch file must fetch from provided url" do
|
81
|
+
expect(rendered_template).to match(%r{.*REMOTE_SOURCE_MSI_URL=file:///something\.msi.*})
|
82
|
+
end
|
83
|
+
end
|
84
|
+
context "with no provided --msi-url" do
|
85
|
+
it "bootstrap batch file must fetch from provided url" do
|
86
|
+
expect(rendered_template).to match(%r{.*REMOTE_SOURCE_MSI_URL=https://www\.chef\.io/.*})
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "specifying knife_config[:architecture]" do
|
92
|
+
it "puts the target architecture into the msi_url" do
|
93
|
+
Chef::Config[:knife][:architecture] = :x86_64
|
94
|
+
expect(rendered_template).to match(/MACHINE_ARCH=x86_64/)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|