knife-zero 1.1.6 → 1.2.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: f75c856acf221ffb4f0c2f039b9c2d8b53a55504
4
- data.tar.gz: 93efdd9ce4a2b526e7739e563ca294a2552175e0
3
+ metadata.gz: b8b3705dafa27da903873188a610945eeefd35d3
4
+ data.tar.gz: da2ad9277a6742c1c0ae3b80e73d524e319319e0
5
5
  SHA512:
6
- metadata.gz: a731fe554d0eafd4fe498aac475036c5eda96d3169964fea3f833d8df15db4eb8760615edb73016d4aaa1d91879108532d946b3a82755445a4ca19c409f039c3
7
- data.tar.gz: b9c487c465e67c09dc295459a0966205d4c0c1976497fd19b6802db6047315b8fc3aa5b10029a6591e2187c8b64d6f825a24be8f38b8d3d3f99631b65941b497
6
+ metadata.gz: d92be972b08258f7ff93818c20c1a669b63590a79556eaa9aae8543137bbe1d0f0b3bea5bdf7649548d148467ff3a3634f54321d5e1bc1f5a71693057831617d
7
+ data.tar.gz: e769d2d860c44d4bfeee9aa3ef34211ba6d1dec8ad5d6fded9c0b257aac5e903b35a2e08c722ff04bd7f6a2caacb137762d8656d7e6253f7f05b217ddd8000fb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog of knife-zero
2
2
 
3
+ ## Unrelesed
4
+
5
+ ## v1.2.0
6
+
7
+ - change filename knife/chef_client to zero_chef_client
8
+ - New function diagnose
9
+
3
10
  ## v1.1.6
4
11
 
5
12
  - Minor update: update bootstrap template for chef 11,12
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ clearing :on
2
+
3
+ guard :shell do
4
+ watch(%r{^(?:test|lib)/.+\.rb$}) { `ruby test/run_test.rb -v --notify` }
5
+ end
data/README.md CHANGED
@@ -45,6 +45,7 @@ $ chef gem install knife-zero
45
45
  ** ZERO COMMANDS **
46
46
  knife zero bootstrap FQDN (options)
47
47
  knife zero chef_client QUERY (options)
48
+ knife zero diagnose # show configuration from file
48
49
  ```
49
50
 
50
51
  ### knife zero bootstrap
@@ -336,6 +337,58 @@ $ knife zero chef_client "name:*" -x vagrant -i ./.vagrant/machines/default/virt
336
337
  192.168.33.10 resolving cookbooks for run list: []
337
338
  ```
338
339
 
340
+ ## Debug for Configration
341
+
342
+ `knife zero diagnose` shows configration from file(Such as knife.rb).
343
+
344
+ ```
345
+ $ knife zero diagnose
346
+
347
+ Chef::Config
348
+ ====================
349
+ ---
350
+ :local_mode: true
351
+ :verbosity:
352
+ :config_file: "/Users/sawanoboriyu/github/higanworks/knife-zero_plyglound/knife.rb"
353
+ :color: true
354
+ :log_level: :error
355
+ :chef_repo_path: "/Users/sawanoboriyu/github/higanworks/knife-zero_plyglound"
356
+ :log_location: !ruby/object:IO {}
357
+ :chef_server_url: http://localhost:8889
358
+ :repo_mode: everything
359
+
360
+ Knife::Config
361
+ ====================
362
+ ---
363
+ :verbosity: 0
364
+ :color: true
365
+ :editor: vim
366
+ :disable_editing: false
367
+ :format: summary
368
+ :ssh_user: root
369
+ :host_key_verify: true
370
+ :config_file: "/Users/sawanoboriyu/github/higanworks/knife-zero_plyglound/knife.rb"
371
+
372
+ Zero Boostrap Config
373
+ ====================
374
+ ---
375
+ :ssh_user: root
376
+ :host_key_verify: true
377
+ :distro: chef-full-localmode
378
+ :template_file: false
379
+ :run_list: []
380
+ :first_boot_attributes: {}
381
+
382
+ Zero ChefClient Config
383
+ ====================
384
+ ---
385
+ :ssh_user: root
386
+ :host_key_verify: true
387
+ :concurrency:
388
+ :override_runlist:
389
+ ```
390
+
391
+
339
392
  ## Contributing
