knife-zero 2.2.0 → 2.4.0

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: 0d05862dc7246e728f58b0bda336b60417415d10668a16fad81c7efc0ee5cd61
4
- data.tar.gz: 87ba092f340f8ffcdd95202cfa217138cb9acd06ed31b7601ffc4151a835997c
3
+ metadata.gz: ec45a99b4e00747009e914be5be5e53ca9ee490bbb4213ae97a9da1a585f7e51
4
+ data.tar.gz: c3750a145a402bfe5eaa96bb5fc1d0fdbcddfa0fc087cfcf25f67d46815739fc
5
5
  SHA512:
6
- metadata.gz: b5e198e21398ade07a5bef9d11381a4900d886078748d155fc90d262bc540b24453dcc4985afc4d0d51de6e9185bce5a7471dd0666b67d01768a8662ce38015f
7
- data.tar.gz: 9b38e4d64ef1a2e85bba7535ac23be86e1e9d805d637cbbc4026d579dd5e3b103ac00a1320d7d2da99022081a637ceada9b476ff7260da47a4064fb7bce90308
6
+ metadata.gz: 12c381d16c23b23b83e7f3891d1d54e43205bdcbf034e675da43466a085999227c555b8bb76230363d3bf10490766046fd9523093faf0520fa080586447a1ba8
7
+ data.tar.gz: 6bd256d008478efec34fd27cb353fcd7712ffd2875d52875f1ef0b2944243aac31c8b7b490eb6a1cca702f02c4f2f5dc2119f4327b9dde324ddfe83ff654248d
data/CHANGELOG.md CHANGED
@@ -4,9 +4,33 @@
4
4
 
5
5
  none.
6
6
 
