knife-zero 2.0.3 → 2.3.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 +30 -0
- data/README.md +3 -3
- data/lib/chef/knife/zero_base.rb +13 -0
- data/lib/chef/knife/zero_bootstrap.rb +5 -0
- data/lib/chef/knife/zero_converge.rb +6 -9
- data/lib/knife-zero/bootstrap_ssh.rb +6 -1
- data/lib/knife-zero/core/bootstrap_context.rb +12 -7
- data/lib/knife-zero/net_ssh_multi_patch.rb +2 -0
- data/lib/knife-zero/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac67b410005680ab38ee1746311ffb1ba52909983081436b720fd957f6e75564
|
4
|
+
data.tar.gz: cdb89df6d2e69fed589df841cebd9701afda1d4875ee18d83d462a7eaa46f486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0fa31dcf279e4db60b673cb4970eb7f14c67b92af10ed46a7bd99f71c2a37c0d87c4f905f459abdee5cda49fa5671128d98f5aec2299679a258cf1eb2d014d8
|
7
|
+
data.tar.gz: 37f2d61abb130e6fe1273fbc1150b5021bd0895c9bff33f4ed5d82d5f832b08263213e1225a6a52600b2bd488b66c0ac39fa9d70a1d600c1973e221edee756c5
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,36 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
none.
|
6
|
+
|
7
|
+
## v2.3.0
|
8
|
+
|
9
|
+
- use `allowd_` instead.
|
10
|
+
- ref: [Renamed Client Configuration Options - Chef Infra Client 16.3 released!](https://discourse.chef.io/t/chef-infra-client-16-3-released/17449)
|
11
|
+
|
12
|
+
## v2.2.1
|
13
|
+
|
14
|
+
- path --validation_key option to resolve crash bootstraping in cinc 15.6 [#138](https://github.com/higanworks/knife-zero/pull/138)
|
15
|
+
|
16
|
+
## v2.2.0
|
17
|
+
|
18
|
+
- add `--alter-project` to support cinc [#133](https://github.com/higanworks/knife-zero/pull/133)
|
19
|
+
- allowed values: 'chef' or 'cinc'
|
20
|
+
- in config => `knife[:alter_project]`
|
21
|
+
- relocate `--node-config` option from `zero converge` to both `zero converge` and `zero bootstrap`.
|
22
|
+
- remove `-N` for `--node-config` short option.
|
23
|
+
- (Duplicate with NAME option)
|
24
|
+
|
25
|
+
## v2.1.0
|
26
|
+
|
27
|
+
- Allow pass run-list and environments from json-attributes.
|
28
|
+
- Related:Split run list and attributes from nodes [#132](https://github.com/higanworks/knife-zero/issues/132)
|
29
|
+
|
30
|
+
## v2.0.4
|
31
|
+
|
32
|
+
- bugfix: Crash around the end of a concurrent connection [#131](https://github.com/higanworks/knife-zero/pull/131)
|
33
|
+
|
34
|
+
|
5
35
|
## v2.0.3
|
6
36
|
|
7
37
|
- Properly quoted policy name [#129](https://github.com/higanworks/knife-zero/pull/129) HT: [@etki](https://github.com/etki)
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ knife zero diagnose # show configuration from file
|
|
50
50
|
|
51
51
|
### Configuration file
|
52
52
|
|
53
|
-
Relocated: [
|
53
|
+
Relocated: [Configuration | Knife-Zero Document](http://knife-zero.github.io/40_configuration/)
|
54
54
|
|
55
55
|
### knife zero bootstrap | converge | diagnose
|
56
56
|
|
@@ -60,9 +60,9 @@ Relocated
|
|
60
60
|
- [Subcommands | Knife-Zero Document](http://knife-zero.github.io/30_subcommands/)
|
61
61
|
|
62
62
|
|
63
|
-
#### (Hint)
|
63
|
+
#### (Hint)Suppress Automatic Attributes
|
64
64
|
|
65
|
-
Relocated: [
|
65
|
+
Relocated: [Configuration | Knife-Zero Document](http://knife-zero.github.io/40_configuration/)
|
66
66
|
|
67
67
|
|
68
68
|
## To include from other knife plugins
|
data/lib/chef/knife/zero_base.rb
CHANGED
@@ -28,6 +28,19 @@ class Chef
|
|
28
28
|
description: 'Listen port on remote',
|
29
29
|
default: nil,
|
30
30
|
proc: proc { |key| Chef::Config[:remote_chef_zero_port] = key.to_i }
|
31
|
+
|
32
|
+
option :alter_project,
|
33
|
+
long: '--alter-project PROJECT',
|
34
|
+
proc: proc { |u| Chef::Config[:alter_project] = u },
|
35
|
+
description: 'Products used on remote nodes',
|
36
|
+
default: 'chef',
|
37
|
+
in: %w{chef cinc}
|
38
|
+
|
39
|
+
option :node_config_file,
|
40
|
+
long: '--node-config PATH_TO_CONFIG',
|
41
|
+
proc: proc { |u| Chef::Config[:node_config_file] = u },
|
42
|
+
description: 'The configuration file to use on remote node',
|
43
|
+
default: '/etc/chef/client.rb'
|
31
44
|
end
|
32
45
|
end
|
33
46
|
|
@@ -54,6 +54,11 @@ class Chef
|
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|
57
|
+
case @config[:alter_project]
|
58
|
+
when 'cinc'
|
59
|
+
Chef::Config[:knife][:bootstrap_url] = 'https://omnitruck.cinc.sh/install.sh'
|
60
|
+
end
|
61
|
+
|
57
62
|
if @config[:bootstrap_converge]
|
58
63
|
unless @config[:overwrite_node_object]
|
59
64
|
q = Chef::Search::Query.new
|
@@ -36,11 +36,6 @@ class Chef
|
|
36
36
|
self.options[:skip_cookbook_sync] = Chef::Application::Client.options[:skip_cookbook_sync]
|
37
37
|
end
|
38
38
|
|
39
|
-
option :node_config_file,
|
40
|
-
short: '-N PATH_TO_CONFIG',
|
41
|
-
long: '--node-config PATH_TO_CONFIG',
|
42
|
-
description: 'The configuration file to use on remote node'
|
43
|
-
|
44
39
|
option :splay,
|
45
40
|
long: '--splay SECONDS',
|
46
41
|
description: 'The splay time for running at intervals, in seconds',
|
@@ -105,11 +100,12 @@ class Chef
|
|
105
100
|
::Knife::Zero::Helper.hook_shell_out!('before_converge', ui, Chef::Config[:knife][:before_converge])
|
106
101
|
end
|
107
102
|
|
108
|
-
validate_options!
|
109
103
|
if @config[:json_attribs]
|
110
104
|
@config[:chef_client_json] = fetch_json_from_url
|
111
105
|
end
|
112
106
|
|
107
|
+
validate_options!
|
108
|
+
|
113
109
|
@name_args = [@name_args[0], start_chef_client]
|
114
110
|
end
|
115
111
|
|
@@ -123,7 +119,7 @@ class Chef
|
|
123
119
|
s << ' -j /etc/chef/chef_client_json.json' if @config[:json_attribs]
|
124
120
|
s << " --splay #{@config[:splay]}" if @config[:splay]
|
125
121
|
s << " -n #{@config[:named_run_list]}" if @config[:named_run_list]
|
126
|
-
s << " --config #{@config[:node_config_file]}"
|
122
|
+
s << " --config #{@config[:node_config_file]}"
|
127
123
|
s << ' --skip-cookbook-sync' if @config[:skip_cookbook_sync]
|
128
124
|
s << ' --no-color' unless @config[:color]
|
129
125
|
s << " -E #{@config[:environment]}" if @config[:environment]
|
@@ -142,7 +138,8 @@ class Chef
|
|
142
138
|
if json_attribs_without_override_given?
|
143
139
|
ui.error(
|
144
140
|
'--json-attributes must be used with --override-runlist ' \
|
145
|
-
'
|
141
|
+
'or passed json should includes key `run-list` ' \
|
142
|
+
'to avoid unexpected updating local node object.'
|
146
143
|
)
|
147
144
|
exit 1
|
148
145
|
end
|
@@ -155,7 +152,7 @@ class Chef
|
|
155
152
|
end
|
156
153
|
|
157
154
|
def override_runlist_given?
|
158
|
-
!config[:override_runlist].nil? && !config[:override_runlist].empty?
|
155
|
+
!config[:override_runlist].nil? && !config[:override_runlist].empty? || @config[:chef_client_json]&.key?('run_list')
|
159
156
|
end
|
160
157
|
|
161
158
|
def named_run_list_given?
|
@@ -11,7 +11,12 @@ class Chef
|
|
11
11
|
|
12
12
|
def ssh_command(command, subsession = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
|
13
13
|
if config[:client_version]
|
14
|
-
|
14
|
+
case @config[:alter_project]
|
15
|
+
when 'cinc'
|
16
|
+
super(%{/opt/cinc/embedded/bin/ruby -ropen-uri -e 'puts open("https://omnitruck.cinc.sh/install.sh").read' | sudo sh -s -- -v #{config[:client_version]}})
|
17
|
+
else
|
18
|
+
super(%{/opt/chef/embedded/bin/ruby -ropen-uri -e 'puts open("https://omnitruck.chef.io/chef/install.sh").read' | sudo sh -s -- -v #{config[:client_version]}})
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
if config[:json_attribs]
|
@@ -18,16 +18,19 @@ class Chef
|
|
18
18
|
alias_method :orig_config_content, :config_content
|
19
19
|
def config_content # rubocop:disable Metrics/AbcSize
|
20
20
|
client_rb = orig_config_content
|
21
|
-
|
22
|
-
%w{
|
23
|
-
|
21
|
+
allowed_lists = []
|
22
|
+
%w{
|
23
|
+
automatic_attribute_whitelist default_attribute_whitelist normal_attribute_whitelist override_attribute_whitelist
|
24
|
+
allowed_automatic_attributes allowed_default_attributes allowed_normal_attributes allowed_override_attributes
|
25
|
+
}.each do |allowed_list|
|
26
|
+
next unless Chef::Config[:knife][allowed_list.to_sym]&.is_a?(Array)
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
Chef::Config[:knife][
|
28
|
+
allowed_lists.push([
|
29
|
+
allowed_list,
|
30
|
+
Chef::Config[:knife][allowed_list.to_sym].to_s
|
28
31
|
].join(' '))
|
29
32
|
end
|
30
|
-
client_rb <<
|
33
|
+
client_rb << allowed_lists.join("\n")
|
31
34
|
|
32
35
|
## For support policy_document_native_api
|
33
36
|
if @config[:policy_name]
|
@@ -52,8 +55,10 @@ class Chef
|
|
52
55
|
client_path = @chef_config[:chef_client_path] || 'chef-client'
|
53
56
|
s = String.new("#{client_path} -j /etc/chef/first-boot.json")
|
54
57
|
s << ' -l debug' if @config[:verbosity] && @config[:verbosity] >= 2
|
58
|
+
s << " --config #{@config[:node_config_file]}"
|
55
59
|
s << " -E #{bootstrap_environment}" unless bootstrap_environment.nil?
|
56
60
|
s << " -S http://127.0.0.1:#{::Knife::Zero::Helper.zero_remote_port}"
|
61
|
+
s << " -K #{[::File.dirname(@config[:node_config_file]), 'validation.pem'].join('/')}"
|
57
62
|
s << ' -W' if @config[:why_run]
|
58
63
|
Chef::Log.info 'Remote command: ' + s
|
59
64
|
s
|
data/lib/knife-zero/version.rb
CHANGED
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: 2.0
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawanoboly
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -177,7 +177,7 @@ homepage: http://knife-zero.github.io
|
|
177
177
|
licenses:
|
178
178
|
- Apache-2.0
|
179
179
|
metadata: {}
|
180
|
-
post_install_message:
|
180
|
+
post_install_message:
|
181
181
|
rdoc_options: []
|
182
182
|
require_paths:
|
183
183
|
- lib
|
@@ -192,9 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
|
196
|
-
|
197
|
-
signing_key:
|
195
|
+
rubygems_version: 3.1.2
|
196
|
+
signing_key:
|
198
197
|
specification_version: 4
|
199
198
|
summary: Run chef-client at remote node with chef-zero(local-mode) via HTTP over SSH
|
200
199
|
port fowarding.
|