corl 0.5.6 → 0.5.7
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.
- checksums.yaml +4 -4
- data/.gitignore +10 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -0
- data/README.rdoc +125 -517
- data/Rakefile +57 -0
- data/VERSION +1 -1
- data/bootstrap/os/ubuntu/00_base.sh +10 -7
- data/bootstrap/os/ubuntu/05_ruby.sh +4 -4
- data/corl.gemspec +32 -5
- data/info/AUTOMATION.rdoc +5 -0
- data/info/INSTALLATION.rdoc +163 -0
- data/info/PACKAGING.rdoc +171 -0
- data/info/PLUGINS.rdoc +57 -0
- data/info/TODO.rdoc +27 -0
- data/lib/CORL/configuration/file.rb +2 -2
- data/lib/CORL/machine/docker.rb +327 -0
- data/lib/CORL/machine/vagrant.rb +142 -107
- data/lib/CORL/node/docker.rb +269 -0
- data/lib/CORL/node/vagrant.rb +23 -0
- data/lib/CORL/provisioner/puppetnode.rb +52 -27
- data/lib/core/facade.rb +36 -34
- data/lib/core/mixin/builder.rb +44 -44
- data/lib/core/mixin/machine/ssh.rb +34 -34
- data/lib/core/mod/vagrant.rb +32 -0
- data/lib/core/plugin/cloud_action.rb +1 -1
- data/lib/core/plugin/machine.rb +85 -85
- data/lib/core/plugin/network.rb +23 -9
- data/lib/core/plugin/node.rb +10 -7
- data/lib/core/plugin/provisioner.rb +3 -3
- data/lib/core/vagrant/action.rb +15 -13
- data/lib/core/vagrant/actions/include_overrides.rb +17 -0
- data/lib/core/vagrant/actions/init_keys.rb +9 -5
- data/lib/core/vagrant/commands/launcher.rb +1 -1
- data/lib/core/vagrant/config.rb +343 -143
- data/lib/core/vagrant/plugins.rb +14 -14
- data/lib/corl.rb +3 -7
- data/lib/nucleon/action/node/provision.rb +15 -4
- data/lib/nucleon/action/node/seed.rb +2 -2
- data/lib/nucleon/extension/vagrant.rb +30 -0
- data/locales/en.yml +5 -0
- data/rdoc/site/0.5.7/README.rdoc +595 -0
- data/rdoc/site/0.5.7/info/AUTOMATION.rdoc +382 -0
- data/rdoc/site/0.5.7/info/INSTALLATION.rdoc +543 -0
- data/rdoc/site/0.5.7/info/PACKAGES.rdoc +556 -0
- data/rdoc/site/0.5.7/info/PACKAGING.rdoc +563 -0
- data/rdoc/site/0.5.7/info/PLUGINS.rdoc +534 -0
- data/rdoc/site/0.5.7/info/TODO.rdoc +412 -0
- data/tmp/README.rdoc +217 -0
- data/tmp/info/AUTOMATION.rdoc +6 -0
- data/tmp/info/INSTALLATION.rdoc +158 -0
- data/tmp/info/PACKAGES.rdoc +177 -0
- data/tmp/info/PACKAGING.rdoc +184 -0
- data/tmp/info/PLUGINS.rdoc +129 -0
- data/tmp/info/README.rdoc +217 -0
- data/tmp/info/TODO.rdoc +36 -0
- metadata +41 -3
- data/TODO.rdoc +0 -12
@@ -120,7 +120,7 @@ class CloudAction < Nucleon.plugin_class(:nucleon, :action)
|
|
120
120
|
if network && network.has_nodes? && ! settings[:nodes].empty?
|
121
121
|
# Execute action on remote nodes
|
122
122
|
success = network.batch(settings[:nodes], settings[:node_provider], settings[:parallel]) do |node|
|
123
|
-
exec_config = Config.new(settings)
|
123
|
+
exec_config = Config.new(settings, {}, true, false)
|
124
124
|
exec_config.delete(:nodes)
|
125
125
|
|
126
126
|
result = node.action(plugin_provider, exec_config) do |op, data|
|
data/lib/core/plugin/machine.rb
CHANGED
@@ -2,181 +2,181 @@
|
|
2
2
|
module CORL
|
3
3
|
module Plugin
|
4
4
|
class Machine < Nucleon.plugin_class(:nucleon, :base)
|
5
|
-
|
5
|
+
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Checks
|
8
|
-
|
8
|
+
|
9
9
|
def created?
|
10
10
|
false
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
#---
|
14
|
-
|
14
|
+
|
15
15
|
def running?
|
16
16
|
( created? && false )
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
#-----------------------------------------------------------------------------
|
20
20
|
# Property accessors / modifiers
|
21
|
-
|
21
|
+
|
22
22
|
def node
|
23
23
|
plugin_parent
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def node=node
|
27
27
|
myself.plugin_parent = node
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
#---
|
31
|
-
|
31
|
+
|
32
32
|
def state
|
33
33
|
nil
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
#---
|
37
|
-
|
37
|
+
|
38
38
|
def hostname
|
39
39
|
nil
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
#---
|
43
|
-
|
43
|
+
|
44
44
|
def public_ip
|
45
45
|
nil
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
#---
|
49
|
-
|
49
|
+
|
50
50
|
def private_ip
|
51
51
|
nil
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
#---
|
55
|
-
|
55
|
+
|
56
56
|
def machine_types
|
57
57
|
[]
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
#---
|
61
|
-
|
61
|
+
|
62
62
|
def machine_type
|
63
63
|
nil
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
#---
|
67
|
-
|
67
|
+
|
68
68
|
def images
|
69
69
|
[]
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
#---
|
73
|
-
|
73
|
+
|
74
74
|
def image
|
75
75
|
nil
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
#-----------------------------------------------------------------------------
|
79
79
|
# Management
|
80
|
-
|
80
|
+
|
81
81
|
def load
|
82
82
|
success = true
|
83
|
-
|
83
|
+
|
84
84
|
logger.debug("Loading #{plugin_provider} machine: #{plugin_name}")
|
85
|
-
success = yield if block_given?
|
86
|
-
|
85
|
+
success = yield if block_given?
|
86
|
+
|
87
87
|
logger.warn("There was an error loading the machine #{plugin_name}") unless success
|
88
88
|
success
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
#---
|
92
|
-
|
92
|
+
|
93
93
|
def create(options = {})
|
94
94
|
success = true
|
95
|
-
|
95
|
+
|
96
96
|
if created?
|
97
97
|
logger.debug("Machine #{plugin_name} already exists")
|
98
98
|
else
|
99
99
|
logger.debug("Creating #{plugin_provider} machine with: #{options.inspect}")
|
100
100
|
config = Config.ensure(options)
|
101
|
-
success = yield(config) if block_given?
|
101
|
+
success = yield(config) if block_given?
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
logger.warn("There was an error creating the machine #{plugin_name}") unless success
|
105
105
|
success
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
#---
|
109
|
-
|
109
|
+
|
110
110
|
def download(remote_path, local_path, options = {})
|
111
111
|
success = true
|
112
|
-
|
112
|
+
|
113
113
|
if running?
|
114
114
|
logger.debug("Downloading #{local_path} from #{remote_path} on #{plugin_provider} machine with: #{options.inspect}")
|
115
|
-
config = Config.ensure(options)
|
115
|
+
config = Config.ensure(options)
|
116
116
|
success = yield(config, success) if block_given?
|
117
117
|
else
|
118
|
-
logger.debug("Machine #{plugin_name} is not running")
|
118
|
+
logger.debug("Machine #{plugin_name} is not running")
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
logger.warn("There was an error downloading from the machine #{plugin_name}") unless success
|
122
122
|
success
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
#---
|
126
|
-
|
126
|
+
|
127
127
|
def upload(local_path, remote_path, options = {})
|
128
128
|
success = true
|
129
|
-
|
129
|
+
|
130
130
|
if running?
|
131
131
|
logger.debug("Uploading #{local_path} to #{remote_path} on #{plugin_provider} machine with: #{options.inspect}")
|
132
|
-
config = Config.ensure(options)
|
132
|
+
config = Config.ensure(options)
|
133
133
|
success = yield(config, success) if block_given?
|
134
134
|
else
|
135
|
-
logger.debug("Machine #{plugin_name} is not running")
|
135
|
+
logger.debug("Machine #{plugin_name} is not running")
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
logger.warn("There was an error uploading to the machine #{plugin_name}") unless success
|
139
139
|
success
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
#---
|
143
|
-
|
143
|
+
|
144
144
|
def exec(commands, options = {})
|
145
145
|
results = []
|
146
|
-
|
146
|
+
|
147
147
|
if running?
|
148
148
|
logger.info("Executing commands ( #{commands.inspect} ) on machine #{plugin_name}")
|
149
|
-
config = Config.ensure(options)
|
149
|
+
config = Config.ensure(options)
|
150
150
|
results = yield(config, results) if block_given?
|
151
151
|
else
|
152
|
-
logger.debug("Machine #{plugin_name} is not running")
|
152
|
+
logger.debug("Machine #{plugin_name} is not running")
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
logger.warn("There was an error executing command on the machine #{plugin_name}") unless results
|
156
156
|
results
|
157
157
|
end
|
158
|
-
|
158
|
+
|
159
159
|
#---
|
160
|
-
|
160
|
+
|
161
161
|
def terminal(user, options = {})
|
162
162
|
status = code.unknown_status
|
163
|
-
|
163
|
+
|
164
164
|
if running?
|
165
165
|
logger.debug("Launching #{user} terminal on #{plugin_provider} machine with: #{options.inspect}")
|
166
|
-
config = Config.ensure(options)
|
166
|
+
config = Config.ensure(options)
|
167
167
|
status = yield(config) if block_given?
|
168
168
|
else
|
169
|
-
logger.debug("Machine #{plugin_name} is not running")
|
170
|
-
end
|
169
|
+
logger.debug("Machine #{plugin_name} is not running")
|
170
|
+
end
|
171
171
|
logger.warn("There was an error launching a #{user} terminal on the machine #{plugin_name}") unless status == code.success
|
172
172
|
status
|
173
173
|
end
|
174
|
-
|
174
|
+
|
175
175
|
#---
|
176
|
-
|
176
|
+
|
177
177
|
def reload(options = {})
|
178
178
|
success = true
|
179
|
-
|
179
|
+
|
180
180
|
if created?
|
181
181
|
logger.debug("Reloading #{plugin_provider} machine with: #{options.inspect}")
|
182
182
|
config = Config.ensure(options)
|
@@ -184,72 +184,72 @@ class Machine < Nucleon.plugin_class(:nucleon, :base)
|
|
184
184
|
else
|
185
185
|
logger.debug("Machine #{plugin_name} does not yet exist")
|
186
186
|
end
|
187
|
-
|
187
|
+
|
188
188
|
logger.warn("There was an error reloading the machine #{plugin_name}") unless success
|
189
189
|
success
|
190
190
|
end
|
191
191
|
|
192
192
|
#---
|
193
|
-
|
193
|
+
|
194
194
|
def create_image(options = {})
|
195
195
|
success = true
|
196
|
-
|
196
|
+
|
197
197
|
if running?
|
198
198
|
logger.debug("Creating image of #{plugin_provider} machine with: #{options.inspect}")
|
199
|
-
config = Config.ensure(options)
|
199
|
+
config = Config.ensure(options)
|
200
200
|
success = yield(config) if block_given?
|
201
201
|
else
|
202
|
-
logger.debug("Machine #{plugin_name} is not running")
|
202
|
+
logger.debug("Machine #{plugin_name} is not running")
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
logger.warn("There was an error creating an image of the machine #{plugin_name}") unless success
|
206
206
|
success
|
207
207
|
end
|
208
208
|
|
209
209
|
#---
|
210
|
-
|
210
|
+
|
211
211
|
def stop(options = {})
|
212
212
|
success = true
|
213
|
-
|
213
|
+
|
214
214
|
if running?
|
215
215
|
logger.debug("Stopping #{plugin_provider} machine with: #{options.inspect}")
|
216
|
-
config = Config.ensure(options)
|
216
|
+
config = Config.ensure(options)
|
217
217
|
success = yield(config) if block_given?
|
218
218
|
else
|
219
|
-
logger.debug("Machine #{plugin_name} is not running")
|
219
|
+
logger.debug("Machine #{plugin_name} is not running")
|
220
220
|
end
|
221
|
-
|
221
|
+
|
222
222
|
logger.warn("There was an error stopping the machine #{plugin_name}") unless success
|
223
223
|
success
|
224
224
|
end
|
225
|
-
|
225
|
+
|
226
226
|
#---
|
227
|
-
|
227
|
+
|
228
228
|
def start(options = {})
|
229
229
|
success = true
|
230
|
-
|
230
|
+
|
231
231
|
if running?
|
232
|
-
logger.debug("Machine #{plugin_name} is already running")
|
232
|
+
logger.debug("Machine #{plugin_name} is already running")
|
233
233
|
else
|
234
234
|
logger.debug("Starting #{plugin_provider} machine with: #{options.inspect}")
|
235
|
-
|
235
|
+
|
236
236
|
logger.debug("Machine #{plugin_name} is not running yet")
|
237
237
|
if block_given?
|
238
|
-
success = yield(config)
|
238
|
+
success = yield(config)
|
239
239
|
else
|
240
|
-
success = create(options)
|
241
|
-
end
|
240
|
+
success = create(options)
|
241
|
+
end
|
242
242
|
end
|
243
|
-
|
243
|
+
|
244
244
|
logger.warn("There was an error starting the machine #{plugin_name}") unless success
|
245
245
|
success
|
246
246
|
end
|
247
|
-
|
247
|
+
|
248
248
|
#---
|
249
249
|
|
250
|
-
def destroy(options = {})
|
250
|
+
def destroy(options = {})
|
251
251
|
success = true
|
252
|
-
|
252
|
+
|
253
253
|
if created?
|
254
254
|
logger.debug("Destroying #{plugin_provider} machine with: #{options.inspect}")
|
255
255
|
config = Config.ensure(options)
|
@@ -257,11 +257,11 @@ class Machine < Nucleon.plugin_class(:nucleon, :base)
|
|
257
257
|
else
|
258
258
|
logger.debug("Machine #{plugin_name} does not yet exist")
|
259
259
|
end
|
260
|
-
|
260
|
+
|
261
261
|
logger.warn("There was an error destroying the machine #{plugin_name}") unless success
|
262
262
|
success
|
263
263
|
end
|
264
|
-
|
264
|
+
|
265
265
|
#-----------------------------------------------------------------------------
|
266
266
|
# Utilities
|
267
267
|
|
data/lib/core/plugin/network.rb
CHANGED
@@ -12,13 +12,22 @@ class Network < Nucleon.plugin_class(:nucleon, :base)
|
|
12
12
|
super
|
13
13
|
|
14
14
|
logger.info("Initializing network: reloading? #{reload}")
|
15
|
-
myself.config = CORL.configuration(Config.new(myself._export).import({ :autosave => false, :create => false, :new => true })) unless reload
|
15
|
+
myself.config = CORL.configuration(Config.new(myself._export, {}, true, false).import({ :autosave => false, :create => false, :new => true })) unless reload
|
16
16
|
|
17
17
|
config.delete(:directory) # TODO: Figure out what to do with this??
|
18
18
|
|
19
19
|
unless reload
|
20
20
|
@build = Build.new
|
21
|
-
|
21
|
+
|
22
|
+
config_identities_glob = File.join('config', 'identities', '*')
|
23
|
+
vagrant_identities_path = File.join('config', 'identities', 'vagrant')
|
24
|
+
|
25
|
+
ignore([
|
26
|
+
'build',
|
27
|
+
config_identities_glob,
|
28
|
+
config_identities_glob + File::SEPARATOR,
|
29
|
+
"!#{vagrant_identities_path}"
|
30
|
+
])
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
@@ -183,11 +192,11 @@ class Network < Nucleon.plugin_class(:nucleon, :base)
|
|
183
192
|
|
184
193
|
#---
|
185
194
|
|
186
|
-
def
|
195
|
+
def node_lookup(public_ip, hostname, require_new = false)
|
187
196
|
matches = {}
|
188
197
|
|
189
198
|
each_node_config do |provider, name, info|
|
190
|
-
matches[provider] = name if info[:public_ip] == public_ip
|
199
|
+
matches[provider] = name if info[:public_ip] == public_ip && name.to_s == hostname.to_s
|
191
200
|
end
|
192
201
|
|
193
202
|
unless matches.empty?
|
@@ -203,11 +212,12 @@ class Network < Nucleon.plugin_class(:nucleon, :base)
|
|
203
212
|
#---
|
204
213
|
|
205
214
|
def local_node(require_new = false)
|
215
|
+
hostname = lookup(:fqdn)
|
206
216
|
ip_address = CORL.public_ip
|
207
|
-
local_node =
|
217
|
+
local_node = node_lookup(ip_address, hostname, require_new)
|
208
218
|
|
209
219
|
if local_node.nil?
|
210
|
-
name = Util::Data.ensure_value(
|
220
|
+
name = Util::Data.ensure_value(hostname, ip_address)
|
211
221
|
local_node = CORL.node(name, extended_config(:local_node).import({ :meta => { :parent => myself }}), :local)
|
212
222
|
else
|
213
223
|
local_node.network = myself
|
@@ -259,6 +269,10 @@ class Network < Nucleon.plugin_class(:nucleon, :base)
|
|
259
269
|
create_builder(:network_package_builder, :package, options)
|
260
270
|
end
|
261
271
|
|
272
|
+
def project_builder(name, options = {})
|
273
|
+
create_builder(:network_project_builder, :project, options)
|
274
|
+
end
|
275
|
+
|
262
276
|
#-----------------------------------------------------------------------------
|
263
277
|
# Operations
|
264
278
|
|
@@ -316,7 +330,7 @@ class Network < Nucleon.plugin_class(:nucleon, :base)
|
|
316
330
|
|
317
331
|
remote_name = config.delete(:remote, :edit)
|
318
332
|
|
319
|
-
|
333
|
+
node_config = extended_config(:network_new_node, Config.new(Util::Data.clean({
|
320
334
|
:settings => array(config.delete(:groups, [])) | [ "server" ],
|
321
335
|
:region => config.delete(:region, nil),
|
322
336
|
:machine_type => config.delete(:machine_type, nil),
|
@@ -324,10 +338,10 @@ class Network < Nucleon.plugin_class(:nucleon, :base)
|
|
324
338
|
:image => config.delete(:image, nil),
|
325
339
|
:user => config.delete(:user, :root),
|
326
340
|
:hostname => name
|
327
|
-
})
|
341
|
+
})))
|
328
342
|
|
329
343
|
# Set node data
|
330
|
-
node = set_node(provider, name,
|
344
|
+
node = set_node(provider, name, node_config.export)
|
331
345
|
hook_config = { :node => node, :remote => remote_name, :config => config }
|
332
346
|
success = true
|
333
347
|
|
data/lib/core/plugin/node.rb
CHANGED
@@ -398,7 +398,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
398
398
|
def machine_config
|
399
399
|
name = setting(:id)
|
400
400
|
name = nil if name.nil? || name.empty?
|
401
|
-
config = Config.new({ :name => name })
|
401
|
+
config = Config.new({ :name => name }, {}, true, false)
|
402
402
|
|
403
403
|
yield(config) if block_given?
|
404
404
|
config
|
@@ -436,7 +436,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
436
436
|
node_facts = local? ? Util::Data.merge([ CORL.facts, custom_facts ]) : custom_facts
|
437
437
|
end
|
438
438
|
|
439
|
-
self.fact_var = Config.new(node_facts).defaults(default_facts).export
|
439
|
+
self.fact_var = Config.new(node_facts, {}, true, false).defaults(default_facts).export
|
440
440
|
end
|
441
441
|
return fact_var.clone if clone
|
442
442
|
fact_var
|
@@ -700,7 +700,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
700
700
|
|
701
701
|
if machine && machine.running?
|
702
702
|
config = Config.ensure(options)
|
703
|
-
hook_config = Config.new({ :local_path => local_path, :remote_path => remote_path, :config => config })
|
703
|
+
hook_config = Config.new({ :local_path => local_path, :remote_path => remote_path, :config => config }, {}, true, false)
|
704
704
|
quiet = config.get(:quiet, false)
|
705
705
|
|
706
706
|
if extension_check(:download, hook_config)
|
@@ -739,7 +739,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
739
739
|
|
740
740
|
if machine && machine.running?
|
741
741
|
config = Config.ensure(options)
|
742
|
-
hook_config = Config.new({ :local_path => local_path, :remote_path => remote_path, :config => config })
|
742
|
+
hook_config = Config.new({ :local_path => local_path, :remote_path => remote_path, :config => config }, {}, true, false)
|
743
743
|
quiet = config.get(:quiet, false)
|
744
744
|
|
745
745
|
if extension_check(:upload, hook_config)
|
@@ -828,7 +828,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
828
828
|
quiet = config.get(:quiet, false)
|
829
829
|
|
830
830
|
begin
|
831
|
-
test = active_machine.exec(commands, config.export) do |type, command, data|
|
831
|
+
test = active_machine.exec(Util::Data.array(commands), config.export) do |type, command, data|
|
832
832
|
unless quiet
|
833
833
|
unless local?
|
834
834
|
text_output = filter_output(type, data).rstrip
|
@@ -890,7 +890,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
890
890
|
remove_command = false
|
891
891
|
|
892
892
|
unless command.is_a?(CORL::Plugin::Command)
|
893
|
-
command = CORL.command(Config.new({ :command => command }).import(config), :bash)
|
893
|
+
command = CORL.command(Config.new({ :command => command }, {}, true, false).import(config), :bash)
|
894
894
|
remove_command = true
|
895
895
|
end
|
896
896
|
|
@@ -1107,11 +1107,14 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
1107
1107
|
image(false)
|
1108
1108
|
end
|
1109
1109
|
|
1110
|
+
remote = config.get(:remote, :edit)
|
1111
|
+
remote = nil unless network.remote(remote)
|
1112
|
+
|
1110
1113
|
network.save(config.import({
|
1111
1114
|
:commit => true,
|
1112
1115
|
:allow_empty => true,
|
1113
1116
|
:message => config.get(:message, "Saving #{plugin_provider} node #{plugin_name}"),
|
1114
|
-
:remote =>
|
1117
|
+
:remote => remote
|
1115
1118
|
}))
|
1116
1119
|
end
|
1117
1120
|
|
@@ -178,10 +178,10 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
178
178
|
config = Config.ensure(options)
|
179
179
|
environment = Util::Data.ensure_value(config[:environment], node.lookup(:corl_environment))
|
180
180
|
provider_info = network.build.config.get_hash([ :provisioners, plugin_provider ])
|
181
|
-
combined_info = Config.new
|
181
|
+
combined_info = Config.new({}, {}, true, false)
|
182
182
|
|
183
183
|
provider_info.each do |package, info|
|
184
|
-
package_info = Config.new(info)
|
184
|
+
package_info = Config.new(info, {}, true, false)
|
185
185
|
profiles = {}
|
186
186
|
|
187
187
|
hash(package_info[:profiles]).each do |name, profile_info|
|
@@ -217,7 +217,7 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
217
217
|
|
218
218
|
def build_profile(name, info, package, environment, profiles)
|
219
219
|
parents = []
|
220
|
-
config = Config.new(info)
|
220
|
+
config = Config.new(info, {}, true, false)
|
221
221
|
success = true
|
222
222
|
|
223
223
|
while config.has_key?(:extend) do
|
data/lib/core/vagrant/action.rb
CHANGED
@@ -2,41 +2,43 @@
|
|
2
2
|
module VagrantPlugins
|
3
3
|
module CORL
|
4
4
|
class BaseAction
|
5
|
-
|
5
|
+
|
6
6
|
#-----------------------------------------------------------------------------
|
7
7
|
# Constructor / Destructor
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(app, env)
|
10
10
|
@app = app
|
11
11
|
@env = env[:machine].env
|
12
|
-
|
12
|
+
|
13
13
|
@network = nil
|
14
14
|
@node = nil
|
15
15
|
@vm = nil
|
16
|
-
|
16
|
+
|
17
17
|
if @corl_config_loaded = ::CORL.vagrant_config_loaded?
|
18
|
-
# Hackish solution to ensure our code has access to Vagrant machines.
|
19
|
-
# This serves as a Vagrant VM manager.
|
20
|
-
::CORL::Vagrant.command = Command::Launcher.new([], @env)
|
21
|
-
|
22
18
|
if @network = ::CORL::Vagrant::Config.load_network(env[:root_path])
|
23
19
|
@vm = env[:machine]
|
24
20
|
@node = network.node(:vagrant, @vm.name) if @vm
|
25
21
|
end
|
26
22
|
end
|
23
|
+
|
24
|
+
unless ::CORL::Vagrant.command
|
25
|
+
# Hackish solution to ensure our code has access to Vagrant machines.
|
26
|
+
# This serves as a Vagrant VM manager.
|
27
|
+
::CORL::Vagrant.command = Command::Launcher.new([], @env)
|
28
|
+
end
|
27
29
|
end
|
28
|
-
|
30
|
+
|
29
31
|
#-----------------------------------------------------------------------------
|
30
32
|
# Property accessor / modifiers
|
31
|
-
|
33
|
+
|
32
34
|
attr_reader :network, :node, :vm
|
33
|
-
|
35
|
+
|
34
36
|
#-----------------------------------------------------------------------------
|
35
37
|
# Action execution
|
36
|
-
|
38
|
+
|
37
39
|
def call(env)
|
38
40
|
yield if block_given? && @corl_config_loaded && @network && @node
|
39
41
|
end
|
40
|
-
end
|
42
|
+
end
|
41
43
|
end
|
42
44
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
module VagrantPlugins
|
3
|
+
module CORL
|
4
|
+
module Action
|
5
|
+
class IncludeOverrides < BaseAction
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
super do
|
9
|
+
# Ignore Vagrant key generation (we handle our own keys)
|
10
|
+
#load File.join(File.dirname(__FILE__), '..', '..', 'mod', 'vagrant.rb')
|
11
|
+
@app.call env
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -7,20 +7,24 @@ class InitKeys < BaseAction
|
|
7
7
|
def call(env)
|
8
8
|
super do
|
9
9
|
env[:ui].info I18n.t("corl.vagrant.actions.init_keys.start")
|
10
|
-
|
10
|
+
|
11
11
|
if node.public_key
|
12
12
|
ssh_key = ::CORL::Util::Disk.read(node.public_key)
|
13
|
-
|
13
|
+
|
14
14
|
if ssh_key && ! ssh_key.empty?
|
15
|
-
|
15
|
+
env[:machine].communicate.tap do |comm|
|
16
16
|
comm.execute("echo '#{ssh_key}' > \$HOME/.ssh/authorized_keys")
|
17
17
|
end
|
18
18
|
node.set_cache_setting(:use_private_key, true)
|
19
19
|
env[:machine].config.ssh.private_key_path = node.private_key
|
20
|
-
|
20
|
+
|
21
|
+
# Needed for Vagrant 1.7+
|
22
|
+
vagrant_key_file = env[:machine].data_dir.join("private_key")
|
23
|
+
::CORL::Util::Disk.delete(vagrant_key_file) if File.exists?(vagrant_key_file)
|
24
|
+
|
21
25
|
node.machine.load
|
22
26
|
end
|
23
|
-
end
|
27
|
+
end
|
24
28
|
@app.call env
|
25
29
|
end
|
26
30
|
end
|
@@ -56,8 +56,8 @@ class Launcher < ::Vagrant.plugin("2", :command)
|
|
56
56
|
provider ||= env.default_provider
|
57
57
|
|
58
58
|
machine = env.machine(name, provider, refresh)
|
59
|
-
machine.ui.opts[:color] = :default # TODO: Something better??
|
60
59
|
|
60
|
+
machine.ui.opts[:color] = :default # TODO: Something better??
|
61
61
|
machine
|
62
62
|
end
|
63
63
|
end
|