corl 0.4.0 → 0.4.1
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.
- data/Gemfile +5 -10
- data/Gemfile.lock +13 -11
- data/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/corl +2 -54
- data/bootstrap/bootstrap.sh +91 -0
- data/bootstrap/lib/shell/LICENSE.txt +674 -0
- data/bootstrap/lib/shell/command.sh +214 -0
- data/bootstrap/lib/shell/filesystem.sh +139 -0
- data/bootstrap/lib/shell/load.sh +73 -0
- data/bootstrap/lib/shell/os.sh +67 -0
- data/bootstrap/lib/shell/script.sh +160 -0
- data/bootstrap/lib/shell/starter.sh +64 -0
- data/bootstrap/lib/shell/validators.sh +50 -0
- data/bootstrap/os/ubuntu/00_base.sh +5 -0
- data/bootstrap/os/ubuntu/01_git.sh +5 -0
- data/bootstrap/os/ubuntu/05_ruby.sh +7 -0
- data/bootstrap/os/ubuntu/06_puppet.sh +38 -0
- data/bootstrap/os/ubuntu/10_corl.sh +9 -0
- data/corl.gemspec +61 -124
- data/lib/{corl → CORL}/action/bootstrap.rb +13 -7
- data/lib/CORL/action/exec.rb +39 -0
- data/lib/CORL/action/image.rb +31 -0
- data/lib/{corl → CORL}/action/images.rb +1 -1
- data/lib/CORL/action/lookup.rb +34 -0
- data/lib/{corl → CORL}/action/machines.rb +1 -1
- data/lib/CORL/action/provision.rb +31 -0
- data/lib/{corl → CORL}/action/seed.rb +3 -3
- data/lib/{corl → CORL}/action/spawn.rb +2 -2
- data/lib/CORL/action/start.rb +31 -0
- data/lib/CORL/action/stop.rb +31 -0
- data/lib/{corl → CORL}/configuration/file.rb +1 -1
- data/lib/{corl → CORL}/event/puppet.rb +1 -1
- data/lib/{corl → CORL}/extension/puppetloader.rb +1 -1
- data/lib/{corl → CORL}/machine/fog.rb +3 -3
- data/lib/{corl → CORL}/machine/physical.rb +2 -2
- data/lib/{corl → CORL}/network/default.rb +1 -1
- data/lib/{corl → CORL}/node/aws.rb +0 -4
- data/lib/{corl → CORL}/node/google.rb +0 -4
- data/lib/{corl → CORL}/node/local.rb +1 -1
- data/lib/{corl → CORL}/node/rackspace.rb +0 -4
- data/lib/{corl → CORL}/provisioner/puppetnode.rb +1 -14
- data/lib/{corl → CORL}/provisioner/puppetnode/resource.rb +0 -0
- data/lib/{corl → CORL}/provisioner/puppetnode/resource_group.rb +0 -0
- data/lib/{corl → CORL}/template/environment.rb +1 -1
- data/lib/core/facade.rb +49 -0
- data/lib/{corl_core → core}/mixin/action/keypair.rb +10 -10
- data/lib/{corl_core → core}/mixin/lookup.rb +0 -0
- data/lib/{corl_core → core}/mod/hiera_backend.rb +0 -0
- data/lib/{corl_core/mixin/action/node.rb → core/plugin/action.rb} +66 -33
- data/lib/{corl_core → core}/plugin/configuration.rb +2 -2
- data/lib/{corl/node → core/plugin}/fog.rb +5 -1
- data/lib/{corl_core → core}/plugin/machine.rb +2 -2
- data/lib/{corl_core → core}/plugin/network.rb +4 -4
- data/lib/{corl_core → core}/plugin/node.rb +11 -9
- data/lib/{corl_core → core}/plugin/provisioner.rb +2 -2
- data/lib/{corl_core → core}/util/ssh.rb +1 -1
- data/lib/corl.rb +53 -112
- data/lib/puppet/parser/functions/ensure.rb +0 -4
- data/locales/en.yml +55 -148
- metadata +84 -222
- data/lib/corl/action/add.rb +0 -69
- data/lib/corl/action/clone.rb +0 -40
- data/lib/corl/action/create.rb +0 -55
- data/lib/corl/action/exec.rb +0 -41
- data/lib/corl/action/extract.rb +0 -49
- data/lib/corl/action/image.rb +0 -30
- data/lib/corl/action/lookup.rb +0 -35
- data/lib/corl/action/provision.rb +0 -37
- data/lib/corl/action/remove.rb +0 -51
- data/lib/corl/action/save.rb +0 -53
- data/lib/corl/action/start.rb +0 -37
- data/lib/corl/action/stop.rb +0 -30
- data/lib/corl/action/update.rb +0 -37
- data/lib/corl/command/shell.rb +0 -164
- data/lib/corl/event/regex.rb +0 -52
- data/lib/corl/project/git.rb +0 -465
- data/lib/corl/project/github.rb +0 -108
- data/lib/corl/template/json.rb +0 -16
- data/lib/corl/template/wrapper.rb +0 -16
- data/lib/corl/template/yaml.rb +0 -16
- data/lib/corl/translator/json.rb +0 -27
- data/lib/corl/translator/yaml.rb +0 -27
- data/lib/corl_core/codes.rb +0 -107
- data/lib/corl_core/config.rb +0 -337
- data/lib/corl_core/config/collection.rb +0 -57
- data/lib/corl_core/config/options.rb +0 -70
- data/lib/corl_core/core.rb +0 -59
- data/lib/corl_core/corl.rb +0 -254
- data/lib/corl_core/errors.rb +0 -84
- data/lib/corl_core/facade.rb +0 -126
- data/lib/corl_core/gems.rb +0 -72
- data/lib/corl_core/manager.rb +0 -425
- data/lib/corl_core/mixin/action/commit.rb +0 -58
- data/lib/corl_core/mixin/action/project.rb +0 -53
- data/lib/corl_core/mixin/action/push.rb +0 -52
- data/lib/corl_core/mixin/config/collection.rb +0 -53
- data/lib/corl_core/mixin/config/ops.rb +0 -53
- data/lib/corl_core/mixin/config/options.rb +0 -39
- data/lib/corl_core/mixin/macro/object_interface.rb +0 -361
- data/lib/corl_core/mixin/macro/plugin_interface.rb +0 -380
- data/lib/corl_core/mixin/settings.rb +0 -46
- data/lib/corl_core/mixin/sub_config.rb +0 -148
- data/lib/corl_core/mod/hash.rb +0 -29
- data/lib/corl_core/plugin/action.rb +0 -381
- data/lib/corl_core/plugin/base.rb +0 -374
- data/lib/corl_core/plugin/command.rb +0 -98
- data/lib/corl_core/plugin/event.rb +0 -53
- data/lib/corl_core/plugin/extension.rb +0 -12
- data/lib/corl_core/plugin/project.rb +0 -927
- data/lib/corl_core/plugin/template.rb +0 -80
- data/lib/corl_core/plugin/translator.rb +0 -38
- data/lib/corl_core/util/cli.rb +0 -352
- data/lib/corl_core/util/data.rb +0 -404
- data/lib/corl_core/util/disk.rb +0 -114
- data/lib/corl_core/util/git.rb +0 -47
- data/lib/corl_core/util/interface.rb +0 -319
- data/lib/corl_core/util/liquid.rb +0 -17
- data/lib/corl_core/util/package.rb +0 -93
- data/lib/corl_core/util/shell.rb +0 -239
- data/spec/corl_core/interface_spec.rb +0 -489
@@ -1,380 +0,0 @@
|
|
1
|
-
|
2
|
-
# Should be included via extend
|
3
|
-
#
|
4
|
-
# extend Mixin::Macro::PluginInterface
|
5
|
-
#
|
6
|
-
|
7
|
-
corl_require(File.dirname(__FILE__), :object_interface)
|
8
|
-
|
9
|
-
#---
|
10
|
-
|
11
|
-
module CORL
|
12
|
-
module Mixin
|
13
|
-
module Macro
|
14
|
-
module PluginInterface
|
15
|
-
|
16
|
-
include Macro::ObjectInterface
|
17
|
-
|
18
|
-
#-----------------------------------------------------------------------------
|
19
|
-
# Plugin collections
|
20
|
-
|
21
|
-
def plugin_collection(_type, _method_options = {})
|
22
|
-
_method_config = Config.ensure(_method_options)
|
23
|
-
_method_config.set(:plugin, true)
|
24
|
-
|
25
|
-
_plural = _method_config.init(:plural, "#{_type}s").get(:plural)
|
26
|
-
_search_proc = _method_config.get(:search_proc)
|
27
|
-
_single_instance = _method_config.get(:single_instance, false)
|
28
|
-
_plugin_type = _method_config.get(:plugin_type, _type)
|
29
|
-
|
30
|
-
@@object_types[_type] = _method_config
|
31
|
-
|
32
|
-
logger.debug("Creating new plugin collection #{_type} with: #{_method_config.inspect}")
|
33
|
-
|
34
|
-
#---------------------------------------------------------------------------
|
35
|
-
|
36
|
-
object_utilities
|
37
|
-
|
38
|
-
#---
|
39
|
-
|
40
|
-
unless respond_to? :each_plugin
|
41
|
-
logger.debug("Defining plugin interface method: each_plugin")
|
42
|
-
|
43
|
-
define_method :each_plugin do |plugin_types = nil, providers = nil, &code|
|
44
|
-
providers = [ providers ] if providers && ! providers.is_a?(Array)
|
45
|
-
|
46
|
-
filter_proc = Proc.new {|type, config| config[:plugin] }
|
47
|
-
each_object_type(plugin_types, filter_proc) do |type, plural, options|
|
48
|
-
logger.debug("Processing plugin type #{type}/#{plural} with: #{options.inspect}")
|
49
|
-
|
50
|
-
send(plural).each do |provider, plugins|
|
51
|
-
logger.debug("Processing plugin provider: #{provider}")
|
52
|
-
|
53
|
-
unless providers && ! providers.include?(provider)
|
54
|
-
if plugins.is_a?(Hash)
|
55
|
-
plugins.each do |name, plugin|
|
56
|
-
logger.debug("Processing plugin: #{name}")
|
57
|
-
code.call(type, provider, name, plugin)
|
58
|
-
end
|
59
|
-
else
|
60
|
-
logger.debug("Processing plugin: #{plugin.name}")
|
61
|
-
code.call(type, provider, plugin.name, plugin)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
#---
|
70
|
-
|
71
|
-
logger.debug("Defining plugin interface method: each_#{_type}")
|
72
|
-
|
73
|
-
define_method "each_#{_type}" do |providers = nil, &code|
|
74
|
-
each_plugin(_type, providers) do |type, provider, name, plugin|
|
75
|
-
code.call(provider, name, plugin)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
#---------------------------------------------------------------------------
|
80
|
-
|
81
|
-
logger.debug("Defining plugin interface method: #{_plural}")
|
82
|
-
|
83
|
-
define_method "#{_plural}" do |provider = nil, reset = false|
|
84
|
-
keys = ( provider ? [ _plural, provider ] : _plural )
|
85
|
-
send("init_#{_plural}", provider) if reset || _get(keys, {}).empty?
|
86
|
-
_get(keys, {})
|
87
|
-
end
|
88
|
-
|
89
|
-
#---
|
90
|
-
|
91
|
-
logger.debug("Defining plugin interface method: init_#{_plural}")
|
92
|
-
|
93
|
-
define_method "init_#{_plural}" do |providers = nil|
|
94
|
-
data = hash(_search_proc.call) if _search_proc
|
95
|
-
data = get_hash(_plural) unless data
|
96
|
-
|
97
|
-
providers = [ providers ] if providers && ! providers.is_a?(Array)
|
98
|
-
|
99
|
-
logger.debug("Initializing #{_plugin_type} plugin data: #{data.inspect}")
|
100
|
-
logger.debug("Providers: #{providers.inspect}")
|
101
|
-
|
102
|
-
symbol_map(data).each do |provider, instance_settings|
|
103
|
-
if ! providers || providers.include?(provider)
|
104
|
-
if _single_instance
|
105
|
-
logger.debug("Initializing single instance plugin: #{instance_settings.inspect}")
|
106
|
-
|
107
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(instance_settings).import({ :meta => { :parent => myself } }))
|
108
|
-
|
109
|
-
_set([ _plural, provider ], plugin)
|
110
|
-
else
|
111
|
-
instance_settings.each do |name, options|
|
112
|
-
if name != :settings
|
113
|
-
logger.debug("Initializing plugin #{_plugin_type} #{name}: #{options.inspect}")
|
114
|
-
|
115
|
-
options[:name] = name
|
116
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(options).import({ :meta => { :parent => myself } }))
|
117
|
-
|
118
|
-
_set([ _plural, provider, name ], plugin)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
#---
|
127
|
-
|
128
|
-
logger.debug("Defining plugin interface method: set_#{_plural}")
|
129
|
-
|
130
|
-
define_method "set_#{_plural}" do |data = {}|
|
131
|
-
data = Config.ensure(data).export
|
132
|
-
|
133
|
-
send("clear_#{_plural}")
|
134
|
-
set(_plural, data)
|
135
|
-
|
136
|
-
logger.debug("Setting #{_plural}")
|
137
|
-
|
138
|
-
data.each do |provider, instance_settings|
|
139
|
-
if _single_instance
|
140
|
-
logger.debug("Setting single #{_plugin_type} #{provider}: #{instance_settings.inspect}")
|
141
|
-
|
142
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(instance_settings).import({ :meta => { :parent => myself } }))
|
143
|
-
|
144
|
-
_set([ _plural, provider ], plugin)
|
145
|
-
else
|
146
|
-
instance_settings.each do |name, options|
|
147
|
-
logger.debug("Setting #{_plugin_type} #{provider} #{name}: #{options.inspect}")
|
148
|
-
|
149
|
-
options[:name] = name
|
150
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(options).import({ :meta => { :parent => myself } }))
|
151
|
-
|
152
|
-
_set([ _plural, provider, name ], plugin)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
#---
|
159
|
-
|
160
|
-
logger.debug("Defining plugin interface method: clear_#{_plural}")
|
161
|
-
|
162
|
-
define_method "clear_#{_plural}" do
|
163
|
-
get(_plural).keys.each do |provider|
|
164
|
-
logger.debug("Clearing #{_type} #{provider}")
|
165
|
-
|
166
|
-
if _single_instance
|
167
|
-
send("delete_#{_type}", provider)
|
168
|
-
else
|
169
|
-
get_hash([ _plural, provider ]).keys.each do |name|
|
170
|
-
send("delete_#{_type}", provider, name)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
#---------------------------------------------------------------------------
|
177
|
-
|
178
|
-
if _single_instance
|
179
|
-
logger.debug("Defining single instance plugin interface method: #{_type}_config")
|
180
|
-
|
181
|
-
define_method "#{_type}_config" do |provider = nil|
|
182
|
-
keys = [ _plural ]
|
183
|
-
keys << provider unless provider.nil?
|
184
|
-
Config.new(get(keys, {}))
|
185
|
-
end
|
186
|
-
|
187
|
-
#---
|
188
|
-
|
189
|
-
logger.debug("Defining single instance plugin interface method: #{_type}_setting")
|
190
|
-
|
191
|
-
define_method "#{_type}_setting" do |provider, property, default = nil, format = false|
|
192
|
-
get([ _plural, provider, property ], default, format)
|
193
|
-
end
|
194
|
-
|
195
|
-
#---
|
196
|
-
|
197
|
-
logger.debug("Defining single instance plugin interface method: #{_type}")
|
198
|
-
|
199
|
-
define_method "#{_type}" do |provider, reset = false|
|
200
|
-
if reset || _get([ _plural, provider ], nil).nil?
|
201
|
-
options = get([ _plural, provider ], nil)
|
202
|
-
|
203
|
-
unless options.nil?
|
204
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(options).import({ :meta => { :parent => myself } }))
|
205
|
-
|
206
|
-
logger.debug("Initializing plugin #{_plugin_type} #{provider}: #{options.inspect}")
|
207
|
-
|
208
|
-
_set([ _plural, provider ], plugin)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
_get([ _plural, provider ])
|
212
|
-
end
|
213
|
-
|
214
|
-
#---
|
215
|
-
|
216
|
-
logger.debug("Defining single instance plugin interface method: set_#{_type}")
|
217
|
-
|
218
|
-
define_method "set_#{_type}" do |provider, options = {}|
|
219
|
-
options = Config.ensure(options).export
|
220
|
-
|
221
|
-
set([ _plural, provider ], options)
|
222
|
-
|
223
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(options).import({ :meta => { :parent => myself } }))
|
224
|
-
|
225
|
-
logger.debug("Setting single #{_plugin_type} #{provider}: #{options.inspect}")
|
226
|
-
|
227
|
-
_set([ _plural, provider ], plugin)
|
228
|
-
plugin
|
229
|
-
end
|
230
|
-
|
231
|
-
#---
|
232
|
-
|
233
|
-
logger.debug("Defining single instance plugin interface method: set_#{_type}_setting")
|
234
|
-
|
235
|
-
define_method "set_#{_type}_setting" do |provider, property, value = nil|
|
236
|
-
logger.debug("Setting single #{provider} property #{property} to #{value.inspect}")
|
237
|
-
set([ _plural, provider, property ], value)
|
238
|
-
end
|
239
|
-
|
240
|
-
#---
|
241
|
-
|
242
|
-
logger.debug("Defining single instance plugin interface method: delete_#{_type}")
|
243
|
-
|
244
|
-
define_method "delete_#{_type}" do |provider|
|
245
|
-
plugin = send(_type, provider)
|
246
|
-
|
247
|
-
logger.debug("Deleting single #{_type} #{provider}")
|
248
|
-
|
249
|
-
delete([ _plural, provider ])
|
250
|
-
_delete([ _plural, provider ])
|
251
|
-
|
252
|
-
CORL.remove_plugin(plugin) unless plugin.nil?
|
253
|
-
end
|
254
|
-
|
255
|
-
#---
|
256
|
-
|
257
|
-
logger.debug("Defining single instance plugin interface method: delete_#{_type}_setting")
|
258
|
-
|
259
|
-
define_method "delete_#{_type}_setting" do |provider, property|
|
260
|
-
logger.debug("Deleting single #{provider} property: #{property}")
|
261
|
-
delete([ _plural, provider, property ])
|
262
|
-
end
|
263
|
-
|
264
|
-
#---
|
265
|
-
|
266
|
-
logger.debug("Defining single instance plugin interface method: search_#{_type}")
|
267
|
-
|
268
|
-
define_method "search_#{_type}" do |provider, keys, default = '', format = false|
|
269
|
-
plugin_config = send("#{_type}_config", provider)
|
270
|
-
logger.debug("Searching single #{_type} #{provider}: #{plugin_config.inspect}")
|
271
|
-
|
272
|
-
search_object(plugin_config, keys, default, format)
|
273
|
-
end
|
274
|
-
|
275
|
-
#---------------------------------------------------------------------------
|
276
|
-
else
|
277
|
-
logger.debug("Defining multi instance plugin interface method: #{_type}_config")
|
278
|
-
|
279
|
-
define_method "#{_type}_config" do |provider = nil, name = nil|
|
280
|
-
keys = [ _plural ]
|
281
|
-
keys << provider unless provider.nil?
|
282
|
-
keys << name unless name.nil?
|
283
|
-
Config.new(get(keys, {}))
|
284
|
-
end
|
285
|
-
|
286
|
-
#---
|
287
|
-
|
288
|
-
logger.debug("Defining multi instance plugin interface method: #{_type}_setting")
|
289
|
-
|
290
|
-
define_method "#{_type}_setting" do |provider, name, property, default = nil, format = false|
|
291
|
-
get([ _plural, provider, name, property ], default, format)
|
292
|
-
end
|
293
|
-
|
294
|
-
#---
|
295
|
-
|
296
|
-
logger.debug("Defining multi instance plugin interface method: #{_type}")
|
297
|
-
|
298
|
-
define_method "#{_type}" do |provider, name|
|
299
|
-
if reset || _get([ _plural, provider, name ], nil).nil?
|
300
|
-
options = get([ _plural, provider, name ], nil)
|
301
|
-
|
302
|
-
unless options.nil?
|
303
|
-
options[:name] = name
|
304
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(options).import({ :meta => { :parent => myself } }))
|
305
|
-
|
306
|
-
logger.debug("Initializing plugin #{_plugin_type} #{provider}: #{options.inspect}")
|
307
|
-
|
308
|
-
_set([ _plural, provider, name ], plugin)
|
309
|
-
end
|
310
|
-
end
|
311
|
-
_get([ _plural, provider, name ])
|
312
|
-
end
|
313
|
-
|
314
|
-
#---
|
315
|
-
|
316
|
-
logger.debug("Defining multi instance plugin interface method: set_#{_type}")
|
317
|
-
|
318
|
-
define_method "set_#{_type}" do |provider, name, options = {}|
|
319
|
-
options = Config.ensure(options).export
|
320
|
-
|
321
|
-
set([ _plural, provider, name ], options)
|
322
|
-
|
323
|
-
options[:name] = name
|
324
|
-
plugin = CORL.plugin(_plugin_type, provider, Config.ensure(options).import({ :meta => { :parent => myself } }))
|
325
|
-
|
326
|
-
logger.debug("Setting #{_plugin_type} #{provider} #{name}: #{options.inspect}")
|
327
|
-
|
328
|
-
_set([ _plural, provider, name ], plugin)
|
329
|
-
plugin
|
330
|
-
end
|
331
|
-
|
332
|
-
#---
|
333
|
-
|
334
|
-
logger.debug("Defining multi instance plugin interface method: set_#{_type}_setting")
|
335
|
-
|
336
|
-
define_method "set_#{_type}_setting" do |provider, name, property, value = nil|
|
337
|
-
logger.debug("Setting #{provider} #{name} property #{property} to #{value.inspect}")
|
338
|
-
set([ _plural, provider, name, property ], value)
|
339
|
-
end
|
340
|
-
|
341
|
-
#---
|
342
|
-
|
343
|
-
logger.debug("Defining multi instance plugin interface method: delete_#{_type}")
|
344
|
-
|
345
|
-
define_method "delete_#{_type}" do |provider, name|
|
346
|
-
plugin = send(_type, provider, name)
|
347
|
-
|
348
|
-
logger.debug("Deleting #{_type} #{provider} #{name}")
|
349
|
-
|
350
|
-
delete([ _plural, provider, name ])
|
351
|
-
_delete([ _plural, provider, name ])
|
352
|
-
|
353
|
-
CORL.remove_plugin(plugin) unless plugin.nil?
|
354
|
-
end
|
355
|
-
|
356
|
-
#---
|
357
|
-
|
358
|
-
logger.debug("Defining multi instance plugin interface method: delete_#{_type}_setting")
|
359
|
-
|
360
|
-
define_method "delete_#{_type}_setting" do |provider, name, property|
|
361
|
-
logger.debug("Deleting #{provider} #{name} property: #{property}")
|
362
|
-
delete([ _plural, provider, name, property ])
|
363
|
-
end
|
364
|
-
|
365
|
-
#---
|
366
|
-
|
367
|
-
logger.debug("Defining multi instance plugin interface method: search_#{_type}")
|
368
|
-
|
369
|
-
define_method "search_#{_type}" do |provider, name, keys, default = '', format = false|
|
370
|
-
plugin_config = send("#{_type}_config", provider, name)
|
371
|
-
logger.debug("Searching #{_type} #{provider} #{name}: #{plugin_config.inspect}")
|
372
|
-
|
373
|
-
search_object(plugin_config, keys, default, format)
|
374
|
-
end
|
375
|
-
end
|
376
|
-
end
|
377
|
-
end
|
378
|
-
end
|
379
|
-
end
|
380
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
|
2
|
-
# Should be included via include
|
3
|
-
#
|
4
|
-
# include Mixin::Settings
|
5
|
-
#
|
6
|
-
|
7
|
-
module CORL
|
8
|
-
module Mixin
|
9
|
-
module Settings
|
10
|
-
|
11
|
-
def settings(name)
|
12
|
-
return get_hash([ :settings, name ])
|
13
|
-
end
|
14
|
-
|
15
|
-
#---
|
16
|
-
|
17
|
-
def set_settings(name, settings = {})
|
18
|
-
return set([ :settings, name ], settings)
|
19
|
-
end
|
20
|
-
|
21
|
-
#---
|
22
|
-
|
23
|
-
def delete_settings(name)
|
24
|
-
return delete([ :settings, name ])
|
25
|
-
end
|
26
|
-
|
27
|
-
#---
|
28
|
-
|
29
|
-
def setting(name, key, default = '', format = false)
|
30
|
-
return get([ :settings, name, key ], default, format)
|
31
|
-
end
|
32
|
-
|
33
|
-
#---
|
34
|
-
|
35
|
-
def set_setting(name, key, value = '')
|
36
|
-
return set([ :settings, name, key ], value)
|
37
|
-
end
|
38
|
-
|
39
|
-
#---
|
40
|
-
|
41
|
-
def delete_setting(name, key)
|
42
|
-
return delete([ :settings, name, key ])
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
|
2
|
-
# Should be included via include
|
3
|
-
#
|
4
|
-
# include Mixin::SubConfig
|
5
|
-
#
|
6
|
-
|
7
|
-
module CORL
|
8
|
-
module Mixin
|
9
|
-
module SubConfig
|
10
|
-
|
11
|
-
#-----------------------------------------------------------------------------
|
12
|
-
# Initialization
|
13
|
-
|
14
|
-
def init_subconfig(reset = false)
|
15
|
-
return if @subconfig_initialized && ! reset
|
16
|
-
|
17
|
-
unless @config
|
18
|
-
@config = Config.new
|
19
|
-
end
|
20
|
-
|
21
|
-
@subconfig_initialized = true
|
22
|
-
end
|
23
|
-
protected :init_subconfig
|
24
|
-
|
25
|
-
#-----------------------------------------------------------------------------
|
26
|
-
# Propety accessors / modifiers
|
27
|
-
|
28
|
-
def config
|
29
|
-
return @config
|
30
|
-
end
|
31
|
-
|
32
|
-
#---
|
33
|
-
|
34
|
-
def config=config
|
35
|
-
@config = config
|
36
|
-
end
|
37
|
-
|
38
|
-
#-----------------------------------------------------------------------------
|
39
|
-
|
40
|
-
def _get(keys, default = nil, format = false)
|
41
|
-
return fetch(@properties, array(keys).flatten, default, format)
|
42
|
-
end
|
43
|
-
protected :_get
|
44
|
-
|
45
|
-
#---
|
46
|
-
|
47
|
-
def get(keys, default = nil, format = false)
|
48
|
-
init_subconfig
|
49
|
-
return config.get(keys, default, format)
|
50
|
-
end
|
51
|
-
|
52
|
-
#---
|
53
|
-
|
54
|
-
def _init(keys, default = nil)
|
55
|
-
return _set(keys, _get(keys, default))
|
56
|
-
end
|
57
|
-
protected :_init
|
58
|
-
|
59
|
-
#---
|
60
|
-
|
61
|
-
def _set(keys, value = '')
|
62
|
-
modify(@properties, array(keys).flatten, value)
|
63
|
-
end
|
64
|
-
protected :_set
|
65
|
-
|
66
|
-
#---
|
67
|
-
|
68
|
-
def set(keys, value = '')
|
69
|
-
init_subconfig
|
70
|
-
config.set(keys, value)
|
71
|
-
end
|
72
|
-
|
73
|
-
#---
|
74
|
-
|
75
|
-
def _delete(keys, default = nil)
|
76
|
-
existing = modify(@properties, array(keys).flatten, nil)
|
77
|
-
return existing[:value] if existing[:value]
|
78
|
-
return default
|
79
|
-
end
|
80
|
-
protected :_delete
|
81
|
-
|
82
|
-
#---
|
83
|
-
|
84
|
-
def delete(keys, default = nil)
|
85
|
-
init_subconfig
|
86
|
-
config.delete(keys, default)
|
87
|
-
end
|
88
|
-
|
89
|
-
#---
|
90
|
-
|
91
|
-
def _clear
|
92
|
-
@properties = {}
|
93
|
-
end
|
94
|
-
protected :_clear
|
95
|
-
|
96
|
-
#---
|
97
|
-
|
98
|
-
def clear
|
99
|
-
init_subconfig
|
100
|
-
config.clear
|
101
|
-
end
|
102
|
-
|
103
|
-
#-----------------------------------------------------------------------------
|
104
|
-
# Import / Export
|
105
|
-
|
106
|
-
def _import(properties, options = {})
|
107
|
-
return import_base(properties, options)
|
108
|
-
end
|
109
|
-
protected :_import
|
110
|
-
|
111
|
-
#---
|
112
|
-
|
113
|
-
def import(properties, options = {})
|
114
|
-
init_subconfig
|
115
|
-
config.import(properties, options)
|
116
|
-
end
|
117
|
-
|
118
|
-
#---
|
119
|
-
|
120
|
-
def _defaults(defaults, options = {})
|
121
|
-
config = new(options).set(:import_type, :default)
|
122
|
-
return import_base(defaults, config)
|
123
|
-
end
|
124
|
-
protected :_defaults
|
125
|
-
|
126
|
-
#---
|
127
|
-
|
128
|
-
def defaults(defaults, options = {})
|
129
|
-
init_subconfig
|
130
|
-
config.defaults(defaults, options)
|
131
|
-
end
|
132
|
-
|
133
|
-
#---
|
134
|
-
|
135
|
-
def _export
|
136
|
-
return @properties
|
137
|
-
end
|
138
|
-
protected :_export
|
139
|
-
|
140
|
-
#---
|
141
|
-
|
142
|
-
def export
|
143
|
-
init_subconfig
|
144
|
-
return config.export
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|