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