340
393
 
341
394
  1. Fork it ( https://github.com/[my-github-username]/knife-zero/fork )
data/circle.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ machine:
3
+ ruby:
4
+ version: 2.1.5
5
+ test:
6
+ override:
7
+ - bundle exec ruby test/run_test.rb -v
data/knife-zero.gemspec CHANGED
@@ -20,6 +20,13 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "test-unit"
24
+ spec.add_development_dependency "test-unit-rr"
25
+ spec.add_development_dependency "test-unit-notify"
26
+ spec.add_development_dependency "guard"
27
+ spec.add_development_dependency "guard-shell"
28
+ spec.add_development_dependency "simplecov"
29
+ spec.add_development_dependency "simplecov-rcov"
23
30
 
24
31
  spec.add_runtime_dependency "chef"
25
32
  end
@@ -0,0 +1,51 @@
1
+ require 'chef/knife'
2
+ require 'chef/knife/bootstrap'
3
+ require 'chef/knife/zero_base'
4
+
5
+ class Chef
6
+ class Knife
7
+ class ZeroDiagnose < Knife
8
+ include Chef::Knife::ZeroBase
9
+
10
+ deps do
11
+ require 'knife-zero/core/bootstrap_context'
12
+ require 'chef/knife/zero_bootstrap'
13
+ require 'chef/knife/zero_chef_client'
14
+ Chef::Knife::ZeroBootstrap.load_deps
15
+ Chef::Knife::ZeroChefClient.load_deps
16
+ end
17
+
18
+ banner "knife zero diagnose # show configuration from file"
19
+
20
+ def initialize(argv = [])
21
+ super
22
+ @bootstrap = Chef::Knife::ZeroBootstrap.new
23
+ @chef_client = Chef::Knife::ZeroChefClient.new
24
+ end
25
+
26
+ def run
27
+ ui.msg "Chef::Config"
28
+ ui.msg "===================="
29
+ ui.msg Chef::Config.configuration.to_yaml
30
+ ui.msg ""
31
+
32
+ ui.msg "Knife::Config"
33
+ ui.msg "===================="
34
+ ui.msg config.to_yaml
35
+ ui.msg ""
36
+
37
+ ui.msg "Zero Boostrap Config"
38
+ ui.msg "===================="
39
+ bootstrap = Chef::Knife::ZeroBootstrap.new
40
+ @bootstrap.merge_configs
41
+ ui.msg @bootstrap.config.to_yaml
42
+ ui.msg ""
43
+
44
+ ui.msg "Zero ChefClient Config"
45
+ ui.msg "===================="
46
+ @chef_client.merge_configs
47
+ ui.msg @chef_client.config.to_yaml
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.1.6"
3
+ VERSION = "1.2.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -0,0 +1,29 @@
1
+ require 'chef/knife/zero_bootstrap'
2
+
3
+ class TC_ZeroBootstrap < Test::Unit::TestCase
4
+ sub_test_case "called with no options" do
5
+ def setup
6
+ @app = Chef::Knife::ZeroBootstrap.new
7
+ @app.merge_configs
8
+ require 'chef/knife/ssh'
9
+ Chef::Knife::ZeroBootstrap.load_deps
10
+ end
11
+
12
+ test "returns changed value from core" do
13
+ assert_equal("chef-full-localmode", @app.config[:distro])
14
+ end
15
+
16
+ test "returns BootstrapSsh via knife_ssh" do
17
+ ssh = @app.knife_ssh
18
+ assert_kind_of(Chef::Knife::BootstrapSsh, ssh)
19
+ end
20
+
21
+ sub_test_case "overwrite ssh_configration from ssh/config" do
22
+ test "overwrite port number" do
23
+ stub(Net::SSH).configuration_for { {port: 10022} }
24
+ ssh = @app.knife_ssh
25
+ assert_equal(10022, ssh.config[:port])
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ require 'chef/knife/zero_chef_client'
2
+ class TC_ZeroChefClient < Test::Unit::TestCase
3
+ sub_test_case "called with no options" do
4
+ def setup
5
+ @app = Chef::Knife::ZeroChefClient.new
6
+ @app.merge_configs
7
+ end
8
+
9
+ test "returns changed value from core" do
10
+ assert_nil(@app.config[:concurrency])
11
+ assert_nil(@app.config[:override_runlist])
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require 'knife-zero/bootstrap_ssh'
2
+
3
+ class TC_BootstrapSsh < Test::Unit::TestCase
4
+ def setup
5
+ @app = Chef::Knife::BootstrapSsh.new
6
+ @app.merge_configs
7
+ end
8
+
9
+ test "RR" do
10
+ assert_rr do
11
+ subject = Hash.new
12
+ mock(subject).to_json("hoge") {
13
+ "mogemoge"
14
+ }
15
+ assert_equal("mogemoge", subject.to_json("hoge"))
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ require "knife-zero/version"
2
+
3
+ class TC_Version < Test::Unit::TestCase
4
+ test "returns version correctly" do
5
+ assert_equal("1.2.0", Knife::Zero::VERSION)
6
+ end
7
+ end
data/test/run_test.rb ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
+ lib_dir = File.join(base_dir, "lib")
4
+ test_dir = File.join(base_dir, "test")
5
+
6
+ $LOAD_PATH.unshift(lib_dir)
7
+
8
+ require 'test/unit'
9
+ require 'test/unit/rr'
10
+ require 'simplecov'
11
+ require 'simplecov-rcov'
12
+
13
+ if ENV['CIRCLE_ARTIFACTS']
14
+ dir = File.join("..", "..", "..", ENV['CIRCLE_ARTIFACTS'], "coverage")
15
+ SimpleCov.coverage_dir(dir)
16
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
17
+ SimpleCov.start do
18
+ add_filter "/vendor/"
19
+ add_filter "/test/"
20
+ end
21
+ else
22
+ require "test/unit/notify"
23
+ end
24
+
25
+ exit Test::Unit::AutoRunner.run(true, test_dir)
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.1.6
4
+ version: 1.2.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-02-27 00:00:00.000000000 Z
11
+ date: 2015-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,104 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit-rr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: test-unit-notify
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-shell
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov-rcov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
41
139
  - !ruby/object:Gem::Dependency
42
140
  name: chef
43
141
  requirement: !ruby/object:Gem::Requirement
@@ -63,19 +161,27 @@ files:
63
161
  - ".gitignore"
64
162
  - CHANGELOG.md
65
163
  - Gemfile
164
+ - Guardfile
66
165
  - LICENSE.txt
67
166
  - README.md
68
167
  - Rakefile
168
+ - circle.yml
69
169
  - knife-zero.gemspec
70
170
  - lib/chef/knife/bootstrap/chef-full-localmode.erb
71
- - lib/chef/knife/chef_client.rb
72
171
  - lib/chef/knife/zero_base.rb
73
172
  - lib/chef/knife/zero_bootstrap.rb
173
+ - lib/chef/knife/zero_chef_client.rb
174
+ - lib/chef/knife/zero_diagnose.rb
74
175
  - lib/knife-zero/bootstrap_ssh.rb
75
176
  - lib/knife-zero/common.rb
76
177
  - lib/knife-zero/core/bootstrap_context.rb
77
178
  - lib/knife-zero/net-ssh-multi-patch.rb
78
179
  - lib/knife-zero/version.rb
180
+ - test/chef/knife/test_zero_bootstrap.rb
181
+ - test/chef/knife/test_zero_chef_client.rb
182
+ - test/knife-zero/test_bootstrap_ssh.rb
183
+ - test/knife-zero/test_versioin.rb
184
+ - test/run_test.rb
79
185
  homepage: ''
80
186
  licenses:
81
187
  - Apache2
@@ -101,4 +207,9 @@ signing_key:
101
207
  specification_version: 4
102
208
  summary: Run chef-client at remote node with chef-zero(local-mode) via HTTP over SSH
103
209
  port fowarding.
104
- test_files: []
210
+ test_files:
211
+ - test/chef/knife/test_zero_bootstrap.rb
212
+ - test/chef/knife/test_zero_chef_client.rb
213
+ - test/knife-zero/test_bootstrap_ssh.rb
214
+ - test/knife-zero/test_versioin.rb
215
+ - test/run_test.rb