tiller 0.3.2 → 0.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: c32c4ca4b4639f9805d818dc47918d843cca787c
4
- data.tar.gz: 482b956bea0ca02af1c91079bbd3e49b04859e07
3
+ metadata.gz: cbd7c351b404d9ad522229e387678dcfac6cc625
4
+ data.tar.gz: 944655c1a9f52ff0385e8e56fe85cfc52a00751d
5
5
  SHA512:
6
- metadata.gz: 866676d926a31d6987888aa8e258d14e71fe9ba2348cac6a28e83d2082bbd55fbd5ff1022d3166a2bfc80e793c071826e146494a2e3e88c9736551cc0a05e7cb
7
- data.tar.gz: ac0d422c214bcf8cbcd48734fa38d181d8911fab8176bcd7e8a32e527d88153c867e96760e57c27550089ee74849ca2c85ec360843d953aa681fb69d90516d8a
6
+ metadata.gz: 6362ad6e2febddbc0075e9fdbda50128bc27eca7b633efc0ca2903085c3a303acde1df32b8bdf7260bf35b6d75c493c19745ddf788387ecc280c318a3117670f
7
+ data.tar.gz: f35071d852eb1e01eddfccdec52e8eeeb1b0321bc2b36cb6866c004e939ffa3130a97bedfe6750097d2f020a13285e20247b86e5ae1a3066e5f73a9b7ce78b9a
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.3.2'
7
+ VERSION = '0.4.0'
8
8
 
9
9
  require 'erb'
10
10
  require 'ostruct'
@@ -161,14 +161,18 @@ module Tiller
161
161
  puts "Executing #{config['exec']}..."
162
162
 
163
163
  # Fork and wait so API can continue to run
164
- fork do
165
- system(config['exec'])
164
+ child_pid = fork do
165
+ exec(config['exec'])
166
166
  end
167
167
 
168
- puts "Child process forked." if config[:verbose]
169
- Process.wait
170
- puts "Child process finished, Tiller is stopping." if config[:verbose]
171
- end
168
+ puts "Child process forked with PID #{child_pid}." if config[:verbose]
169
+
170
+ # Catch signals and send them on to the child process
171
+ [ :INT, :TERM, :HUP ].each { |sig| Signal.trap(sig) { signal(sig, child_pid, config) } }
172
172
 
173
+ Process.wait(child_pid)
174
+
175
+ puts 'Child process finished, Tiller is stopping.' if config[:verbose]
176
+ end
173
177
 
174
178
  end
data/lib/tiller/api.rb CHANGED
@@ -54,10 +54,10 @@ def tiller_api(tiller_api_hash)
54
54
 
55
55
  # Response
56
56
  socket.print "HTTP/1.1 #{response[:status]}\r\n" +
57
- "Content-Type: application/json\r\n" +
58
- "Server: Tiller #{VERSION} / API v#{API_VERSION}\r\n"
59
- "Content-Length: #{response[:content].bytesize}\r\n" +
60
- "Connection: close\r\n"
57
+ "Content-Type: application/json\r\n" +
58
+ "Server: Tiller #{VERSION} / API v#{API_VERSION}\r\n"
59
+ "Content-Length: #{response[:content].bytesize}\r\n" +
60
+ "Connection: close\r\n"
61
61
  socket.print "\r\n"
62
62
  socket.print response[:content]
63
63
  socket.close
@@ -7,7 +7,7 @@ module Tiller
7
7
  # from the -e flag or set it to default_environment.
8
8
  :environment => (ENV['environment'].nil?) ? nil : ENV['environment'],
9
9
  # This can be overridden in common.yaml.
10
- 'default_environment' => 'production',
10
+ 'default_environment' => 'development',
11
11
  :no_exec => false,
12
12
  :verbose => false,
13
13
  'api_enable' => false,
data/lib/tiller/util.rb CHANGED
@@ -10,4 +10,14 @@ def warn_merge(key, old, new, type, source)
10
10
  puts "Warning, merging duplicate #{type} values."
11
11
  puts "#{key} => '#{old}' being replaced by : '#{new}' from #{source}"
12
12
  new
13
+ end
14
+
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]
18
+ begin
19
+ Process.kill(sig, pid)
20
+ rescue Errno::ESRCH
21
+ false
22
+ end
13
23
  end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
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-01-20 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A tool to create configuration files in Docker containers from a variety
14
- of sources. See https://github.com/markround/tiller for examples and documentation.
13
+ description: A tool to create configuration files from a variety of sources, particularly
14
+ useful for Docker containers. See https://github.com/markround/tiller for examples
15
+ and documentation.
15
16
  email: github@markround.com
16
17
  executables:
17
18
  - tiller
@@ -87,5 +88,5 @@ rubyforge_project:
87
88
  rubygems_version: 2.2.2
88
89
  signing_key:
89
90
  specification_version: 4
90
- summary: Dynamic configuration generation for Docker
91
+ summary: Dynamic configuration file generation
91
92
  test_files: []