7
+ ## v2.4.0
8
+
9
+ - follow core changes.
10
+ - ssh_command changed at chef-17.3.27
11
+
12
+ ## v2.3.2
13
+
14
+ - follow core changes, they uses autoload.
15
+ - .to_yaml not work in diagnose.
16
+
17
+ ## v2.3.1
18
+
19
+ - bugfix: alter_project not works due to typo. HT: [@aspyatkin](https://github.com/aspyatkin)
20
+ - [https://github.com/higanworks/knife-zero/issues/133#issuecomment-674530243](https://github.com/higanworks/knife-zero/issues/133#issuecomment-674530243)
21
+
22
+ ## v2.3.0
23
+
24
+ - use `allowd_` instead.
25
+ - ref: [Renamed Client Configuration Options - Chef Infra Client 16.3 released!](https://discourse.chef.io/t/chef-infra-client-16-3-released/17449)
26
+
27
+ ## v2.2.1
28
+
29
+ - path --validation_key option to resolve crash bootstraping in cinc 15.6 [#138](https://github.com/higanworks/knife-zero/pull/138)
30
+
7
31
  ## v2.2.0
8
32
 
9
- - add `--alter-project` to support cinc [#133]
33
+ - add `--alter-project` to support cinc [#133](https://github.com/higanworks/knife-zero/pull/133)
10
34
  - allowed values: 'chef' or 'cinc'
11
35
  - in config => `knife[:alter_project]`
12
36
  - relocate `--node-config` option from `zero converge` to both `zero converge` and `zero bootstrap`.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Knife-Plugin Zero
2
2
 
3
- - current_master: [![Circle CI](https://circleci.com/gh/higanworks/knife-zero/tree/master.svg?style=svg)](https://circleci.com/gh/higanworks/knife-zero/tree/master)
3
+ - current_main: [![Circle CI](https://circleci.com/gh/higanworks/knife-zero/tree/main.svg?style=svg)](https://circleci.com/gh/higanworks/knife-zero/tree/main)
4
4
  - integration_with_edge_chef: [![Circle CI](https://circleci.com/gh/higanworks/knife-zero/tree/integration_testedge.svg?style=svg)](https://circleci.com/gh/higanworks/knife-zero/tree/integration_testedge)
5
5
 
6
6
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/higanworks/knife-zero?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -17,7 +17,7 @@ Run chef-client at remote node with chef-zero(local-mode) via HTTP over SSH port
17
17
  - [Knife-Zero Document](https://knife-zero.github.io)
18
18
  - [Knife-Zero Document(Ja)](https://knife-zero.github.io/ja/)
19
19
 
20
- - [CHANGELOG](https://github.com/higanworks/knife-zero/blob/master/CHANGELOG.md)
20
+ - [CHANGELOG](https://github.com/higanworks/knife-zero/blob/main/CHANGELOG.md)
21
21
 
22
22
  ## Requirements
23
23
 
data/knife-zero.gemspec CHANGED
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'test-unit-rr'
30
30
 
31
31
  spec.add_runtime_dependency 'chef', '>= 15.0'
32
+ spec.add_runtime_dependency 'knife', '>= 17.0'
32
33
  end
@@ -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
@@ -1,4 +1,5 @@
1
1
  require 'chef/knife/ssh'
2
+ require 'chef/version'
2
3
 
3
4
  class Chef
4
5
  class Knife
@@ -9,9 +10,10 @@ class Chef
9
10
  require 'knife-zero/helper'
10
11
  end
11
12
 
13
+ if Gem::Version.new(Chef::VERSION) < Gem::Version.new("17.3.27")
12
14
  def ssh_command(command, subsession = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
13
15
  if config[:client_version]
14
- case @config[:alter_project]
16
+ case config[:alter_project]
15
17
  when 'cinc'
16
18
  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
19
  else
@@ -40,6 +42,40 @@ class Chef
40
42
  ui.error e.backtrace.join("\n")
41
43
  exit 1
42
44
  end
45
+ else
46
+ # def ssh_command(command, subsession = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
47
+ def ssh_command(command, session_list = session) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
48
+ if config[:client_version]
49
+ case config[:alter_project]
50
+ when 'cinc'
51
+ 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]}})
52
+ else
53
+ 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]}})
54
+ end
55
+ end
56
+
57
+ if config[:json_attribs]
58
+ Chef::Log.info "Onetime Attributes: #{config[:chef_client_json]}"
59
+ super(build_client_json)
60
+ end
61
+
62
+ chef_zero_port = config[:chef_zero_port] ||
63
+ Chef::Config[:knife][:chef_zero_port] ||
64
+ URI.parse(Chef::Config.chef_server_url).port
65
+ chef_zero_host = config[:chef_zero_host] ||
66
+ Chef::Config[:knife][:chef_zero_host] ||
67
+ '127.0.0.1'
68
+ session_list.servers.each do |server|
69
+ session = server.session(true)
70
+ session.forward.remote(chef_zero_port, chef_zero_host, ::Knife::Zero::Helper.zero_remote_port)
71
+ end
72
+ super
73
+ rescue => e # rubocop:disable Style/RescueStandardError
74
+ ui.error(e.class.to_s + e.message)
75
+ ui.error e.backtrace.join("\n")
76
+ exit 1
77
+ end
78
+ end
43
79
 
44
80
  def build_client_json
45
81
  <<-SCRIPT
@@ -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]
@@ -55,6 +58,7 @@ class Chef
55
58
  s << " --config #{@config[:node_config_file]}"
56
59
  s << " -E #{bootstrap_environment}" unless bootstrap_environment.nil?
57
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('/')}"
58
62
  s << ' -W' if @config[:why_run]
59
63
  Chef::Log.info 'Remote command: ' + s
60
64
  s
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = '2.2.0'.freeze
3
+ VERSION = '2.4.0'.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.2.0
4
+ version: 2.4.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: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2021-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '15.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: knife
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '17.0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '17.0'
153
167
  description: Run chef-client at remote node with chef-zero(local-mode) via HTTP over
154
168
  SSH port fowarding.
155
169
  email:
@@ -177,7 +191,7 @@ homepage: http://knife-zero.github.io
177
191
  licenses:
178
192
  - Apache-2.0
179
193
  metadata: {}
180
- post_install_message:
194
+ post_install_message:
181
195
  rdoc_options: []
182
196
  require_paths:
183
197
  - lib
@@ -192,9 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
206
  - !ruby/object:Gem::Version
193
207
  version: '0'
194
208
  requirements: []
195
- rubyforge_project:
196
- rubygems_version: 2.7.6.2
197
- signing_key:
209
+ rubygems_version: 3.2.22
210
+ signing_key:
198
211
  specification_version: 4
199
212
  summary: Run chef-client at remote node with chef-zero(local-mode) via HTTP over SSH
200
213
  port fowarding.