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
@@ -8,8 +8,8 @@ class File < Nucleon.plugin_class(:CORL, :configuration)
|
|
8
8
|
|
9
9
|
def normalize(reload)
|
10
10
|
super do
|
11
|
-
_set(:search, Config.new)
|
12
|
-
_set(:router, Config.new)
|
11
|
+
_set(:search, Config.new({}, {}, true, false))
|
12
|
+
_set(:router, Config.new({}, {}, true, false))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -0,0 +1,327 @@
|
|
1
|
+
|
2
|
+
module CORL
|
3
|
+
module Machine
|
4
|
+
class Docker < Nucleon.plugin_class(:CORL, :machine)
|
5
|
+
|
6
|
+
#include Mixin::Machine::SSH
|
7
|
+
|
8
|
+
#---
|
9
|
+
|
10
|
+
#@@lock = Mutex.new
|
11
|
+
|
12
|
+
#-----------------------------------------------------------------------------
|
13
|
+
# Machine plugin interface
|
14
|
+
|
15
|
+
def normalize(reload)
|
16
|
+
super
|
17
|
+
#myself.plugin_name = node.plugin_name if node
|
18
|
+
end
|
19
|
+
|
20
|
+
#-----------------------------------------------------------------------------
|
21
|
+
# Checks
|
22
|
+
|
23
|
+
def created?
|
24
|
+
server && state != :not_created
|
25
|
+
end
|
26
|
+
|
27
|
+
#---
|
28
|
+
|
29
|
+
def running?
|
30
|
+
server && state == :running
|
31
|
+
end
|
32
|
+
|
33
|
+
#-----------------------------------------------------------------------------
|
34
|
+
# Property accessors / modifiers
|
35
|
+
|
36
|
+
def set_command
|
37
|
+
#@command = nil
|
38
|
+
|
39
|
+
#begin
|
40
|
+
# # Ensure we are running within Vagrant from the corl base command
|
41
|
+
# require 'docker'
|
42
|
+
#
|
43
|
+
# logger.info("Setting up Vagrant for machine")
|
44
|
+
# @command = CORL::Vagrant.command
|
45
|
+
#
|
46
|
+
#rescue LoadError
|
47
|
+
#end
|
48
|
+
end
|
49
|
+
protected :set_command
|
50
|
+
|
51
|
+
#---
|
52
|
+
|
53
|
+
def command
|
54
|
+
#set_command unless @command
|
55
|
+
#@command
|
56
|
+
end
|
57
|
+
|
58
|
+
#---
|
59
|
+
|
60
|
+
def env
|
61
|
+
#return command.env if command
|
62
|
+
#nil
|
63
|
+
end
|
64
|
+
|
65
|
+
#---
|
66
|
+
|
67
|
+
def server=id
|
68
|
+
#@server = nil
|
69
|
+
#
|
70
|
+
#if id.is_a?(String)
|
71
|
+
# @server = new_machine(id)
|
72
|
+
#elsif ! id.nil?
|
73
|
+
# @server = id
|
74
|
+
#end
|
75
|
+
end
|
76
|
+
|
77
|
+
def server
|
78
|
+
#command
|
79
|
+
#load unless @server
|
80
|
+
#@server
|
81
|
+
end
|
82
|
+
|
83
|
+
#---
|
84
|
+
|
85
|
+
def state
|
86
|
+
#return server.state.id if server
|
87
|
+
#:not_loaded
|
88
|
+
end
|
89
|
+
|
90
|
+
#---
|
91
|
+
|
92
|
+
def machine_types
|
93
|
+
#[ :virtualbox, :vmware_fusion, :hyperv ]
|
94
|
+
end
|
95
|
+
|
96
|
+
#-----------------------------------------------------------------------------
|
97
|
+
# Management
|
98
|
+
|
99
|
+
def load
|
100
|
+
super do
|
101
|
+
# myself.server = plugin_name if command && plugin_name
|
102
|
+
# ! plugin_name && @server.nil? ? false : true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
#---
|
107
|
+
|
108
|
+
def create(options = {})
|
109
|
+
super do |config|
|
110
|
+
# start_machine(config)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
#---
|
115
|
+
|
116
|
+
def download(remote_path, local_path, options = {}, &code)
|
117
|
+
super do |config, success|
|
118
|
+
#ssh_download(remote_path, local_path, config, &code)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#---
|
123
|
+
|
124
|
+
def upload(local_path, remote_path, options = {}, &code)
|
125
|
+
super do |config, success|
|
126
|
+
#ssh_upload(local_path, remote_path, config, &code)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
#---
|
131
|
+
|
132
|
+
def exec(commands, options = {}, &code)
|
133
|
+
super do |config|
|
134
|
+
#ssh_exec(commands, config, &code)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
#---
|
139
|
+
|
140
|
+
def terminal(user, options = {})
|
141
|
+
super do |config|
|
142
|
+
#ssh_terminal(user, config)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
#---
|
147
|
+
|
148
|
+
def reload(options = {})
|
149
|
+
super do |config|
|
150
|
+
#success = run(:reload, config)
|
151
|
+
#success = init_ssh_session(true, config.get(:tries, 12), config.get(:sleep_time, 5)) if success
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
#---
|
156
|
+
|
157
|
+
def create_image(options = {})
|
158
|
+
super do |config|
|
159
|
+
#stop = config.delete(:stop, false)
|
160
|
+
#
|
161
|
+
## TODO: Decide how to handle versions??
|
162
|
+
## Timestamps stink since these things are huge (>600MB)
|
163
|
+
#box_name = sprintf("%s", node.id).gsub(/\s+/, '-')
|
164
|
+
#box_path = File.join(node.network.directory, 'boxes', "#{box_name}.box")
|
165
|
+
#box_url = "file://#{box_path}"
|
166
|
+
#FileUtils.mkdir_p(File.dirname(box_path))
|
167
|
+
#FileUtils.rm_f(box_path)
|
168
|
+
#
|
169
|
+
#begin
|
170
|
+
# close_ssh_session
|
171
|
+
# success = run(:package, config.defaults({ 'package.output' => box_path }), false)
|
172
|
+
#
|
173
|
+
# node.set_cache_setting(:box, box_name)
|
174
|
+
# node.set_cache_setting(:box_url, box_url)
|
175
|
+
#
|
176
|
+
# if success
|
177
|
+
# env.action_runner.run(::Vagrant::Action.action_box_add, {
|
178
|
+
# :box_name => box_name,
|
179
|
+
# :box_url => box_url,
|
180
|
+
# :box_clean => false,
|
181
|
+
# :box_force => true,
|
182
|
+
# :ui => ::Vagrant::UI::Prefixed.new(env.ui, "box")
|
183
|
+
# })
|
184
|
+
# load
|
185
|
+
# end
|
186
|
+
#
|
187
|
+
#rescue => error
|
188
|
+
# error(error.message, { :i18n => false })
|
189
|
+
# success = false
|
190
|
+
#end
|
191
|
+
#
|
192
|
+
#success = run(:up, config) if success && ! stop
|
193
|
+
#success
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
#---
|
198
|
+
|
199
|
+
def stop(options = {})
|
200
|
+
super do |config|
|
201
|
+
#create_image(config.import({ :stop => true }))
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
#---
|
206
|
+
|
207
|
+
def start(options = {})
|
208
|
+
super do |config|
|
209
|
+
#start_machine(config)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
#---
|
214
|
+
|
215
|
+
def destroy(options = {})
|
216
|
+
super do |config|
|
217
|
+
## We should handle prompting internally to keep it consistent
|
218
|
+
#success = run(:destroy, config.defaults({ :force_confirm_destroy => true }))
|
219
|
+
#
|
220
|
+
#if success
|
221
|
+
# box_name = sprintf("%s", node.id).gsub(/\s+/, '-')
|
222
|
+
# found = false
|
223
|
+
#
|
224
|
+
# # TODO: Figure out box versions.
|
225
|
+
#
|
226
|
+
# env.boxes.all.each do |info|
|
227
|
+
# registered_box_name = info[0]
|
228
|
+
# registered_box_version = info[1]
|
229
|
+
# registered_box_provider = info[2]
|
230
|
+
#
|
231
|
+
# if box_name == registered_box_name
|
232
|
+
# found = true
|
233
|
+
# break
|
234
|
+
# end
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# if found
|
238
|
+
# env.action_runner.run(::Vagrant::Action.action_box_remove, {
|
239
|
+
# :box_name => box_name,
|
240
|
+
# :box_provider => node.machine_type
|
241
|
+
# })
|
242
|
+
#
|
243
|
+
# box_name = sprintf("%s", node.id).gsub(/\s+/, '-')
|
244
|
+
# box_path = File.join(node.network.directory, 'boxes', "#{box_name}.box")
|
245
|
+
# Util::Disk.delete(box_path)
|
246
|
+
# end
|
247
|
+
#end
|
248
|
+
#close_ssh_session if success
|
249
|
+
#success
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
#-----------------------------------------------------------------------------
|
254
|
+
# Utilities
|
255
|
+
|
256
|
+
def refresh_config
|
257
|
+
if env
|
258
|
+
#@@lock.synchronize do
|
259
|
+
# begin
|
260
|
+
# CORL::Vagrant::Config.network = node.network
|
261
|
+
# env.vagrantfile.reload
|
262
|
+
# ensure
|
263
|
+
# CORL::Vagrant::Config.network = nil
|
264
|
+
# end
|
265
|
+
#end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
protected :refresh_config
|
269
|
+
|
270
|
+
#---
|
271
|
+
|
272
|
+
def new_machine(id)
|
273
|
+
#server = nil
|
274
|
+
#if command && ! id.empty?
|
275
|
+
# refresh_config
|
276
|
+
# if env.vagrantfile.machine_names.include?(id.to_sym)
|
277
|
+
# server = command.vm_machine(id.to_sym, node.machine_type, true)
|
278
|
+
# end
|
279
|
+
#end
|
280
|
+
#server
|
281
|
+
end
|
282
|
+
protected :new_machine
|
283
|
+
|
284
|
+
#---
|
285
|
+
|
286
|
+
def start_machine(options)
|
287
|
+
#success = false
|
288
|
+
#
|
289
|
+
#if server
|
290
|
+
# load
|
291
|
+
# success = run(:up, options)
|
292
|
+
#
|
293
|
+
# # Make sure provisioner changes (key changes) are accounted for
|
294
|
+
# # TODO: Is there a better way?
|
295
|
+
# load if success
|
296
|
+
#end
|
297
|
+
#success
|
298
|
+
end
|
299
|
+
protected :start_machine
|
300
|
+
|
301
|
+
#---
|
302
|
+
|
303
|
+
def run(action, options = {}, symbolize_keys = true)
|
304
|
+
#config = Config.ensure(options)
|
305
|
+
#
|
306
|
+
#if server
|
307
|
+
# logger.debug("Running Vagrant action #{action} on machine #{node.id}")
|
308
|
+
#
|
309
|
+
# success = true
|
310
|
+
# begin
|
311
|
+
# params = config.export
|
312
|
+
# params = string_map(params) unless symbolize_keys
|
313
|
+
#
|
314
|
+
# server.send(:action, action.to_sym, params)
|
315
|
+
#
|
316
|
+
# rescue => error
|
317
|
+
# error(error.message, { :i18n => false })
|
318
|
+
# error(Util::Data.to_yaml(error.backtrace), { :i18n => false })
|
319
|
+
# success = false
|
320
|
+
# end
|
321
|
+
#end
|
322
|
+
#success
|
323
|
+
end
|
324
|
+
protected :run
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|