tiller 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/tiller +1 -1
- data/lib/tiller/data/environment.rb +2 -0
- data/lib/tiller/data/file.rb +21 -3
- data/lib/tiller/datasource.rb +6 -0
- data/lib/tiller/defaults.rb +2 -1
- data/lib/tiller/loader.rb +10 -0
- data/lib/tiller/options.rb +3 -0
- data/lib/tiller/template/file.rb +3 -0
- data/lib/tiller/templatesource.rb +6 -0
- data/lib/tiller/util.rb +27 -0
- data/lib/tiller/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32429bd0fb6b6c9f3c012e74bb55f0ff52ba7c24
|
4
|
+
data.tar.gz: a8758eef551cca3b0df1fc548700e9f8b9f6c712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68551eaa414c82d97bcaed63412d8ea8cfbcd50a43b83536801f9160fecca459556b63b44cb729613ac613fd9e283a019e1769f4070d0520e6b9570f90855699
|
7
|
+
data.tar.gz: d6ba1f1b0ddd4a921bb314e268b325a44f60502d9d08186dccb611cc354f3910e91e470f712f88410677cad8fa80fb629666427826de780c941c1cf85d0a4780
|
data/bin/tiller
CHANGED
@@ -212,7 +212,7 @@ module Tiller
|
|
212
212
|
# Proper Ruby voodoo here.
|
213
213
|
# See http://stackoverflow.com/questions/19304135/deep-nest-a-value-into-a-hash-given-a-path-array for
|
214
214
|
# explanation.
|
215
|
-
tiller.
|
215
|
+
tiller.deep_merge!((path + [parsed_value]).reverse.reduce { |s,e| { e => s } })
|
216
216
|
end
|
217
217
|
end
|
218
218
|
target_values.each do |key ,value|
|
data/lib/tiller/data/file.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
class FileDataSource < Tiller::DataSource
|
4
|
+
|
5
|
+
@plugin_api_versions = [1, 2]
|
6
|
+
|
4
7
|
# Open and parse the environment file. Tries from v2 format common.yaml first, if that
|
5
8
|
# failes, then it looks for separate environment files.
|
6
9
|
def setup
|
@@ -41,11 +44,26 @@ class FileDataSource < Tiller::DataSource
|
|
41
44
|
end
|
42
45
|
|
43
46
|
def values(template_name)
|
44
|
-
|
47
|
+
if (Tiller::config['plugin_api_version'] == 2)
|
48
|
+
# Everything comes from the values method in V2
|
49
|
+
if @config_hash.key?(template_name)
|
50
|
+
all_values=[]
|
51
|
+
@config_hash[template_name].each { |values| all_values << values }
|
52
|
+
return all_values
|
53
|
+
end
|
54
|
+
else
|
55
|
+
return @config_hash.key?(template_name) ? @config_hash[template_name]['config'] : {}
|
56
|
+
end
|
57
|
+
|
45
58
|
end
|
46
59
|
|
47
60
|
def target_values(template_name)
|
48
|
-
|
49
|
-
|
61
|
+
if (Tiller::config['plugin_api_version'] == 2)
|
62
|
+
Tiller::log.fatal("Deprecated : We should never get here")
|
63
|
+
exit
|
64
|
+
else
|
65
|
+
return @config_hash.key?(template_name) ? @config_hash[template_name] : {}
|
66
|
+
end
|
50
67
|
end
|
68
|
+
|
51
69
|
end
|
data/lib/tiller/datasource.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tiller/util.rb'
|
2
|
+
|
1
3
|
# Tiller data source base class.
|
2
4
|
module Tiller
|
3
5
|
# Subclasses provide global_values and/or values (things local to a specific
|
@@ -5,6 +7,10 @@ module Tiller
|
|
5
7
|
# location, permissions, owner and so on)
|
6
8
|
class DataSource
|
7
9
|
|
10
|
+
include ClassLevelInheritableAttributes
|
11
|
+
inheritable_attributes :plugin_api_versions
|
12
|
+
@plugin_api_versions = [ 1 ]
|
13
|
+
|
8
14
|
def initialize
|
9
15
|
setup
|
10
16
|
end
|
data/lib/tiller/defaults.rb
CHANGED
data/lib/tiller/loader.rb
CHANGED
@@ -25,6 +25,16 @@ def loader(type,sources)
|
|
25
25
|
classes |= type.subclasses
|
26
26
|
end
|
27
27
|
|
28
|
+
# Versioning check - if any of the loaded modules do not support the specified API version, we stop immediately.
|
29
|
+
classes.each do |c|
|
30
|
+
api_version = Tiller::config['plugin_api_version']
|
31
|
+
if ! c.plugin_api_versions.include?(api_version)
|
32
|
+
Tiller::log.fatal("ERROR : Plugin #{c} does not support specified API version #{api_version}")
|
33
|
+
exit(EXIT_FAIL)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
28
38
|
classes
|
29
39
|
end
|
30
40
|
|
data/lib/tiller/options.rb
CHANGED
@@ -33,6 +33,9 @@ def parse_options(config)
|
|
33
33
|
opts.on('--md5sum-noexec', 'Do not execute a process if no templates were written or changed') do
|
34
34
|
config['md5sum_noexec'] = true
|
35
35
|
end
|
36
|
+
opts.on('--plugin-api-version [VERS]', 'Specify the plugin API version to use') do |plugin_api_version|
|
37
|
+
config['plugin_api_version'] = plugin_api_version
|
38
|
+
end
|
36
39
|
|
37
40
|
opts.on('-h', '--help', 'Display this screen') do
|
38
41
|
puts opts
|
data/lib/tiller/template/file.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
require 'tiller/util'
|
2
|
+
|
1
3
|
# Tiller template source base class
|
2
4
|
module Tiller
|
3
5
|
# Subclasses provide templates (an array), and individual template contents
|
4
6
|
# (a string containing ERB data)
|
5
7
|
class TemplateSource
|
6
8
|
|
9
|
+
include ClassLevelInheritableAttributes
|
10
|
+
inheritable_attributes :plugin_api_versions
|
11
|
+
@plugin_api_versions = [ 1 ]
|
12
|
+
|
7
13
|
def initialize
|
8
14
|
setup
|
9
15
|
end
|
data/lib/tiller/util.rb
CHANGED
@@ -68,4 +68,31 @@ def launch(cmd)
|
|
68
68
|
end
|
69
69
|
|
70
70
|
pid
|
71
|
+
end
|
72
|
+
|
73
|
+
# Module for inheritable attributes in data sources (e.g. api_version)
|
74
|
+
module ClassLevelInheritableAttributes
|
75
|
+
def self.included(base)
|
76
|
+
base.extend(ClassMethods)
|
77
|
+
end
|
78
|
+
|
79
|
+
module ClassMethods
|
80
|
+
def inheritable_attributes(*args)
|
81
|
+
@inheritable_attributes ||= [:inheritable_attributes]
|
82
|
+
@inheritable_attributes += args
|
83
|
+
args.each do |arg|
|
84
|
+
class_eval %(
|
85
|
+
class << self; attr_accessor :#{arg} end
|
86
|
+
)
|
87
|
+
end
|
88
|
+
@inheritable_attributes
|
89
|
+
end
|
90
|
+
|
91
|
+
def inherited(subclass)
|
92
|
+
@inheritable_attributes.each do |inheritable_attribute|
|
93
|
+
instance_var = "@#{inheritable_attribute}"
|
94
|
+
subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
71
98
|
end
|
data/lib/tiller/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.3.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:
|
11
|
+
date: 2018-04-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
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.14
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Dynamic configuration file generation
|