knife-zero 2.3.1 → 2.4.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: 7235dd89bcb387b73d12aa2631f6c72746b05463fd7fbe006402f4c870ee53ba
4
- data.tar.gz: 01e58af6d4739438506149e1019505b3e8f000d86f987c556c0b7ef89e04e0f4
3
+ metadata.gz: 149fbd77f85c915b104af952516f476d0b9028443b00431074617990ccb600ed
4
+ data.tar.gz: 8091b146b95a0a20d7eaf4d7c285a16e047e11f3cfaa29fb90bb15587d515768
5
5
  SHA512:
6
- metadata.gz: e671ff9c0fe66c7df9629573ca0a902231f51b70f8f9278eb09efc3b81c2df15fe3d795d4728fcf9af05f839145ecaa5820d2c1f6302e1c8735223d43c95d3be
7
- data.tar.gz: 7068f2392f68de0dbc3cf801f78bfaac188a5104ff8bcc5a9fb399a84743319f91322063b8955c32c2ee9be29c4d9546a047ed79142a6717da8357f2c7be9c81
6
+ metadata.gz: 1703b839e001a71f139bf04737e02d49e0138428929cb2cfc646ae4e118c7d261f09708c0a4e379ae73a609308e3dcf48181f393df7de671d4640f9d7e13730c
7
+ data.tar.gz: 7943c7cc3efb38358b644e538230dcc6b9fc413cd296bcaaad37b4f48eb2c351eb964cde599e3246705a94e3ba7687a35eb487744dc6739d24e7bc57f64013c2
data/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  ## Unreleased
4
4
 
5
5
  none.
6
+ ## v2.4.2
7
+
8
+ - compatibility: Check knife version instead of chef version before overriding knife method [#162](https://github.com/higanworks/knife-zero/pull/162) HT [@cgunther](https://github.com/cgunther)
9
+
10
+ ## v2.4.1
11
+
12
+ - bugfix: alter_project does not work correctly at bootstraping. [#159](https://github.com/higanworks/knife-zero/issues/159) HT [@pyama86](https://github.com/pyama86)
13
+
14
+ ## v2.4.0
15
+
16
+ - follow core changes.
17
+ - ssh_command changed at chef-17.3.27
18
+
19
+ ## v2.3.2
20
+
21
+ - follow core changes, they uses autoload.
22
+ - .to_yaml not work in diagnose.
6
23
 
7
24
  ## v2.3.1
8
25
 
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
@@ -56,7 +56,7 @@ class Chef
56
56
 
57
57
  case @config[:alter_project]
58
58
  when 'cinc'
59
- Chef::Config[:knife][:bootstrap_url] = 'https://omnitruck.cinc.sh/install.sh'
59
+ @config[:bootstrap_url] = 'https://omnitruck.cinc.sh/install.sh'
60
60
  end
61
61
 
62
62
  if @config[:bootstrap_converge]
@@ -1,4 +1,5 @@
1
1
  require 'chef/knife/ssh'
2
+ require 'chef/knife/version'
2
3
 
3
4
  class Chef
4
5
  class Knife
@@ -9,6 +10,7 @@ class Chef
9
10
  require 'knife-zero/helper'
10
11
  end
11
12
 
13
+ if Gem::Version.new(Chef::Knife::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
16
  case config[:alter_project]
@@ -40,6 +42,39 @@ class Chef
40
42
  ui.error e.backtrace.join("\n")
41
43
  exit 1
42
44
  end
45
+ else
46
+ def ssh_command(command, session_list = session) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
47
+ if config[:client_version]
48
+ case config[:alter_project]
49
+ when 'cinc'
50
+ 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]}})
51
+ else
52
+ 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]}})
53
+ end
54
+ end
55
+
56
+ if config[:json_attribs]
57
+ Chef::Log.info "Onetime Attributes: #{config[:chef_client_json]}"
58
+ super(build_client_json)
59
+ end
60
+
61
+ chef_zero_port = config[:chef_zero_port] ||
62
+ Chef::Config[:knife][:chef_zero_port] ||
63
+ URI.parse(Chef::Config.chef_server_url).port
64
+ chef_zero_host = config[:chef_zero_host] ||
65
+ Chef::Config[:knife][:chef_zero_host] ||
66
+ '127.0.0.1'
67
+ session_list.servers.each do |server|
68
+ session = server.session(true)
69
+ session.forward.remote(chef_zero_port, chef_zero_host, ::Knife::Zero::Helper.zero_remote_port)
70
+ end
71
+ super
72
+ rescue => e # rubocop:disable Style/RescueStandardError
73
+ ui.error(e.class.to_s + e.message)
74
+ ui.error e.backtrace.join("\n")
75
+ exit 1
76
+ end
77
+ end
43
78
 
44
79
  def build_client_json
45
80
  <<-SCRIPT
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = '2.3.1'.freeze
3
+ VERSION = '2.4.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.3.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-17 00:00:00.000000000 Z
11
+ date: 2021-10-29 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:
@@ -192,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
206
  - !ruby/object:Gem::Version
193
207
  version: '0'
194
208
  requirements: []
195
- rubygems_version: 3.1.2
209
+ rubygems_version: 3.2.22
196
210
  signing_key:
197
211
  specification_version: 4
198
212
  summary: Run chef-client at remote node with chef-zero(local-mode) via HTTP over SSH