knife-zero 2.1.0 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f1cd2562eb42faa227a762c0fae1ab59bb7f5c0c357e6c53b75d4c35546fc3b
4
- data.tar.gz: be6e7409ad03494cb2fd204f788221331bb7cef7e3054fe7e910c4da1b45773e
3
+ metadata.gz: a62b7b04af9df122f587f761f40f5b648a1302561c441545b3655cb7ae350d93
4
+ data.tar.gz: 3afcb78f362a483216f9a19239c03ab3f36c482d9423d7d4277dc92fec7470ad
5
5
  SHA512:
6
- metadata.gz: 34644654c493967891415dceb6f88ec0bb437b4abebbb540121969aa2e992d81877270d3a372cff002d8e8556666c24cbf4c5405e8822167d47d7142d0779cc2
7
- data.tar.gz: 7453c885179051ad941aad30c214f1d5b0bf2b50b42276b92a251560ca63f831fe7b16c568e2787f475908a689144e092a73dbec01cc1538ab6ae4376817df61
6
+ metadata.gz: 697c2636b742cb7256043904704fa139748cc881bbce0f96e9ecd443d468ac41bddd5a91175cf364f883f245a3d1012725d669f2f4c1f29afc71fa90621b5148
7
+ data.tar.gz: '0089e7a25b9ef24f9f00b16ca3c16a40fc773e9efb9a9b0ee0435b8ef3685560636acb69856bba160ea6daef25157f63d1dc17003208bf8003174b90b24b0b37'
@@ -4,6 +4,34 @@
4
4
 
5
5
  none.
6
6
 
7
+ ## v2.3.2
8
+
9
+ - follow core changes, they uses autoload.
10
+ - .to_yaml not work in diagnose.
11
+
12
+ ## v2.3.1
13
+
14
+ - bugfix: alter_project not works due to typo. HT: [@aspyatkin](https://github.com/aspyatkin)
15
+ - [https://github.com/higanworks/knife-zero/issues/133#issuecomment-674530243](https://github.com/higanworks/knife-zero/issues/133#issuecomment-674530243)
16
+
17
+ ## v2.3.0
18
+
19
+ - use `allowd_` instead.
20
+ - ref: [Renamed Client Configuration Options - Chef Infra Client 16.3 released!](https://discourse.chef.io/t/chef-infra-client-16-3-released/17449)
21
+
22
+ ## v2.2.1
23
+
24
+ - path --validation_key option to resolve crash bootstraping in cinc 15.6 [#138](https://github.com/higanworks/knife-zero/pull/138)
25
+
26
+ ## v2.2.0
27
+
28
+ - add `--alter-project` to support cinc [#133](https://github.com/higanworks/knife-zero/pull/133)
29
+ - allowed values: 'chef' or 'cinc'
30
+ - in config => `knife[:alter_project]`
31
+ - relocate `--node-config` option from `zero converge` to both `zero converge` and `zero bootstrap`.
32
+ - remove `-N` for `--node-config` short option.
33
+ - (Duplicate with NAME option)
34
+
7
35
  ## v2.1.0
8
36
 
9
37
  - Allow pass run-list and environments from json-attributes.
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: [Configration | Knife-Zero Document](http://knife-zero.github.io/40_configuration/)
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)Supress Automatic Attributes
63
+ #### (Hint)Suppress Automatic Attributes
64
64
 
65
- Relocated: [Configration | Knife-Zero Document](http://knife-zero.github.io/40_configration/)
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
@@ -1,6 +1,7 @@
1
1
  require 'chef'
2
2
  require 'chef/knife/ssh'
3
3
  require 'chef/knife/bootstrap' unless Chef::Knife.const_defined?(:Bootstrap)
4
+ require 'yaml'
4
5
 
5
6
  class Chef
6
7
  class Knife
@@ -28,6 +29,19 @@ class Chef
28
29
  description: 'Listen port on remote',
29
30
  default: nil,
30
31
  proc: proc { |key| Chef::Config[:remote_chef_zero_port] = key.to_i }
32
+
33
+ option :alter_project,
34
+ long: '--alter-project PROJECT',
35
+ proc: proc { |u| Chef::Config[:alter_project] = u },
36
+ description: 'Products used on remote nodes',
37
+ default: 'chef',
38
+ in: %w{chef cinc}
39
+
40
+ option :node_config_file,
41
+ long: '--node-config PATH_TO_CONFIG',
42
+ proc: proc { |u| Chef::Config[:node_config_file] = u },
43
+ description: 'The configuration file to use on remote node',
44
+ default: '/etc/chef/client.rb'
31
45
  end
32
46
  end
33
47
 
@@ -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',
@@ -124,7 +119,7 @@ class Chef
124
119
  s << ' -j /etc/chef/chef_client_json.json' if @config[:json_attribs]
125
120
  s << " --splay #{@config[:splay]}" if @config[:splay]
126
121
  s << " -n #{@config[:named_run_list]}" if @config[:named_run_list]
127
- s << " --config #{@config[:node_config_file]}" if @config[:node_config_file]
122
+ s << " --config #{@config[:node_config_file]}"
128
123
  s << ' --skip-cookbook-sync' if @config[:skip_cookbook_sync]
129
124
  s << ' --no-color' unless @config[:color]
130
125
  s << " -E #{@config[:environment]}" if @config[:environment]
@@ -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
- super(%{/opt/chef/embedded/bin/ruby -ropen-uri -e 'puts open("https://omnitruck.chef.io/install.sh").read' | sudo sh -s -- -v #{config[:client_version]}})
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
- white_lists = []
22
- %w{automatic_attribute_whitelist default_attribute_whitelist normal_attribute_whitelist override_attribute_whitelist}.each do |white_list|
23
- next unless Chef::Config[:knife][white_list.to_sym]&.is_a?(Array)
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
- white_lists.push([
26
- white_list,
27
- Chef::Config[:knife][white_list.to_sym].to_s
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 << white_lists.join("\n")
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
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = '2.1.0'.freeze
3
+ VERSION = '2.3.2'.freeze
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
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.1.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-27 00:00:00.000000000 Z
11
+ date: 2020-09-10 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
- rubyforge_project:
196
- rubygems_version: 2.7.6
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.