knife-zero 1.3.0 → 1.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
  SHA1:
3
- metadata.gz: 8a52879c7b2312b6a05e46f044746eed637e2070
4
- data.tar.gz: 3125584c73940e7a77afc98f8ec48122e2cb1c06
3
+ metadata.gz: 620915bb2600d2bff34062afc9f5aed680043159
4
+ data.tar.gz: c01f7d554cbb73f3ed02dd5e2f03eff8e9f26231
5
5
  SHA512:
6
- metadata.gz: 767c923ddd0b2f41f69be5bd28cbf81d958de19cea129db796613f0d251da777b940a48458fd6d50e2d7f8e88c71dfafc73a761bd29208446532a6aaa5aa8d4f
7
- data.tar.gz: dcf59ee8ac62dfd553adcdd07a04b3c5a06393d3c43a48298157ca2bf75865feaacd3f2146bb077dc071feb062008a49dfba78c26716730add01dc8f32b6cddc
6
+ metadata.gz: a0d1659ce376fd1969d2689082e7e6a1bc6eaee0653f7665b722325228c9cb592a6d3c7792234d099ba3e64556cac8f6399e079799eb691d0e955a8220d1c694
7
+ data.tar.gz: 9bc35ec066cc9707d6664623d9184d79dc2a796f94c3c2aa8b9e5505d3bb0b310b1558bd7cf8f1662af1cb942c83ea6c2906f192f08e31a3f22471c985e82c11
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unrelesed
4
4
 
5
+ ## v1.4.0
6
+
7
+ - Change: remote listen by local chef-zero port + 10000
8
+ - Feature: overrde Remote Chef-Zero port.
9
+
5
10
  ## v1.3.0
6
11
 
7
12
  - return dummy key to validation.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Knife-Plugin Zero
2
2
 
3
+ [![Circle CI](https://circleci.com/gh/higanworks/knife-zero.svg?style=svg)](https://circleci.com/gh/higanworks/knife-zero)
4
+
3
5
  [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/higanworks/knife-zero?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
6
 
5
7
  [![Gem Version](https://badge.fury.io/rb/knife-zero.svg)](http://badge.fury.io/rb/knife-zero)
@@ -244,6 +246,10 @@ Connecting to 192.168.33.10
244
246
 
245
247
  Run zero chef_client with `-a name` option.
246
248
 
249
+ > Caution: `-a(--attribute) name` option doesn't work since chef 12.1.0.
250
+ > Please use specific attribute until fix it.
251
+ > I've already create PR for fix. Please wait for merge to use name attribute. https://github.com/chef/chef/pull/3195
252
+
247
253
  ```
248
254
  $ knife zero chef_client "name:*" -x vagrant -i ./.vagrant/machines/default/virtualbox/private_key --sudo -a name
249
255
  WARN: No cookbooks directory found at or above current directory. Assuming /Users/sawanoboriyu/worktemp/knife-zero-vagrant.
@@ -57,6 +57,12 @@ class Chef
57
57
  :description => 'Enable whyrun mode on chef-client run at remote node.',
58
58
  :boolean => true
59
59
 
60
+ option :remote_chef_zero_port,
61
+ :long => "--remote-chef-zero-port PORT",
62
+ :description => "Listen port on remote",
63
+ :default => nil,
64
+ :proc => Proc.new { |key| Chef::Config[:remote_chef_zero_port] = key.to_i }
65
+
60
66
  end
61
67
  end
62
68
 
@@ -9,6 +9,7 @@ class Chef
9
9
  deps do
10
10
  require 'chef/run_list/run_list_item'
11
11
  Chef::Knife::BootstrapSsh.load_deps
12
+ require "knife-zero/helper"
12
13
  end
13
14
 
14
15
  banner "knife zero chef_client QUERY (options)"
@@ -49,7 +50,7 @@ class Chef
49
50
  client_path = @config[:chef_client_path] ? "#{client_path}#{@config[:chef_client_path]}" : "#{client_path}chef-client"
50
51
  s = "#{client_path}"
51
52
  s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
52
- s << " -S http://127.0.0.1:8889"
53
+ s << " -S http://127.0.0.1:#{::Knife::Zero::Helper.zero_remote_port}"
53
54
  s << " -o #{@config[:override_runlist]}" if @config[:override_runlist]
54
55
  s << " -W" if @config[:why_run]
55
56
  s
@@ -6,6 +6,7 @@ class Chef
6
6
  deps do
7
7
  Chef::Knife::Ssh.load_deps
8
8
  require "knife-zero/net-ssh-multi-patch"
9
+ require "knife-zero/helper"
9
10
  end
10
11
 
11
12
  def ssh_command(command, subsession=nil)
@@ -18,7 +19,7 @@ class Chef
18
19
  '127.0.0.1'
19
20
  (subsession || session).servers.each do |server|
20
21
  session = server.session(true)
21
- session.forward.remote(chef_zero_port, chef_zero_host, chef_zero_port)
22
+ session.forward.remote(chef_zero_port, chef_zero_host, ::Knife::Zero::Helper.zero_remote_port)
22
23
  end
23
24
  super
24
25
  rescue => e
@@ -1,4 +1,5 @@
1
1
  require 'chef/knife/core/bootstrap_context'
2
+ require "knife-zero/helper"
2
3
 
3
4
  class Chef
4
5
  class Knife
@@ -21,7 +22,7 @@ class Chef
21
22
  s = "#{client_path} -j /etc/chef/first-boot.json"
22
23
  s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
23
24
  s << " -E #{bootstrap_environment}" if ::Chef::VERSION.to_f != 0.9 # only use the -E option on Chef 0.10+
24
- s << " -S http://127.0.0.1:#{URI.parse(Chef::Config.chef_server_url).port}"
25
+ s << " -S http://127.0.0.1:#{::Knife::Zero::Helper.zero_remote_port}"
25
26
  s << " -W" if @config[:why_run]
26
27
  s
27
28
  else
@@ -0,0 +1,13 @@
1
+ module Knife
2
+ module Zero
3
+ module Helper
4
+ def self.zero_remote_port
5
+ return ::Chef::Config[:remote_chef_zero_port] if ::Chef::Config[:remote_chef_zero_port]
6
+ chef_zero_port = ::Chef::Config[:chef_zero_port] ||
7
+ ::Chef::Config[:knife][:chef_zero_port] ||
8
+ 8889
9
+ chef_zero_port + 10000
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -2,6 +2,6 @@ require "knife-zero/version"
2
2
 
3
3
  class TC_Version < Test::Unit::TestCase
4
4
  test "returns version correctly" do
5
- assert_equal("1.3.0", Knife::Zero::VERSION)
5
+ assert_equal("1.4.0", Knife::Zero::VERSION)
6
6
  end
7
7
  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: 1.3.0
4
+ version: 1.4.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-04-02 00:00:00.000000000 Z
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,8 +172,8 @@ files:
172
172
  - lib/chef/knife/zero_chef_client.rb
173
173
  - lib/chef/knife/zero_diagnose.rb
174
174
  - lib/knife-zero/bootstrap_ssh.rb
175
- - lib/knife-zero/common.rb
176
175
  - lib/knife-zero/core/bootstrap_context.rb
176
+ - lib/knife-zero/helper.rb
177
177
  - lib/knife-zero/net-ssh-multi-patch.rb
178
178
  - lib/knife-zero/version.rb
179
179
  - test/chef/knife/test_zero_bootstrap.rb
@@ -1,7 +0,0 @@
1
- module Knife
2
- module Zero
3
- module Helper
4
- ## Some Helper..
5
- end
6
- end
7
- end