corl 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bootstrap/os/ubuntu/06_puppet.sh +1 -0
- data/corl.gemspec +4 -4
- data/lib/CORL/builder/identity.rb +3 -1
- data/lib/CORL/builder/package.rb +4 -2
- data/lib/CORL/builder/project.rb +5 -2
- data/lib/CORL/provisioner/puppetnode.rb +6 -3
- data/lib/core/mixin/lookup.rb +95 -95
- data/lib/core/plugin/builder.rb +15 -15
- data/lib/core/plugin/provisioner.rb +5 -6
- data/lib/core/util/puppet/resource.rb +3 -1
- data/lib/nucleon/action/network/remote.rb +0 -1
- data/lib/nucleon/action/node/build.rb +1 -0
- data/lib/nucleon/action/node/lookup.rb +12 -11
- data/lib/nucleon/action/node/provision.rb +28 -30
- data/lib/nucleon/action/node/seed.rb +1 -1
- data/locales/en.yml +2 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc7a511170c0e91c68ae57a550072a617f5b4033
|
4
|
+
data.tar.gz: 31ff4a2fbcc4b93ebff9bfe1e0ee00835f97c920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e53ad83f7cf959433903538e80e913aca1c03450f23ab77a01f8d272a3076db8df60407925995fe4f3431a83102181e90c7112d21037146298d235f0721a9807
|
7
|
+
data.tar.gz: cc31911b9991ec5f67cd8b7779a2bdc8866e95c61f49024c1668da09bf6b7d3fa40127b3c9b6bad8a7c7e5128bf25a5f0ddd62a957777d29c84fc6f67a8ccdb6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.13
|
data/corl.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: corl 0.5.
|
5
|
+
# stub: corl 0.5.13 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "corl"
|
9
|
-
s.version = "0.5.
|
9
|
+
s.version = "0.5.13"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Adrian Webb"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-02-03"
|
15
15
|
s.description = "Framework that provides a simple foundation for growing organically in the cloud"
|
16
16
|
s.email = "adrian.webb@coralnexus.com"
|
17
17
|
s.executables = ["corl"]
|
@@ -176,7 +176,7 @@ Gem::Specification.new do |s|
|
|
176
176
|
s.rdoc_options = ["--title", "Coral Orchestration and Research Library", "--main", "README.rdoc", "--line-numbers"]
|
177
177
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
|
178
178
|
s.rubyforge_project = "corl"
|
179
|
-
s.rubygems_version = "2.4.
|
179
|
+
s.rubygems_version = "2.4.5"
|
180
180
|
s.summary = "Coral Orchestration and Research Library"
|
181
181
|
|
182
182
|
if s.respond_to? :specification_version then
|
@@ -32,14 +32,16 @@ class Identity < Nucleon.plugin_class(:CORL, :builder)
|
|
32
32
|
#-----------------------------------------------------------------------------
|
33
33
|
# Identity interface operations
|
34
34
|
|
35
|
-
def build_provider(name, project_reference, environment)
|
35
|
+
def build_provider(name, project_reference, environment, options = {})
|
36
36
|
provider_id = id(name)
|
37
37
|
directory = File.join(internal_path(build_directory), provider_id.to_s)
|
38
|
+
config = Config.ensure(options)
|
38
39
|
success = true
|
39
40
|
|
40
41
|
info("Building identity #{blue(name)} at #{purple(project_reference)} into #{green(directory)}", { :i18n => false })
|
41
42
|
|
42
43
|
full_directory = File.join(network.directory, directory)
|
44
|
+
FileUtils.rm_rf(full_directory) if config.get(:clean, false)
|
43
45
|
|
44
46
|
unless identities.has_key?(provider_id)
|
45
47
|
project = build_config.manage(:project, extended_config(:identity, {
|
data/lib/CORL/builder/package.rb
CHANGED
@@ -32,14 +32,16 @@ class Package < Nucleon.plugin_class(:CORL, :builder)
|
|
32
32
|
#-----------------------------------------------------------------------------
|
33
33
|
# Package interface operations
|
34
34
|
|
35
|
-
def build_provider(name, project_reference, environment)
|
35
|
+
def build_provider(name, project_reference, environment, options = {})
|
36
36
|
provider_id = id(name)
|
37
37
|
directory = File.join(internal_path(build_directory), provider_id.to_s)
|
38
|
+
config = Config.ensure(options)
|
38
39
|
success = true
|
39
40
|
|
40
41
|
info("Building package #{blue(name)} at #{purple(project_reference)} into #{green(directory)}", { :i18n => false })
|
41
42
|
|
42
43
|
full_directory = File.join(network.directory, directory)
|
44
|
+
FileUtils.rm_rf(full_directory) if config.get(:clean, false)
|
43
45
|
|
44
46
|
unless packages.has_key?(provider_id)
|
45
47
|
project = build_config.manage(:configuration, extended_config(:package, {
|
@@ -62,7 +64,7 @@ class Package < Nucleon.plugin_class(:CORL, :builder)
|
|
62
64
|
if project.get([ :builders, plugin_provider ], false)
|
63
65
|
sub_packages = process_environment(project.get_hash([ :builders, plugin_provider ]), environment)
|
64
66
|
|
65
|
-
status = parallel(:build_provider, sub_packages, environment)
|
67
|
+
status = parallel(:build_provider, sub_packages, environment, config)
|
66
68
|
success = false if status.values.include?(false)
|
67
69
|
end
|
68
70
|
end
|
data/lib/CORL/builder/project.rb
CHANGED
@@ -6,14 +6,17 @@ class Project < Nucleon.plugin_class(:CORL, :builder)
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Project interface operations
|
8
8
|
|
9
|
-
def build_provider(provider_path, project_reference, environment)
|
9
|
+
def build_provider(provider_path, project_reference, environment, options = {})
|
10
|
+
config = Config.ensure(options)
|
10
11
|
path = provider_path.to_s
|
11
12
|
success = true
|
12
13
|
|
13
14
|
info("Building project #{purple(project_reference)} into #{green(path)}", { :i18n => false })
|
14
15
|
|
15
16
|
full_directory = File.join(network.directory, path)
|
16
|
-
|
17
|
+
FileUtils.rm_rf(full_directory) if config.get(:clean, false)
|
18
|
+
|
19
|
+
project = build_config.manage(:project, extended_config(:project, {
|
17
20
|
:directory => full_directory,
|
18
21
|
:url => project_reference,
|
19
22
|
:create => File.directory?(full_directory) ? false : true,
|
@@ -144,7 +144,7 @@ class Puppetnode < Nucleon.plugin_class(:CORL, :provisioner)
|
|
144
144
|
#-----------------------------------------------------------------------------
|
145
145
|
# Provisioner interface operations
|
146
146
|
|
147
|
-
def build_profile(name, info, package, environment, profiles)
|
147
|
+
def build_profile(name, info, package, environment, profiles, options = {})
|
148
148
|
super do |processed_info|
|
149
149
|
package_id = id(package)
|
150
150
|
directory = File.join(internal_path(build_directory), package_id.to_s, name.to_s)
|
@@ -153,7 +153,7 @@ class Puppetnode < Nucleon.plugin_class(:CORL, :provisioner)
|
|
153
153
|
#info("Building CORL profile #{blue(name)} modules into #{green(directory)}", { :i18n => false })
|
154
154
|
|
155
155
|
if processed_info.has_key?(:modules)
|
156
|
-
status = parallel(:build_module, hash(processed_info[:modules]), directory, name, environment)
|
156
|
+
status = parallel(:build_module, hash(processed_info[:modules]), directory, name, environment, options)
|
157
157
|
success = status.values.include?(false) ? false : true
|
158
158
|
|
159
159
|
build_config.set_location(:puppet_module, profile_id(package, name), directory) if success
|
@@ -163,12 +163,15 @@ class Puppetnode < Nucleon.plugin_class(:CORL, :provisioner)
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
def build_module(name, project_reference, directory, profile, environment)
|
166
|
+
def build_module(name, project_reference, directory, profile, environment, options = {})
|
167
|
+
config = Config.ensure(options)
|
167
168
|
module_directory = File.join(directory, name.to_s)
|
168
169
|
full_module_directory = File.join(network.directory, module_directory)
|
169
170
|
module_project = nil
|
170
171
|
success = true
|
171
172
|
|
173
|
+
FileUtils.rm_rf(full_module_directory) if config.get(:clean, false)
|
174
|
+
|
172
175
|
info("Building #{blue(profile)} Puppet module #{blue(name)} at #{purple(project_reference)} into #{green(module_directory)}", { :i18n => false })
|
173
176
|
|
174
177
|
module_project = build_config.manage(:project, extended_config(:puppet_module, {
|
data/lib/core/mixin/lookup.rb
CHANGED
@@ -5,97 +5,97 @@ module Lookup
|
|
5
5
|
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Facter lookup
|
8
|
-
|
8
|
+
|
9
9
|
@@facts = nil
|
10
|
-
|
10
|
+
|
11
11
|
def fact_var
|
12
12
|
@@facts
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def fact_var=facts
|
16
16
|
@@facts = facts
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
#---
|
20
|
-
|
20
|
+
|
21
21
|
def facts(reset = false, clone = true) # Override if needed. (See node plugin)
|
22
22
|
self.fact_var = CORL.facts if reset || fact_var.nil?
|
23
23
|
return fact_var.clone if clone
|
24
24
|
fact_var
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
#---
|
28
|
-
|
28
|
+
|
29
29
|
def create_facts(data, reset = false)
|
30
30
|
facts(reset, false)
|
31
|
-
|
32
|
-
data = hash(data)
|
31
|
+
|
32
|
+
data = hash(data)
|
33
33
|
data.each do |name, value|
|
34
34
|
fact_var[name.to_sym] = value
|
35
35
|
end
|
36
36
|
create_facts_post(fact_var.clone, data.keys)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def create_facts_post(data, names)
|
40
40
|
data
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
#---
|
44
|
-
|
44
|
+
|
45
45
|
def delete_facts(names, reset = false)
|
46
46
|
facts(reset, false)
|
47
|
-
|
47
|
+
|
48
48
|
names = [ names ] unless names.is_a?(Array)
|
49
49
|
data = {}
|
50
|
-
|
50
|
+
|
51
51
|
names.each do |name|
|
52
52
|
name = name.to_sym
|
53
53
|
data[name] = fact_var.delete(name)
|
54
54
|
end
|
55
55
|
delete_facts_post(fact_var.clone, data)
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def delete_facts_post(data, old_data)
|
59
|
-
data
|
59
|
+
data
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
#---
|
63
|
-
|
63
|
+
|
64
64
|
def fact(name, reset = false)
|
65
65
|
facts(reset, false)
|
66
66
|
fact_var[name.to_sym]
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
#-----------------------------------------------------------------------------
|
70
70
|
# Hiera configuration
|
71
|
-
|
71
|
+
|
72
72
|
@@hiera = nil
|
73
|
-
|
73
|
+
|
74
74
|
def hiera_var
|
75
75
|
@@hiera
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
def hiera_var=hiera
|
79
79
|
@@hiera = hiera
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
#---
|
83
|
-
|
83
|
+
|
84
84
|
def hiera_override_dir
|
85
85
|
nil # Override if needed. (See network and node plugins)
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
#---
|
89
|
-
|
89
|
+
|
90
90
|
def hiera_lookup_prefix
|
91
91
|
'::'
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
#---
|
95
|
-
|
95
|
+
|
96
96
|
def hiera_configuration(local_facts = {})
|
97
97
|
Kernel.load File.join(File.dirname(__FILE__), '..', 'mod', 'hiera_backend.rb')
|
98
|
-
|
98
|
+
|
99
99
|
backends = CORL.value(:hiera_backends, [ "json", "yaml" ])
|
100
100
|
config_file = CORL.value(:hiera_config_file, File.join(Hiera::Util.config_dir, 'hiera.yaml'))
|
101
101
|
config = {}
|
@@ -103,21 +103,21 @@ module Lookup
|
|
103
103
|
if CORL.admin? && config_file && File.exist?(config_file)
|
104
104
|
config = Hiera::Config.load(config_file)
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
# Need some way to tell if we have installed our own Hiera configuration.
|
108
108
|
# TODO: Figure something else out. This is bad.
|
109
109
|
config = {} if config[:merge_behavior] == :native
|
110
|
-
|
110
|
+
|
111
111
|
config[:logger] = :corl
|
112
|
-
|
112
|
+
|
113
113
|
unless config[:merge_behavior]
|
114
114
|
config[:merge_behavior] = "deeper"
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
unless config[:backends]
|
118
118
|
config[:backends] = backends
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
if override_dir = hiera_override_dir
|
122
122
|
backends.each do |backend|
|
123
123
|
if config[:backends].include?(backend)
|
@@ -127,44 +127,44 @@ module Lookup
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
hiera_config = CORL.config(:hiera, config)
|
132
132
|
loaded_facts = Util::Data.prefix(hiera_lookup_prefix, local_facts, '')
|
133
|
-
|
133
|
+
|
134
134
|
if hiera_config[:hierarchy]
|
135
135
|
hiera_config[:hierarchy].delete('common')
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
unless loaded_facts.empty?
|
139
|
-
hiera_config[:hierarchy].collect! do |search|
|
139
|
+
hiera_config[:hierarchy].collect! do |search|
|
140
140
|
Hiera::Interpolate.interpolate(search, loaded_facts, {})
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
unless hiera_config[:hierarchy]
|
145
145
|
hiera_config[:hierarchy] = [ 'common' ]
|
146
146
|
end
|
147
147
|
unless hiera_config[:hierarchy].include?('common')
|
148
148
|
hiera_config[:hierarchy] << 'common'
|
149
149
|
end
|
150
|
-
|
150
|
+
|
151
151
|
hiera_config[:hierarchy].each_with_index do |path, index|
|
152
152
|
hiera_config[:hierarchy][index] = path.gsub('//', '/')
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
hiera_config.export
|
156
156
|
end
|
157
|
-
|
157
|
+
|
158
158
|
#---
|
159
159
|
|
160
160
|
def hiera(reset = false)
|
161
161
|
self.hiera_var = Hiera.new(:config => hiera_configuration(facts(reset))) if reset || hiera_var.nil?
|
162
162
|
hiera_var
|
163
163
|
end
|
164
|
-
|
164
|
+
|
165
165
|
#-----------------------------------------------------------------------------
|
166
166
|
# Configuration lookup interface
|
167
|
-
|
167
|
+
|
168
168
|
def config_initialized?
|
169
169
|
ready = false
|
170
170
|
if hiera
|
@@ -178,59 +178,59 @@ module Lookup
|
|
178
178
|
end
|
179
179
|
ready
|
180
180
|
end
|
181
|
-
|
181
|
+
|
182
182
|
#---
|
183
|
-
|
183
|
+
|
184
184
|
def lookup_base(properties, default = nil, options = {})
|
185
185
|
config = Config.new(Config.ensure(options).export)
|
186
186
|
value = nil
|
187
|
-
|
187
|
+
|
188
188
|
node = config.delete(:node, nil)
|
189
|
-
|
189
|
+
|
190
190
|
provisioner = config.get(:provisioner, nil)
|
191
|
-
|
191
|
+
|
192
192
|
hiera_scope = config.get(:hiera_scope, {})
|
193
193
|
override = config.get(:override, nil)
|
194
194
|
context = config.get(:context, :priority)
|
195
|
-
debug = config.get(:debug, false)
|
196
|
-
|
195
|
+
debug = config.get(:debug, false)
|
196
|
+
|
197
197
|
return_property = config.get(:return_property, false)
|
198
|
-
|
198
|
+
|
199
199
|
return node.lookup(properties, default, config) if node
|
200
|
-
|
200
|
+
|
201
201
|
unless properties.is_a?(Array)
|
202
202
|
properties = [ properties ].flatten
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
first_property = nil
|
206
206
|
properties.each do |property|
|
207
207
|
property = property.to_sym
|
208
208
|
first_property = property unless first_property
|
209
|
-
|
209
|
+
|
210
210
|
if debug
|
211
211
|
CORL.ui.info("\n", { :prefix => false })
|
212
212
|
CORL.ui_group(Util::Console.purple(property)) do |ui|
|
213
213
|
ui.info("-----------------------------------------------------")
|
214
214
|
end
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
# Try to load facts first (these can not be overridden)
|
218
218
|
value = fact(property)
|
219
219
|
debug_lookup(config, property, value, "Fact lookup")
|
220
|
-
|
220
|
+
|
221
221
|
unless value
|
222
222
|
if config_initialized?
|
223
223
|
# Try to find in Hiera data store
|
224
224
|
unless hiera_scope.respond_to?('[]')
|
225
225
|
hiera_scope = Hiera::Scope.new(hiera_scope)
|
226
226
|
end
|
227
|
-
|
227
|
+
|
228
228
|
hiera_scope = string_map(hiera_scope) if hiera_scope.is_a?(Hash)
|
229
|
-
value = hiera.lookup(property.to_s, nil, hiera_scope, override, context)
|
230
|
-
|
229
|
+
value = hiera.lookup(property.to_s, nil, hiera_scope, override, context.to_sym)
|
230
|
+
|
231
231
|
debug_lookup(config, property, value, "Hiera lookup")
|
232
|
-
end
|
233
|
-
|
232
|
+
end
|
233
|
+
|
234
234
|
if provisioner && value.nil?
|
235
235
|
# Search the provisioner scope (only admins can provision a machine)
|
236
236
|
value = CORL.provisioner({ :name => :lookup }, provisioner).lookup(property, default, config)
|
@@ -243,90 +243,90 @@ module Lookup
|
|
243
243
|
debug_lookup(config, first_property, value, "Default value")
|
244
244
|
end
|
245
245
|
value = Util::Data.value(value, config.get(:undefined_value, :undefined))
|
246
|
-
|
246
|
+
|
247
247
|
if Config.get_property(first_property).nil? || value
|
248
248
|
Config.set_property(first_property, value)
|
249
249
|
end
|
250
|
-
|
250
|
+
|
251
251
|
debug_lookup(config, first_property, value, 'Internalized value')
|
252
|
-
|
252
|
+
|
253
253
|
if return_property
|
254
254
|
return value, first_property
|
255
255
|
end
|
256
256
|
CORL.ui.info("\n", { :prefix => false }) if debug
|
257
257
|
value
|
258
258
|
end
|
259
|
-
|
259
|
+
|
260
260
|
#---
|
261
|
-
|
261
|
+
|
262
262
|
def lookup(properties, default = nil, options = {})
|
263
263
|
lookup_base(properties, default, options)
|
264
264
|
end
|
265
|
-
|
265
|
+
|
266
266
|
#---
|
267
|
-
|
267
|
+
|
268
268
|
def lookup_array(properties, default = [], options = {})
|
269
|
-
config = Config.ensure(options).defaults({ :basic => false })
|
269
|
+
config = Config.ensure(options).defaults({ :basic => false })
|
270
270
|
value, property = lookup(properties, nil, config.import({ :return_property => true, :context => :array }))
|
271
|
-
|
271
|
+
|
272
272
|
if Util::Data.undef?(value)
|
273
273
|
value = default
|
274
274
|
debug_lookup(config, property, value, "Array default value")
|
275
|
-
|
275
|
+
|
276
276
|
elsif ! Util::Data.empty?(default)
|
277
277
|
if config.get(:merge, false)
|
278
278
|
value = Util::Data.merge([default, value], config)
|
279
279
|
debug_lookup(config, property, value, "Merged array value with default")
|
280
280
|
end
|
281
281
|
end
|
282
|
-
|
282
|
+
|
283
283
|
unless value.is_a?(Array)
|
284
284
|
value = ( Util::Data.empty?(value) ? [] : [ value ] )
|
285
285
|
end
|
286
|
-
|
286
|
+
|
287
287
|
value = Util::Data.value(value, config.get(:undefined_value, :undefined))
|
288
288
|
debug_lookup(config, property, value, "Final array value")
|
289
|
-
|
289
|
+
|
290
290
|
Config.set_property(property, value)
|
291
291
|
CORL.ui.info("\n", { :prefix => false }) if config.get(:debug, false)
|
292
292
|
value
|
293
293
|
end
|
294
|
-
|
294
|
+
|
295
295
|
#---
|
296
|
-
|
296
|
+
|
297
297
|
def lookup_hash(properties, default = {}, options = {})
|
298
|
-
config = Config.ensure(options).defaults({ :basic => false })
|
298
|
+
config = Config.ensure(options).defaults({ :basic => false })
|
299
299
|
value, property = lookup(properties, nil, config.import({ :return_property => true, :context => :hash }))
|
300
|
-
|
300
|
+
|
301
301
|
if Util::Data.undef?(value)
|
302
302
|
value = default
|
303
303
|
debug_lookup(config, property, value, "Hash default value")
|
304
|
-
|
304
|
+
|
305
305
|
elsif ! Util::Data.empty?(default)
|
306
306
|
if config.get(:merge, false)
|
307
307
|
value = Util::Data.merge([default, value], config)
|
308
308
|
debug_lookup(config, property, value, "Merged hash value with default")
|
309
309
|
end
|
310
310
|
end
|
311
|
-
|
311
|
+
|
312
312
|
unless value.is_a?(Hash)
|
313
313
|
value = ( Util::Data.empty?(value) ? {} : { :value => value } )
|
314
314
|
end
|
315
|
-
|
315
|
+
|
316
316
|
value = Util::Data.value(value, config.get(:undefined_value, :undefined))
|
317
317
|
debug_lookup(config, property, value, "Final hash value")
|
318
|
-
|
318
|
+
|
319
319
|
Config.set_property(property, value)
|
320
320
|
CORL.ui.info("\n", { :prefix => false }) if config.get(:debug, false)
|
321
321
|
value
|
322
322
|
end
|
323
|
-
|
323
|
+
|
324
324
|
#---
|
325
325
|
|
326
326
|
def normalize(data, override = nil, options = {})
|
327
327
|
config = Config.ensure(options).import({ :context => :hash }).defaults({ :basic => false })
|
328
328
|
results = {}
|
329
|
-
|
329
|
+
|
330
330
|
unless Util::Data.undef?(override)
|
331
331
|
case data
|
332
332
|
when String, Symbol
|
@@ -337,11 +337,11 @@ module Lookup
|
|
337
337
|
data = [ data, override ]
|
338
338
|
end
|
339
339
|
end
|
340
|
-
|
340
|
+
|
341
341
|
case data
|
342
342
|
when String, Symbol
|
343
343
|
results = lookup(data.to_s, {}, config)
|
344
|
-
|
344
|
+
|
345
345
|
when Array
|
346
346
|
data.each do |item|
|
347
347
|
if item.is_a?(String) || item.is_a?(Symbol)
|
@@ -351,25 +351,25 @@ module Lookup
|
|
351
351
|
results = Util::Data.merge([ results, item ], config)
|
352
352
|
end
|
353
353
|
end
|
354
|
-
|
354
|
+
|
355
355
|
when Hash
|
356
356
|
results = data
|
357
|
-
end
|
357
|
+
end
|
358
358
|
results
|
359
359
|
end
|
360
|
-
|
360
|
+
|
361
361
|
#---
|
362
|
-
|
362
|
+
|
363
363
|
def debug_lookup(config, property, value, label)
|
364
364
|
if config.get(:debug, false)
|
365
365
|
CORL.ui_group(Util::Console.cyan(property.to_s)) do |ui|
|
366
366
|
dump = Util::Console.green(Util::Data.to_json(value, true))
|
367
|
-
|
367
|
+
|
368
368
|
if dump.match(/\n+/)
|
369
|
-
ui.info("#{label}:\n#{dump}")
|
369
|
+
ui.info("#{label}:\n#{dump}")
|
370
370
|
else
|
371
|
-
ui.info("#{label}: #{dump}")
|
372
|
-
end
|
371
|
+
ui.info("#{label}: #{dump}")
|
372
|
+
end
|
373
373
|
end
|
374
374
|
end
|
375
375
|
end
|
data/lib/core/plugin/builder.rb
CHANGED
@@ -2,20 +2,20 @@
|
|
2
2
|
module CORL
|
3
3
|
module Plugin
|
4
4
|
class Builder < Nucleon.plugin_class(:nucleon, :base)
|
5
|
-
|
5
|
+
|
6
6
|
include Parallel
|
7
|
-
|
7
|
+
|
8
8
|
extend Mixin::Builder::Global
|
9
9
|
include Mixin::Builder::Instance
|
10
|
-
|
10
|
+
|
11
11
|
#-----------------------------------------------------------------------------
|
12
12
|
# Builder plugin interface
|
13
|
-
|
13
|
+
|
14
14
|
def normalize(reload)
|
15
15
|
super
|
16
16
|
yield if block_given?
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
#-----------------------------------------------------------------------------
|
20
20
|
# Checks
|
21
21
|
|
@@ -23,24 +23,24 @@ class Builder < Nucleon.plugin_class(:nucleon, :base)
|
|
23
23
|
# Property accessors / modifiers
|
24
24
|
|
25
25
|
network_settings :builder
|
26
|
-
|
26
|
+
|
27
27
|
#-----------------------------------------------------------------------------
|
28
28
|
# Builder operations
|
29
|
-
|
29
|
+
|
30
30
|
def build(node, options = {})
|
31
|
-
config = Config.ensure(options)
|
31
|
+
config = Config.ensure(options)
|
32
32
|
environment = Util::Data.ensure_value(config[:environment], node.lookup(:corl_environment))
|
33
|
-
configuration = process_environment(export, environment)
|
34
|
-
|
33
|
+
configuration = process_environment(export, environment)
|
34
|
+
|
35
35
|
FileUtils.mkdir_p(build_directory)
|
36
|
-
|
37
|
-
status = parallel(:build_provider, configuration, environment)
|
36
|
+
|
37
|
+
status = parallel(:build_provider, configuration, environment, config)
|
38
38
|
status.values.include?(false) ? false : true
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
#---
|
42
|
-
|
43
|
-
def build_provider(name, project_reference, environment)
|
42
|
+
|
43
|
+
def build_provider(name, project_reference, environment, config)
|
44
44
|
# Implement in sub classes
|
45
45
|
true
|
46
46
|
end
|
@@ -194,7 +194,7 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
194
194
|
|
195
195
|
FileUtils.mkdir_p(build_directory)
|
196
196
|
|
197
|
-
status = parallel(:build_provider, provider_info, environment, combined_info)
|
197
|
+
status = parallel(:build_provider, provider_info, environment, combined_info, config)
|
198
198
|
success = status.values.include?(false) ? false : true
|
199
199
|
|
200
200
|
if success
|
@@ -209,13 +209,13 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
209
209
|
|
210
210
|
#---
|
211
211
|
|
212
|
-
def build_provider(package, info, environment, combined_info)
|
212
|
+
def build_provider(package, info, environment, combined_info, options = {})
|
213
213
|
profiles = hash(info[:profiles])
|
214
|
-
status
|
214
|
+
status = parallel(:build_profile, profiles, id(package), environment, hash(combined_info[:profiles]), options)
|
215
215
|
status.values.include?(false) ? false : true
|
216
216
|
end
|
217
217
|
|
218
|
-
def build_profile(name, info, package, environment, profiles)
|
218
|
+
def build_profile(name, info, package, environment, profiles, options = {})
|
219
219
|
parents = []
|
220
220
|
config = Config.new(info, {}, true, false)
|
221
221
|
success = true
|
@@ -223,7 +223,6 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
223
223
|
while config.has_key?(:extend) do
|
224
224
|
array(config.delete(:extend)).each do |parent|
|
225
225
|
parent = profile_id(package, parent) unless parent.match('::')
|
226
|
-
|
227
226
|
parents << parent
|
228
227
|
config.defaults(profiles[parent.to_sym])
|
229
228
|
end
|
@@ -231,7 +230,7 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
231
230
|
|
232
231
|
build_config.set_dependency(:profile, profile_id(package, name), parents)
|
233
232
|
|
234
|
-
success = yield(process_environment(
|
233
|
+
success = yield(process_environment(info, environment), options) if block_given?
|
235
234
|
success
|
236
235
|
end
|
237
236
|
|
@@ -134,7 +134,9 @@ class Resource < Core
|
|
134
134
|
config.set(:interpolate_template, config.get("interpolate_#{target}", true))
|
135
135
|
|
136
136
|
input_data = resource[target]
|
137
|
-
|
137
|
+
plugin = CORL.template(config.import({ :new => true }), resource[name])
|
138
|
+
resource[target] = plugin.render(input_data)
|
139
|
+
CORL.remove_plugin(plugin)
|
138
140
|
|
139
141
|
if config.get(:debug, false)
|
140
142
|
CORL.ui.info("\n", { :prefix => false })
|
@@ -54,7 +54,6 @@ class Remote < CORL.plugin_class(:nucleon, :cloud_action)
|
|
54
54
|
provider = $1
|
55
55
|
end
|
56
56
|
|
57
|
-
Nucleon::Plugin::Project.store_provider(project.directory, provider)
|
58
57
|
myself.status = code.push_failure unless push(project)
|
59
58
|
else
|
60
59
|
myself.status = code.project_failure
|
@@ -3,17 +3,17 @@ module Nucleon
|
|
3
3
|
module Action
|
4
4
|
module Node
|
5
5
|
class Lookup < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
11
|
super(:node, :lookup, 565)
|
12
12
|
end
|
13
13
|
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
18
|
super do
|
19
19
|
register :properties, :array, []
|
@@ -26,37 +26,38 @@ class Lookup < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
26
26
|
end
|
27
27
|
success
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
register_translator :format, :json
|
31
|
+
register_bool :debug, false
|
31
32
|
end
|
32
33
|
end
|
33
|
-
|
34
|
+
|
34
35
|
#---
|
35
|
-
|
36
|
+
|
36
37
|
def arguments
|
37
38
|
[ :properties ]
|
38
39
|
end
|
39
40
|
|
40
41
|
#-----------------------------------------------------------------------------
|
41
42
|
# Operations
|
42
|
-
|
43
|
+
|
43
44
|
def execute
|
44
45
|
super do |node|
|
45
46
|
ensure_node(node) do
|
46
47
|
translator = CORL.translator({}, settings[:format])
|
47
|
-
|
48
|
+
|
48
49
|
if settings[:properties].empty?
|
49
50
|
myself.result = node.hiera_configuration(node.facts)
|
50
51
|
$stderr.puts translator.generate(result)
|
51
52
|
else
|
52
53
|
properties = {}
|
53
|
-
|
54
|
+
|
54
55
|
settings.delete(:properties).each do |property|
|
55
56
|
properties[property] = node.lookup(property, nil, settings)
|
56
57
|
end
|
57
58
|
$stderr.puts translator.generate(properties)
|
58
|
-
myself.result = properties
|
59
|
-
end
|
59
|
+
myself.result = properties
|
60
|
+
end
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
@@ -46,43 +46,41 @@ class Provision < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
46
46
|
CORL.create_fact(:corl_environment, settings[:environment])
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
49
|
+
unless settings[:check_profiles]
|
50
|
+
info('start', { :provider => node.plugin_provider, :name => node.plugin_name })
|
51
|
+
end
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
if settings[:build] ||
|
54
|
+
settings.has_key?(:environment) ||
|
55
|
+
! ( node.build_time && File.directory?(network.build_directory) )
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
info('build', { :provider => node.plugin_provider, :name => node.plugin_name })
|
58
|
+
success = node.build(settings)
|
59
|
+
end
|
60
|
+
|
61
|
+
if success
|
62
|
+
provisioner_info = node.provisioner_info
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
unless settings[:check_profiles]
|
75
|
-
profile_success = provisioner.provision(node, supported_profiles, settings)
|
76
|
-
success = false unless profile_success
|
77
|
-
end
|
64
|
+
node.provisioners.each do |provider, collection|
|
65
|
+
provider_info = provisioner_info[provider]
|
66
|
+
profiles = provider_info[:profiles]
|
67
|
+
|
68
|
+
collection.each do |name, provisioner|
|
69
|
+
if supported_profiles = provisioner.supported_profiles(node, profiles)
|
70
|
+
provisioner.profile_dependencies(node, supported_profiles).each do |profile|
|
71
|
+
info('profile', { :provider => yellow(provider), :profile => green(profile.to_s) })
|
72
|
+
end
|
73
|
+
if CORL.admin? && ! settings[:check_profiles]
|
74
|
+
profile_success = provisioner.provision(node, supported_profiles, settings)
|
75
|
+
success = false unless profile_success
|
78
76
|
end
|
79
77
|
end
|
80
78
|
end
|
81
|
-
unless settings[:check_profiles]
|
82
|
-
success('complete', { :provider => node.plugin_provider, :name => node.plugin_name, :time => Time.now.to_s }) if success
|
83
|
-
end
|
84
|
-
myself.status = code.provision_failure unless success
|
85
79
|
end
|
80
|
+
unless settings[:check_profiles]
|
81
|
+
success('complete', { :provider => node.plugin_provider, :name => node.plugin_name, :time => Time.now.to_s }) if success
|
82
|
+
end
|
83
|
+
myself.status = code.provision_failure unless success
|
86
84
|
end
|
87
85
|
end
|
88
86
|
end
|
@@ -58,7 +58,7 @@ class Seed < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
58
58
|
project_info = Config.new({ :provider => :git }, {}, true, false)
|
59
59
|
end
|
60
60
|
|
61
|
-
project_class.
|
61
|
+
project_class.clear_project_info(network_path)
|
62
62
|
|
63
63
|
info('backup')
|
64
64
|
FileUtils.rm_rf(backup_path)
|
data/locales/en.yml
CHANGED
@@ -574,6 +574,8 @@ en:
|
|
574
574
|
Environment to build (default %{default_value})
|
575
575
|
providers: |-
|
576
576
|
List of builder plugin providers to run build process for (default %{default_value})
|
577
|
+
clean: |-
|
578
|
+
Wipe build directories before building and start fresh (default %{default_value})
|
577
579
|
info:
|
578
580
|
start: |-
|
579
581
|
Building network dependencies
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Webb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nucleon
|
@@ -355,9 +355,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
355
|
version: '0'
|
356
356
|
requirements: []
|
357
357
|
rubyforge_project: corl
|
358
|
-
rubygems_version: 2.4.
|
358
|
+
rubygems_version: 2.4.5
|
359
359
|
signing_key:
|
360
360
|
specification_version: 4
|
361
361
|
summary: Coral Orchestration and Research Library
|
362
362
|
test_files: []
|
363
|
-
has_rdoc:
|