tiller 0.4.0 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbd7c351b404d9ad522229e387678dcfac6cc625
4
- data.tar.gz: 944655c1a9f52ff0385e8e56fe85cfc52a00751d
3
+ metadata.gz: 19b9c31a627b8be234e1222fada6dbfdcd5a0fd8
4
+ data.tar.gz: 306d86613d62bb5a8cbf93e423fa1ca92192fdbd
5
5
  SHA512:
6
- metadata.gz: 6362ad6e2febddbc0075e9fdbda50128bc27eca7b633efc0ca2903085c3a303acde1df32b8bdf7260bf35b6d75c493c19745ddf788387ecc280c318a3117670f
7
- data.tar.gz: f35071d852eb1e01eddfccdec52e8eeeb1b0321bc2b36cb6866c004e939ffa3130a97bedfe6750097d2f020a13285e20247b86e5ae1a3066e5f73a9b7ce78b9a
6
+ metadata.gz: b622b2787cad0505049358ceb99a7ed6fc3a6c9154fa6e9541b76876302add88d198995a825df32b98ecd069c2780d5687c7f52a51ee31cbdf37015c76c94656
7
+ data.tar.gz: d4700698a4537c923f899e834fd8c318d2ac2ad3385b3509b1570f7eeb14c236d9511487627cd3780cc315c4f153b2360def6925190c6de0467ea11480f9f652
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.4.0'
7
+ VERSION = '0.5.0'
8
8
 
9
9
  require 'erb'
10
10
  require 'ostruct'
@@ -74,6 +74,12 @@ module Tiller
74
74
  global_values.merge!(data_class.new(config).global_values) do |key, old, new|
75
75
  warn_merge(key, old, new, 'global', data_class.to_s)
76
76
  end
77
+
78
+ # Now need to see if any of the common.yaml values have been over-ridden by a datasource
79
+ # e.g. environment-specific execs and so on.
80
+ config.merge!(data_class.new(config).common) do |key, old, new|
81
+ warn_merge(key, old, new, 'common', data_class.to_s)
82
+ end
77
83
  end
78
84
 
79
85
  # Now we go through each template we've identified, and get the
@@ -160,10 +166,8 @@ module Tiller
160
166
  # All templates created, so let's start the replacement process
161
167
  puts "Executing #{config['exec']}..."
162
168
 
163
- # Fork and wait so API can continue to run
164
- child_pid = fork do
165
- exec(config['exec'])
166
- end
169
+ # Spawn and wait so API can continue to run
170
+ child_pid = spawn(config['exec'])
167
171
 
168
172
  puts "Child process forked with PID #{child_pid}." if config[:verbose]
169
173
 
@@ -1,5 +1,10 @@
1
1
  # Here is an example configuration file for your production environment.
2
2
 
3
+ # We override a setting from common.yaml for this environment.
4
+ common:
5
+ api_enable: true
6
+ exec: env
7
+
3
8
  # First, we define the values for an example sensu_client template :
4
9
  sensu_client.erb:
5
10
  target: /etc/sensu/conf.d/client.json
@@ -13,12 +13,16 @@ class FileDataSource < Tiller::DataSource
13
13
  @config_hash = YAML.load(open(env_file))
14
14
  end
15
15
 
16
+ def common
17
+ @config_hash.key?('common') ? @config_hash['common'] : {}
18
+ end
19
+
16
20
  def values(template_name)
17
- @config_hash.key?(template_name) ? @config_hash[template_name]['config'] : Hash.new
21
+ @config_hash.key?(template_name) ? @config_hash[template_name]['config'] : {}
18
22
  end
19
23
 
20
24
  def target_values(template_name)
21
25
  # The config element is redundant (not a target value)
22
- @config_hash.key?(template_name) ? @config_hash[template_name] : Hash.new
26
+ @config_hash.key?(template_name) ? @config_hash[template_name] : {}
23
27
  end
24
28
  end
@@ -18,14 +18,20 @@ module Tiller
18
18
  def setup
19
19
  end
20
20
 
21
+ # This is where we override any of the common.yaml settings per environment.
22
+ # EG, the exec: parameter and so on.
23
+ def common
24
+ {}
25
+ end
26
+
21
27
  def global_values
22
- Hash.new
28
+ {}
23
29
  end
24
30
 
25
31
  # We should always return a hash; if we have no data for the given
26
32
  # template, just return an empty hash.
27
33
  def values(_template_name)
28
- Hash.new
34
+ {}
29
35
  end
30
36
 
31
37
  # This should provide a hash similar to this example :
@@ -38,7 +44,7 @@ module Tiller
38
44
  # Again, we should always return a hash; if we have no data for the given
39
45
  # template, just return an empty hash.
40
46
  def target_values(_template_name)
41
- Hash.new
47
+ {}
42
48
  end
43
49
 
44
50
  def ping
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.4.0
4
+ version: 0.5.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-02-03 00:00:00.000000000 Z
11
+ date: 2015-03-16 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
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: '0'
80
+ version: 1.9.2
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="