kondate 0.4.7 → 0.4.8

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: 7774a2c7a591fadd1d4c2b7782ed1780bbc052d9
4
- data.tar.gz: 3bfc5d71a9a56769a1c3531f8b4fd80cd44cd555
3
+ metadata.gz: b54a2f96280eb909e0e542d324820de43b6ade6b
4
+ data.tar.gz: 424d90982dbb240817604b84dd42c25eb17e49cb
5
5
  SHA512:
6
- metadata.gz: 4ecfaf0b6ddd496e1f2f82e659193b821aff56fe1a9876f4a0bcc16deedf6ac763aca2f4a67a132898c46cc44de20726ecdf38641733b9162ed4cef810820572
7
- data.tar.gz: ebb781eb6faa46669559a151e4063e93643c447bb31fd549a859168070f3169806dd92a4dc1c5f045cbd8b0d1cc5b8a2a47968a78129ff8798b65879c7bd5bb2
6
+ metadata.gz: fafee50e2a6a054acf7251c97757274bb8579a0ef53e41cc288fc1fc1a220f5cf55a1c8d722e5fcb2a0c4e2bdda7f27334777132cfce86379ff6f02765f45c59
7
+ data.tar.gz: 6de4e87c5b2df2cf9d3c8bc4ad39aa0ce15a14f231b255df825b66a2202295f768f6ab733d00e53d87f4cbc5acd8313385e6b7bec03a1b4223e5cd25f8cf6233
data/.gitignore CHANGED
@@ -18,3 +18,4 @@
18
18
  /kondate/
19
19
  .vagrant
20
20
  .tags
21
+ /bin/
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.4.8 (2017-01-27)
2
+
3
+ Enhancements:
4
+
5
+ * Add hostname to itamae log prefix
6
+
1
7
  # 0.4.7 (2017-01-26)
2
8
 
3
9
  Fixes:
data/kondate.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'highline'
26
26
  spec.add_dependency 'facter'
27
27
  spec.add_dependency 'parallel'
28
+ spec.add_dependency 'frontkick'
28
29
 
29
30
  spec.add_development_dependency "bundler"
30
31
  spec.add_development_dependency "test-unit"
data/lib/kondate/cli.rb CHANGED
@@ -8,6 +8,7 @@ require 'shellwords'
8
8
  require 'find'
9
9
  require 'facter'
10
10
  require 'parallel'
11
+ require 'frontkick'
11
12
 
12
13
  module Kondate
13
14
  class CLI < Thor
@@ -156,7 +157,11 @@ module Kondate
156
157
  command << " --recipe-graph=#{@options[:recipe_graph]}" if @options[:recipe_graph]
157
158
  command << " bootstrap.rb"
158
159
  $stdout.puts "env #{env.map {|k, v| "#{k}=#{v.shellescape}" }.join(' ')} #{command}"
159
- return false unless system(env, command)
160
+
161
+ output_with_hostname(host) do |out, err|
162
+ result = Frontkick.exec(env, command, out: out, err: err)
163
+ return false unless result.successful?
164
+ end
160
165
  end
161
166
  true
162
167
  end
@@ -181,11 +186,46 @@ module Kondate
181
186
  env['TARGET_NODE_FILE'] = property_file.path
182
187
  command = "bundle exec rspec #{spec_files.map{|f| f.shellescape }.join(' ')}"
183
188
  $stdout.puts "env #{env.map {|k, v| "#{k}=#{v.shellescape}" }.join(' ')} #{command}"
184
- return false unless system(env, command)
189
+
190
+ output_with_hostname(host) do |out, err|
191
+ result = Frontkick.exec(env, command, out: out, err: err)
192
+ return false unless result.successful?
193
+ end
185
194
  end
186
195
  true
187
196
  end
188
197
 
198
+ def output_with_hostname(host, &block)
199
+ out_r, out_w = IO.pipe
200
+ out_w.sync = true
201
+ err_r, err_w = IO.pipe
202
+ err_w.sync = true
203
+
204
+ $stdout.sync = true
205
+ $stderr.sync = true
206
+
207
+ out_thr = Thread.new do
208
+ while r = out_r.gets
209
+ $stdout.write "#{host} | #{r}"
210
+ end
211
+ end
212
+
213
+ err_thr = Thread.new do
214
+ while r = err_r.gets
215
+ $stderr.write "#{host} | #{r}"
216
+ end
217
+ end
218
+
219
+ yield(out_w, err_w)
220
+ ensure
221
+ out_r.close rescue nil
222
+ out_w.close rescue nil
223
+ err_r.close rescue nil
224
+ err_w.close rescue nil
225
+ out_thr.exit rescue nil
226
+ err_thr.exit rescue nil
227
+ end
228
+
189
229
  def proceed?(property_files)
190
230
  if property_files.values.compact.reject(&:empty?).empty?
191
231
  $stderr.puts "Nothing to run"
@@ -11,6 +11,8 @@ module Kondate
11
11
  end
12
12
 
13
13
  def bootstrap
14
+ $stdout.sync = true
15
+ $stderr.sync = true
14
16
  bootstrap_middleware_recipes
15
17
  bootstrap_role_recipes
16
18
  end
@@ -6,6 +6,8 @@ require 'yaml'
6
6
  ### required for kondate #####
7
7
  host = ENV['TARGET_HOST']
8
8
  set :set_property, YAML.load_file(ENV['TARGET_NODE_FILE'])
9
+ $stdout.sync = true
10
+ $stderr.sync = true
9
11
  ############################
10
12
 
11
13
  set :backend, :ssh
@@ -1,3 +1,3 @@
1
1
  module Kondate
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kondate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - sonots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-26 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: frontkick
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement