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.
- checksums.yaml +4 -4
- data/bin/tiller +6 -4
- data/lib/tiller/util.rb +20 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe6f12cf89be768c76267511b8b197b4fc1bba6c
|
4
|
+
data.tar.gz: b36c3b73947eef269e4b672f3a0b05511ea345ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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 =
|
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
|
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,
|
17
|
-
puts "Caught signal #{sig}, passing to PID #{pid}" if
|
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.
|
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-
|
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
|