tiller 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/tiller +6 -4
  3. data/lib/tiller/util.rb +20 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19b9c31a627b8be234e1222fada6dbfdcd5a0fd8
4
- data.tar.gz: 306d86613d62bb5a8cbf93e423fa1ca92192fdbd
3
+ metadata.gz: fe6f12cf89be768c76267511b8b197b4fc1bba6c
4
+ data.tar.gz: b36c3b73947eef269e4b672f3a0b05511ea345ce
5
5
  SHA512:
6
- metadata.gz: b622b2787cad0505049358ceb99a7ed6fc3a6c9154fa6e9541b76876302add88d198995a825df32b98ecd069c2780d5687c7f52a51ee31cbdf37015c76c94656
7
- data.tar.gz: d4700698a4537c923f899e834fd8c318d2ac2ad3385b3509b1570f7eeb14c236d9511487627cd3780cc315c4f153b2360def6925190c6de0467ea11480f9f652
6
+ metadata.gz: 9d3898a7da36129148f38da6aeee2ba43a4f932472060642a0a1a44473355230718938ed90e2d584543f2c9b7dd01561b7e2ca1d84954192d2249d3e89431f8c
7
+ data.tar.gz: debda6b46a3f5b75b04e6698b839f377326920b0fe417db6e202ea06f7a0621e623435c3cd5a64742a14f06d7f2dcc58afdc214dad17f38ca7ba4f8763eef947
data/bin/tiller CHANGED
@@ -4,7 +4,7 @@
4
4
  # didn't have an existing gem named after it!
5
5
  # Mark Round <github@markround.com>
6
6
 
7
- VERSION = '0.5.0'
7
+ VERSION = '0.5.1'
8
8
 
9
9
  require 'erb'
10
10
  require 'ostruct'
@@ -164,15 +164,17 @@ module Tiller
164
164
 
165
165
  if config[:no_exec] == false && config.key?('exec')
166
166
  # All templates created, so let's start the replacement process
167
- puts "Executing #{config['exec']}..."
167
+ puts "Executing #{config['exec'].to_s}..."
168
168
 
169
169
  # Spawn and wait so API can continue to run
170
- child_pid = spawn(config['exec'])
170
+ child_pid = launch(config['exec'], :verbose => config[:verbose])
171
171
 
172
172
  puts "Child process forked with PID #{child_pid}." if config[:verbose]
173
173
 
174
174
  # Catch signals and send them on to the child process
175
- [ :INT, :TERM, :HUP ].each { |sig| Signal.trap(sig) { signal(sig, child_pid, config) } }
175
+ [ :INT, :TERM, :HUP ].each do |sig|
176
+ Signal.trap(sig) { signal(sig, child_pid, :verbose => config[:verbose]) }
177
+ end
176
178
 
177
179
  Process.wait(child_pid)
178
180
 
data/lib/tiller/util.rb CHANGED
@@ -13,11 +13,29 @@ def warn_merge(key, old, new, type, source)
13
13
  end
14
14
 
15
15
  # Pass signals on to child process
16
- def signal(sig, pid, config)
17
- puts "Caught signal #{sig}, passing to PID #{pid}" if config[:verbose]
16
+ def signal(sig, pid, options={})
17
+ puts "Caught signal #{sig}, passing to PID #{pid}" if options[:verbose]
18
18
  begin
19
19
  Process.kill(sig, pid)
20
20
  rescue Errno::ESRCH
21
21
  false
22
22
  end
23
+ end
24
+
25
+ # Launch the replacement process.
26
+ def launch(cmd, options={})
27
+ # If an array, then we use a different form of spawn() which
28
+ # avoids a subshell. See https://github.com/markround/tiller/issues/8
29
+ if cmd.is_a?(Array)
30
+ final='cmd[0]'
31
+ # Build up the list of arguments when using the array form of spawn()
32
+ if cmd.size > 1
33
+ (1..cmd.size-1).each {|c| final="#{final} , cmd[#{c}]" }
34
+ end
35
+ pid=eval "spawn(#{final})"
36
+ else
37
+ pid=spawn(cmd)
38
+ end
39
+
40
+ pid
23
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Round
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tool to create configuration files from a variety of sources, particularly
14
14
  useful for Docker containers. See https://github.com/markround/tiller for examples