tiller 0.7.5 → 0.7.6

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: 229d9c3cbd2cff1fe603fe9d20db766e1a6bad96
4
- data.tar.gz: 0de31645801e2b972cd404c18cf4f41ea1d5bedd
3
+ metadata.gz: 27d12e01d34394a6fad400842d4aa83ebc197e3a
4
+ data.tar.gz: 0ee3df3eff85b7a044198b81722943fefde97207
5
5
  SHA512:
6
- metadata.gz: 949a96b21b1e35ca1eeecf02bec3b48ba9ec030151212e39d9d1713878bf5971d3c624909b71323fbb50b5a316328980ae8d3c6225ffdb8b9fdc852f7c00d048
7
- data.tar.gz: 2a00433767683191bb3c1caf52bdb074fa23486183027cffce2955fa026f924e05062e3645344efeedc133b038d5d8434bff477dd0bb9401fd898c84ce86f05a
6
+ metadata.gz: ef5413950dc0402cbcbad9d2644678e8f09977e0a06fc791eb4cbc612fd0d774a773a622b0dd06bc808f730aa2a4fc0be1f321c9563b9d80b99df7cae8e9ec3a
7
+ data.tar.gz: 05c0e4a79290f4defc0d7434363f992086bf49c0360147da85f9baaa57b4c20adaba00e4b7e402ca0ba51901cd94b429193f97f298ce41630b12f0f5b9b1f702
data/bin/tiller CHANGED
@@ -8,7 +8,7 @@
8
8
  #
9
9
  # Mark Dastmalchi-Round <github@markround.com>
10
10
 
11
- VERSION = '0.7.5'
11
+ VERSION = '0.7.6'
12
12
 
13
13
  require 'erb'
14
14
  require 'ostruct'
@@ -6,19 +6,50 @@ require 'json'
6
6
  require 'pp'
7
7
 
8
8
  class EnvironmentJsonDataSource < Tiller::DataSource
9
- def global_values
10
9
 
10
+ VERSION_KEY='_version'
11
+
12
+ def setup
11
13
  if ENV.has_key?('tiller_json')
12
14
  begin
13
- json_structure = JSON.parse(ENV['tiller_json'])
14
- json_structure if json_structure.is_a?(Hash)
15
+ parse = JSON.parse(ENV['tiller_json'])
16
+ @json_structure = parse.is_a?(Hash) ? parse : Hash.new
17
+ if @json_structure[VERSION_KEY].is_a? Integer
18
+ @json_version = @json_structure[VERSION_KEY]
19
+ @log.debug("Using v#{@json_version} tiller_json format")
20
+ else
21
+ @json_version = 1
22
+ end
15
23
  rescue JSON::ParserError
16
24
  @log.warn('Warning : Error parsing tiller_json environment variable')
17
- Hash.new
18
25
  end
19
26
  else
20
- Hash.new
27
+ @json_structure = Hash.new
28
+ end
29
+ end
30
+
31
+ def global_values
32
+ if @json_version < 2
33
+ @json_structure
34
+ else
35
+ if @json_structure.has_key?('global')
36
+ @json_structure['global']
37
+ else
38
+ Hash.new
39
+ end
40
+ end
41
+ end
42
+
43
+ def values(template_name)
44
+ if @json_version < 2
45
+ return Hash.new
21
46
  end
22
47
 
48
+ if @json_structure.has_key?(template_name)
49
+ return @json_structure[template_name]
50
+ else
51
+ return Hash.new
52
+ end
23
53
  end
54
+
24
55
  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.7.5
4
+ version: 0.7.6
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-02-08 00:00:00.000000000 Z
11
+ date: 2016-04-21 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
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 2.2.3
71
+ rubygems_version: 2.5.1
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: Dynamic configuration file generation