knife-zero 1.6.0 → 1.7.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/chef/knife/zero_base.rb +1 -1
- data/lib/chef/knife/zero_bootstrap.rb +5 -0
- data/lib/chef/knife/zero_chef_client.rb +12 -2
- data/lib/knife-zero/core/bootstrap_context.rb +18 -0
- data/lib/knife-zero/version.rb +1 -1
- data/test/chef/knife/test_zero_bootstrap.rb +1 -1
- data/test/knife-zero/test_versioin.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faceb4268fabca7f9ce0d461762633eee1e462c7
|
4
|
+
data.tar.gz: 9fa1e9d3057549778c1aecbcd9610bb8b4e78194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33bab13eec4bb5b1d9630ecdf740bb61acd08b5d7d435b9a743c048faba61b8ddf8f8a3a13e2cd4190c99fe86b45ea629840421fb26c3beb71e368dba900ff5b
|
7
|
+
data.tar.gz: 18a186631c76e4a9e996f87becc6dde87c834fdc9a6fd306fffe9a20ecb92f4fe9ad32ac732a86bca8656fd3012f8f5b79652ae30a3b1f781d37835f720810a6
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## v1.7.0
|
6
|
+
|
7
|
+
- Bug: ignored knife[:use_sudo] by converge, #22 #42
|
8
|
+
- Feature: Append white_list to client.rb at bootstrap. #43
|
9
|
+
- Feature: Add --without-chef-run to zero bootstrap #44
|
10
|
+
|
5
11
|
## v1.6.0
|
6
12
|
|
7
13
|
- Feature: #32 create alias converge to chef_client, and recommended it by README.
|
data/lib/chef/knife/zero_base.rb
CHANGED
@@ -19,6 +19,11 @@ class Chef
|
|
19
19
|
self.options.delete :node_ssl_verify_mode
|
20
20
|
self.options.delete :node_verify_api_cert
|
21
21
|
|
22
|
+
option :without_chef_run,
|
23
|
+
:long => "--without-chef-run",
|
24
|
+
:description => "Bootstrap without Chef-Client Run.(for only update client.rb)",
|
25
|
+
:boolean => false
|
26
|
+
|
22
27
|
def knife_ssh
|
23
28
|
begin
|
24
29
|
ssh = Chef::Knife::BootstrapSsh.new
|
@@ -15,9 +15,17 @@ class Chef
|
|
15
15
|
banner "knife zero chef_client QUERY (options) | It's same as converge"
|
16
16
|
|
17
17
|
self.options = Ssh.options.merge(self.options)
|
18
|
-
self.options[:use_sudo] = Bootstrap.options[:use_sudo]
|
19
18
|
self.options[:use_sudo_password] = Bootstrap.options[:use_sudo_password]
|
20
19
|
|
20
|
+
|
21
|
+
option :use_sudo,
|
22
|
+
:long => "--[no-]sudo",
|
23
|
+
:description => "Execute the chef-client via sudo (true by default)",
|
24
|
+
:boolean => true,
|
25
|
+
:default => true,
|
26
|
+
:proc => lambda { |v| Chef::Config[:knife][:use_sudo] = v }
|
27
|
+
|
28
|
+
|
21
29
|
option :override_runlist,
|
22
30
|
:short => "-o RunlistItem,RunlistItem...",
|
23
31
|
:long => "--override-runlist RunlistItem,RunlistItem...",
|
@@ -28,17 +36,19 @@ class Chef
|
|
28
36
|
|
29
37
|
def initialize(argv=[])
|
30
38
|
super
|
39
|
+
self.configure_chef
|
31
40
|
@name_args = [@name_args[0], start_chef_client]
|
32
41
|
end
|
33
42
|
|
34
43
|
def start_chef_client
|
35
|
-
client_path = @config[:use_sudo] ? 'sudo ' : ''
|
44
|
+
client_path = @config[:use_sudo] || Chef::Config[:knife][:use_sudo] ? 'sudo ' : ''
|
36
45
|
client_path = @config[:chef_client_path] ? "#{client_path}#{@config[:chef_client_path]}" : "#{client_path}chef-client"
|
37
46
|
s = "#{client_path}"
|
38
47
|
s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
|
39
48
|
s << " -S http://127.0.0.1:#{::Knife::Zero::Helper.zero_remote_port}"
|
40
49
|
s << " -o #{@config[:override_runlist]}" if @config[:override_runlist]
|
41
50
|
s << " -W" if @config[:why_run]
|
51
|
+
Chef::Log.info "Remote command: " + s
|
42
52
|
s
|
43
53
|
end
|
44
54
|
end
|
@@ -15,9 +15,24 @@ class Chef
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
alias :orig_config_content config_content
|
19
|
+
def config_content
|
20
|
+
client_rb = orig_config_content
|
21
|
+
%w{ automatic_attribute_whitelist default_attribute_whitelist normal_attribute_whitelist override_attribute_whitelist }.each do |white_list|
|
22
|
+
if Chef::Config[:knife][white_list.to_sym] && Chef::Config[:knife][white_list.to_sym].is_a?(Array)
|
23
|
+
client_rb << [
|
24
|
+
white_list,
|
25
|
+
Chef::Config[:knife][white_list.to_sym].to_s
|
26
|
+
].join(" ")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
client_rb
|
30
|
+
end
|
31
|
+
|
18
32
|
alias :orig_start_chef start_chef
|
19
33
|
def start_chef
|
20
34
|
if @chef_config[:knife_zero]
|
35
|
+
unless @config[:without_chef_run]
|
21
36
|
client_path = @chef_config[:chef_client_path] || 'chef-client'
|
22
37
|
s = "#{client_path} -j /etc/chef/first-boot.json"
|
23
38
|
s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
|
@@ -25,6 +40,9 @@ class Chef
|
|
25
40
|
s << " -S http://127.0.0.1:#{::Knife::Zero::Helper.zero_remote_port}"
|
26
41
|
s << " -W" if @config[:why_run]
|
27
42
|
s
|
43
|
+
else
|
44
|
+
"echo Execution of Chef-Client has been canceled due to --without-chef-run."
|
45
|
+
end
|
28
46
|
else
|
29
47
|
orig_start_chef
|
30
48
|
end
|
data/lib/knife-zero/version.rb
CHANGED
@@ -10,7 +10,7 @@ class TC_ZeroBootstrap < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
test "returns true from Chef::Config[:knife_zero]" do
|
13
|
-
|
13
|
+
assert_equal({}, Chef::Config[:knife_zero])
|
14
14
|
end
|
15
15
|
|
16
16
|
test "returns expected bootstrap template(for notice changes of core to me)" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawanoboly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|