tiller 0.8.0 → 0.9.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: acd35e1f4954ea1c60fd5c27ea63f44fe7400eba
4
- data.tar.gz: 2ec16005714189cbad10709a98a742f35fa944a4
3
+ metadata.gz: 863e5fa4f42ff7b9f95b538713df8c282e4fcde9
4
+ data.tar.gz: a5259605f1bad247aaf50f800a62a4d6be5fddbe
5
5
  SHA512:
6
- metadata.gz: 0987e16d81c94e21d111a35c3241a4522cad991cbcbf65818be9966a9f82f0f3b2940ecb71f11a739dd515cbaebae1536985e85520eef31ec2efe7f0c173356b
7
- data.tar.gz: 6471f8c24b1465510fb800f2ce3fc22a281ecbc2e13ea8aef968090397ee782473a2ee0bed58a3d2dc7ceea2ce790de4bc25d0147f6ac192b998c39e946fdf39
6
+ metadata.gz: 0be54f3062d330ef4e78a65d53ba43a700a9e64dc3c2875d42fa4e504d82a8a93dfc78a9fb36d4244757cdafd46d64e642d3968e41d96c995063e258fd0637c6
7
+ data.tar.gz: a1db215909d38d3d6fb3238d51ac0cced43e0a1ce6fd391aa6d28da3bb1d1b8be6ee4f8b9352ade90901cb0f7a65f6acb0d6d1b58cbadaa60af922ffa6b4eeb0
data/bin/tiller CHANGED
@@ -8,8 +8,6 @@
8
8
  #
9
9
  # Mark Dastmalchi-Round <github@markround.com>
10
10
 
11
- VERSION = '0.8.0'
12
-
13
11
  require 'erb'
14
12
  require 'ostruct'
15
13
  require 'yaml'
@@ -28,6 +26,7 @@ require 'tiller/datasource'
28
26
  require 'tiller/logger'
29
27
  require 'digest/md5'
30
28
  require 'tiller/render'
29
+ require 'tiller/version'
31
30
 
32
31
  EXIT_SUCCESS = 0
33
32
 
@@ -82,12 +81,10 @@ module Tiller
82
81
  log.info('Helper modules loaded ' + helper_modules.to_s)
83
82
  end
84
83
 
85
- # Now go through all our data sources and start to assemble our global_values
86
- # hash. As hashes are getting merged, new values will take precedence over
87
- # older ones, and a warning will be displayed.
88
- # We also add in 'environment' to start with as it's very useful for all
89
- # templates.
84
+ # We now don't actually use the global_values hash for anything when constructing the templates (as they can be
85
+ # over-ridden by template values), but it's here to keep compatibility with the v1 API.
90
86
  global_values = { 'environment' => config[:environment] }
87
+
91
88
  data_classes.each do |data_class|
92
89
  # Now need to see if any of the common.yaml values have been over-ridden by a datasource
93
90
  # e.g. environment-specific execs and so on. We do this first so that connection strings
@@ -97,9 +94,8 @@ module Tiller
97
94
  warn_merge(key, old, new, 'common', data_class.to_s)
98
95
  end
99
96
 
100
- global_values.merge!(data_class.new.global_values) do |key, old, new|
101
- warn_merge(key, old, new, 'global', data_class.to_s)
102
- end
97
+ # Merge for the sake of the v1 API
98
+ global_values.merge!(data_class.new.global_values)
103
99
  end
104
100
 
105
101
  # Get all Templates for the given environment
@@ -119,16 +115,24 @@ module Tiller
119
115
  skipped_templates = 0
120
116
  updated_templates = 0
121
117
 
122
- templates.each do |template, content|
118
+ templates.each do |template, _content|
123
119
 
124
- # Start with a hash of our global values
125
- Tiller:: tiller = Hash.new.merge(global_values)
126
- target_values = {}
120
+ # We add in 'environment' to start with as it's very useful for all
121
+ # templates.
122
+ Tiller::tiller = { 'environment' => config[:environment] }
123
+ target_values = {}
127
124
 
128
125
  # Now we add to the 'tiller' hash with values from each DataSource, warning if we
129
126
  # get duplicate values.
130
127
  data_classes.each do |data_class|
131
128
  dc = data_class.new
129
+
130
+ # First take the global values from the datasource
131
+ tiller.merge!(data_class.new.global_values) do |key, old, new|
132
+ warn_merge(key, old, new, 'data', data_class.to_s)
133
+ end
134
+
135
+ # Then merge template values over the top of them
132
136
  if dc.values(template) != nil
133
137
  tiller.merge!(dc.values(template)) do |key, old, new|
134
138
  warn_merge(key, old, new, 'data', data_class.to_s)
@@ -149,7 +153,7 @@ module Tiller
149
153
  # Now, we build the template
150
154
  log.info("Building template #{template}")
151
155
 
152
- # Use our re-usable render tag
156
+ # Use our re-usable render helper
153
157
  parsed_template = Tiller::render(template)
154
158
 
155
159
  # Write the template, and also create the directory path if it
data/lib/tiller/api.rb CHANGED
@@ -8,7 +8,7 @@ require 'tiller/api/handlers/templates'
8
8
  require 'tiller/api/handlers/template'
9
9
 
10
10
 
11
- API_VERSION=1
11
+ API_VERSION=2
12
12
 
13
13
  # The following is a VERY simple HTTP API, used for querying the status of Tiller
14
14
  # after it has generated templates and forked a child process.
@@ -3,7 +3,7 @@ require 'tiller/api/handlers/404'
3
3
 
4
4
  def handle_config(api_version, tiller_api_hash)
5
5
  case api_version
6
- when 'v1'
6
+ when 'v1','v2'
7
7
  {
8
8
  :content => dump_json(tiller_api_hash['config']),
9
9
  :status => '200 OK'
@@ -3,7 +3,7 @@ require 'tiller/api/handlers/404'
3
3
 
4
4
  def handle_template(api_version, tiller_api_hash, template)
5
5
  case api_version
6
- when 'v1'
6
+ when 'v1','v2'
7
7
  if tiller_api_hash['templates'].has_key?(template)
8
8
  {
9
9
  :content => dump_json(tiller_api_hash['templates'][template]),
@@ -3,7 +3,7 @@ require 'tiller/api/handlers/404'
3
3
 
4
4
  def handle_templates(api_version, tiller_api_hash)
5
5
  case api_version
6
- when 'v1'
6
+ when 'v1','v2'
7
7
  {
8
8
  :content => dump_json(tiller_api_hash['templates'].keys),
9
9
  :status => '200 OK'
@@ -0,0 +1 @@
1
+ VERSION="0.9.0"
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.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Dastmalchi-Round
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-07-10 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
@@ -52,6 +52,7 @@ files:
52
52
  - lib/tiller/template/zookeeper.rb
53
53
  - lib/tiller/templatesource.rb
54
54
  - lib/tiller/util.rb
55
+ - lib/tiller/version.rb
55
56
  homepage: http://www.markround.com/blog/categories/tiller/
56
57
  licenses:
57
58
  - MIT