opennebula-cli 5.6.2 → 5.7.80.pre
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/bin/oneacct +37 -35
- data/bin/oneacl +15 -15
- data/bin/onecluster +31 -31
- data/bin/onedatastore +35 -35
- data/bin/oneflow +274 -237
- data/bin/oneflow-template +161 -138
- data/bin/onegroup +32 -30
- data/bin/onehost +68 -63
- data/bin/oneimage +92 -81
- data/bin/onemarket +31 -29
- data/bin/onemarketapp +83 -75
- data/bin/onesecgroup +37 -33
- data/bin/oneshowback +40 -43
- data/bin/onetemplate +73 -70
- data/bin/oneuser +171 -158
- data/bin/onevcenter +70 -64
- data/bin/onevdc +61 -45
- data/bin/onevm +396 -260
- data/bin/onevmgroup +47 -47
- data/bin/onevnet +94 -158
- data/bin/onevntemplate +361 -0
- data/bin/onevrouter +76 -70
- data/bin/onezone +30 -31
- data/lib/one_helper.rb +106 -22
- data/lib/one_helper/oneacl_helper.rb +6 -4
- data/lib/one_helper/onevcenter_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +134 -91
- data/lib/one_helper/onevnet_helper.rb +20 -8
- data/lib/one_helper/onevntemplate_helper.rb +104 -0
- metadata +9 -6
data/bin/oneimage
CHANGED
@@ -16,23 +16,23 @@
|
|
16
16
|
# limitations under the License. #
|
17
17
|
#--------------------------------------------------------------------------- #
|
18
18
|
|
19
|
-
ONE_LOCATION=ENV[
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
|
-
RUBY_LIB_LOCATION=
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
23
|
else
|
24
|
-
RUBY_LIB_LOCATION=ONE_LOCATION+
|
24
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
28
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
29
29
|
|
30
30
|
require 'command_parser'
|
31
31
|
require 'one_helper/oneimage_helper'
|
32
32
|
require 'one_helper/onedatastore_helper'
|
33
33
|
|
34
|
-
|
35
|
-
usage
|
34
|
+
CommandParser::CmdParser.new(ARGV) do
|
35
|
+
usage '`oneimage` <command> [<args>] [<options>]'
|
36
36
|
version OpenNebulaHelper::ONE_VERSION
|
37
37
|
|
38
38
|
helper = OneImageHelper.new
|
@@ -41,34 +41,34 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
41
41
|
helper.set_client(options)
|
42
42
|
end
|
43
43
|
|
44
|
-
USE={
|
45
|
-
:name
|
46
|
-
:large =>
|
47
|
-
:description =>
|
44
|
+
USE = {
|
45
|
+
:name => 'use',
|
46
|
+
:large => '--use',
|
47
|
+
:description => 'lock use actions'
|
48
48
|
}
|
49
49
|
|
50
|
-
MANAGE={
|
51
|
-
:name
|
52
|
-
:large =>
|
53
|
-
:description =>
|
50
|
+
MANAGE = {
|
51
|
+
:name => 'manage',
|
52
|
+
:large => '--manage',
|
53
|
+
:description => 'lock manage actions'
|
54
54
|
}
|
55
55
|
|
56
|
-
ADMIN={
|
57
|
-
:name
|
58
|
-
:large =>
|
59
|
-
:description =>
|
56
|
+
ADMIN = {
|
57
|
+
:name => 'admin',
|
58
|
+
:large => '--admin',
|
59
|
+
:description => 'lock admin actions'
|
60
60
|
}
|
61
61
|
|
62
|
-
ALL={
|
63
|
-
:name
|
64
|
-
:large =>
|
65
|
-
:description =>
|
62
|
+
ALL = {
|
63
|
+
:name => 'all',
|
64
|
+
:large => '--all',
|
65
|
+
:description => 'lock all actions'
|
66
66
|
}
|
67
67
|
|
68
68
|
########################################################################
|
69
69
|
# Global Options
|
70
70
|
########################################################################
|
71
|
-
set :option, CommandParser::OPTIONS+OpenNebulaHelper::CLIENT_OPTIONS
|
71
|
+
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
72
72
|
|
73
73
|
list_options = CLIHelper::OPTIONS
|
74
74
|
list_options << OpenNebulaHelper::XML
|
@@ -80,12 +80,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
80
80
|
########################################################################
|
81
81
|
# Formatters for arguments
|
82
82
|
########################################################################
|
83
|
-
set :format, :groupid, OpenNebulaHelper.rname_to_id_desc(
|
84
|
-
OpenNebulaHelper.rname_to_id(arg,
|
83
|
+
set :format, :groupid, OpenNebulaHelper.rname_to_id_desc('GROUP') do |arg|
|
84
|
+
OpenNebulaHelper.rname_to_id(arg, 'GROUP')
|
85
85
|
end
|
86
86
|
|
87
|
-
set :format, :userid, OpenNebulaHelper.rname_to_id_desc(
|
88
|
-
OpenNebulaHelper.rname_to_id(arg,
|
87
|
+
set :format, :userid, OpenNebulaHelper.rname_to_id_desc('USER') do |arg|
|
88
|
+
OpenNebulaHelper.rname_to_id(arg, 'USER')
|
89
89
|
end
|
90
90
|
|
91
91
|
set :format, :imageid, OneImageHelper.to_id_desc do |arg|
|
@@ -100,13 +100,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
100
100
|
helper.filterflag_to_i(arg)
|
101
101
|
end
|
102
102
|
|
103
|
-
format(:type, "Image type: #{Image::IMAGE_TYPES.join(
|
104
|
-
type=arg.strip.upcase
|
103
|
+
format(:type, "Image type: #{Image::IMAGE_TYPES.join(', ')}") do |arg|
|
104
|
+
type = arg.strip.upcase
|
105
105
|
if Image::IMAGE_TYPES.include? type
|
106
106
|
[0, type]
|
107
107
|
else
|
108
|
-
[1,
|
109
|
-
|
108
|
+
[1, 'Image type not supported. Must be ' <<
|
109
|
+
Image::IMAGE_TYPES.join(', ') << '.']
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -138,27 +138,33 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
138
138
|
|
139
139
|
EOT
|
140
140
|
|
141
|
-
command :create,
|
142
|
-
|
141
|
+
command :create,
|
142
|
+
create_desc,
|
143
|
+
[:file, nil],
|
144
|
+
:options => CREATE_OPTIONS + OneImageHelper::TEMPLATE_OPTIONS do
|
143
145
|
|
144
146
|
if options[:datastore].nil? && !options[:dry]
|
145
|
-
STDERR.puts
|
146
|
-
STDERR.puts
|
147
|
-
exit
|
147
|
+
STDERR.puts 'Datastore to save the image is mandatory: '
|
148
|
+
STDERR.puts '\t -d datastore_id'
|
149
|
+
exit(-1)
|
148
150
|
end
|
149
151
|
|
150
|
-
|
152
|
+
if options[:no_check_capacity].nil?
|
153
|
+
check_capacity = false
|
154
|
+
else
|
155
|
+
check_capacity = true
|
156
|
+
end
|
151
157
|
|
152
158
|
if args[0] && OpenNebulaHelper.create_template_options_used?(options)
|
153
|
-
STDERR.puts
|
154
|
-
|
159
|
+
STDERR.puts 'You can not use both template file and template' \
|
160
|
+
' creation options.'
|
155
161
|
next -1
|
156
162
|
end
|
157
163
|
|
158
164
|
helper.create_resource(options) do |image|
|
159
165
|
begin
|
160
166
|
if args[0]
|
161
|
-
template=File.read(args[0])
|
167
|
+
template = File.read(args[0])
|
162
168
|
else
|
163
169
|
res = OneImageHelper.create_image_template(options)
|
164
170
|
|
@@ -176,9 +182,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
176
182
|
end
|
177
183
|
|
178
184
|
image.allocate(template, options[:datastore], check_capacity)
|
179
|
-
rescue => e
|
185
|
+
rescue StandardError => e
|
180
186
|
STDERR.puts e.messsage
|
181
|
-
exit
|
187
|
+
exit(-1)
|
182
188
|
end
|
183
189
|
end
|
184
190
|
end
|
@@ -188,8 +194,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
188
194
|
EOT
|
189
195
|
|
190
196
|
command :clone, clone_desc, :imageid, :name,
|
191
|
-
|
192
|
-
helper.perform_action(args[0],options,
|
197
|
+
:options => [OneDatastoreHelper::DATASTORE] do
|
198
|
+
helper.perform_action(args[0], options, 'cloned') do |image|
|
193
199
|
ds_id = options[:datastore] || -1 # -1 clones to self
|
194
200
|
res = image.clone(args[1], ds_id)
|
195
201
|
|
@@ -197,7 +203,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
197
203
|
puts "ID: #{res}"
|
198
204
|
else
|
199
205
|
puts res.message
|
200
|
-
exit
|
206
|
+
exit(-1)
|
201
207
|
end
|
202
208
|
end
|
203
209
|
end
|
@@ -207,7 +213,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
207
213
|
EOT
|
208
214
|
|
209
215
|
command :delete, delete_desc, [:range, :imageid_list] do
|
210
|
-
helper.perform_actions(args[0],options,
|
216
|
+
helper.perform_actions(args[0], options, 'deleted') do |image|
|
211
217
|
image.delete
|
212
218
|
end
|
213
219
|
end
|
@@ -219,8 +225,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
219
225
|
one VM instance at a time.
|
220
226
|
EOT
|
221
227
|
|
222
|
-
command :persistent, persistent_desc, [:range
|
223
|
-
helper.perform_actions(args[0],options,
|
228
|
+
command :persistent, persistent_desc, [:range, :imageid_list] do
|
229
|
+
helper.perform_actions(args[0], options, 'made persistent') do |image|
|
224
230
|
image.persistent
|
225
231
|
end
|
226
232
|
end
|
@@ -229,8 +235,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
229
235
|
Makes the given Image non persistent. See 'oneimage persistent'
|
230
236
|
EOT
|
231
237
|
|
232
|
-
command :nonpersistent, nonpersistent_desc, [:range
|
233
|
-
helper.perform_actions(args[0],
|
238
|
+
command :nonpersistent, nonpersistent_desc, [:range, :imageid_list] do
|
239
|
+
helper.perform_actions(args[0],
|
240
|
+
options,
|
241
|
+
'made non persistent') do |image|
|
234
242
|
image.nonpersistent
|
235
243
|
end
|
236
244
|
end
|
@@ -241,8 +249,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
241
249
|
EOT
|
242
250
|
|
243
251
|
command :update, update_desc, :imageid, [:file, nil],
|
244
|
-
|
245
|
-
helper.perform_action(args[0],options,
|
252
|
+
:options => OpenNebulaHelper::APPEND do
|
253
|
+
helper.perform_action(args[0], options, 'modified') do |obj|
|
246
254
|
if options[:append]
|
247
255
|
str = OpenNebulaHelper.append_template(args[0], obj, args[1])
|
248
256
|
else
|
@@ -260,8 +268,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
260
268
|
Enables the given Image
|
261
269
|
EOT
|
262
270
|
|
263
|
-
command :enable, enable_desc, [:range
|
264
|
-
helper.perform_actions(args[0],options,
|
271
|
+
command :enable, enable_desc, [:range, :imageid_list] do
|
272
|
+
helper.perform_actions(args[0], options, 'enabled') do |image|
|
265
273
|
image.enable
|
266
274
|
end
|
267
275
|
end
|
@@ -270,8 +278,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
270
278
|
Changes the Image's type
|
271
279
|
EOT
|
272
280
|
|
273
|
-
command :chtype, chtype_desc,[:range, :imageid_list], :type do
|
274
|
-
helper.perform_actions(args[0],options,
|
281
|
+
command :chtype, chtype_desc, [:range, :imageid_list], :type do
|
282
|
+
helper.perform_actions(args[0], options, 'Type changed') do |image|
|
275
283
|
image.chtype(args[1])
|
276
284
|
end
|
277
285
|
end
|
@@ -280,8 +288,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
280
288
|
Disables the given Image
|
281
289
|
EOT
|
282
290
|
|
283
|
-
command :disable, disable_desc, [:range
|
284
|
-
helper.perform_actions(args[0],options,
|
291
|
+
command :disable, disable_desc, [:range, :imageid_list] do
|
292
|
+
helper.perform_actions(args[0], options, 'disabled') do |image|
|
285
293
|
image.disable
|
286
294
|
end
|
287
295
|
end
|
@@ -290,8 +298,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
290
298
|
Changes the Image group
|
291
299
|
EOT
|
292
300
|
|
293
|
-
command :chgrp, chgrp_desc,[:range, :imageid_list], :groupid do
|
294
|
-
helper.perform_actions(args[0],options,
|
301
|
+
command :chgrp, chgrp_desc, [:range, :imageid_list], :groupid do
|
302
|
+
helper.perform_actions(args[0], options, 'Group changed') do |image|
|
295
303
|
image.chown(-1, args[1].to_i)
|
296
304
|
end
|
297
305
|
end
|
@@ -301,10 +309,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
301
309
|
EOT
|
302
310
|
|
303
311
|
command :chown, chown_desc, [:range, :imageid_list], :userid,
|
304
|
-
[:groupid,nil] do
|
305
|
-
|
306
|
-
helper.perform_actions(args[0],options,
|
307
|
-
|
312
|
+
[:groupid, nil] do
|
313
|
+
args[2].nil? ? gid = -1 : gid = args[2].to_i
|
314
|
+
helper.perform_actions(args[0], options,
|
315
|
+
'Owner/Group changed') do |image|
|
308
316
|
image.chown(args[1].to_i, gid)
|
309
317
|
end
|
310
318
|
end
|
@@ -314,8 +322,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
314
322
|
EOT
|
315
323
|
|
316
324
|
command :chmod, chmod_desc, [:range, :imageid_list], :octet do
|
317
|
-
helper.perform_actions(args[0],options,
|
318
|
-
|
325
|
+
helper.perform_actions(args[0], options,
|
326
|
+
'Permissions changed') do |image|
|
319
327
|
image.chmod_octet(args[1])
|
320
328
|
end
|
321
329
|
end
|
@@ -325,7 +333,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
325
333
|
EOT
|
326
334
|
|
327
335
|
command :rename, rename_desc, :imageid, :name do
|
328
|
-
helper.perform_action(args[0],options,
|
336
|
+
helper.perform_action(args[0], options, 'renamed') do |o|
|
329
337
|
o.rename(args[1])
|
330
338
|
end
|
331
339
|
end
|
@@ -334,8 +342,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
334
342
|
Deletes a snapshot from the image
|
335
343
|
EOT
|
336
344
|
|
337
|
-
command :
|
338
|
-
helper.perform_action(args[0], options,
|
345
|
+
command :'snapshot-delete', snapshot_delete_desc, :imageid, :snapshot_id do
|
346
|
+
helper.perform_action(args[0], options, 'snapshot deleted') do |o|
|
339
347
|
o.snapshot_delete(args[1].to_i)
|
340
348
|
end
|
341
349
|
end
|
@@ -344,8 +352,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
344
352
|
Reverts image state to a snapshot
|
345
353
|
EOT
|
346
354
|
|
347
|
-
command :
|
348
|
-
helper.perform_action(args[0], options,
|
355
|
+
command :'snapshot-revert', snapshot_revert_desc, :imageid, :snapshot_id do
|
356
|
+
helper.perform_action(args[0], options, 'image state reverted') do |o|
|
349
357
|
o.snapshot_revert(args[1].to_i)
|
350
358
|
end
|
351
359
|
end
|
@@ -354,8 +362,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
354
362
|
Flattens the snapshot and removes all other snapshots in the image
|
355
363
|
EOT
|
356
364
|
|
357
|
-
command :
|
358
|
-
|
365
|
+
command :'snapshot-flatten',
|
366
|
+
snapshot_flatten_desc,
|
367
|
+
:imageid,
|
368
|
+
:snapshot_id do
|
369
|
+
helper.perform_action(args[0], options, 'snapshot flattened') do |o|
|
359
370
|
o.snapshot_flatten(args[1].to_i)
|
360
371
|
end
|
361
372
|
end
|
@@ -364,7 +375,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
364
375
|
Lists Images in the pool
|
365
376
|
EOT
|
366
377
|
|
367
|
-
command :list, list_desc, [:filterflag, nil], :options=>list_options do
|
378
|
+
command :list, list_desc, [:filterflag, nil], :options => list_options do
|
368
379
|
helper.list_pool(options, false, args[0])
|
369
380
|
end
|
370
381
|
|
@@ -372,15 +383,15 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
372
383
|
Shows information for the given Image
|
373
384
|
EOT
|
374
385
|
|
375
|
-
command :show, show_desc, :imageid, :options=>OpenNebulaHelper::XML do
|
376
|
-
helper.show_resource(args[0],options)
|
386
|
+
command :show, show_desc, :imageid, :options => OpenNebulaHelper::XML do
|
387
|
+
helper.show_resource(args[0], options)
|
377
388
|
end
|
378
389
|
|
379
390
|
top_desc = <<-EOT.unindent
|
380
391
|
Lists Images continuously
|
381
392
|
EOT
|
382
393
|
|
383
|
-
command :top, top_desc, [:filterflag, nil], :options=>list_options do
|
394
|
+
command :top, top_desc, [:filterflag, nil], :options => list_options do
|
384
395
|
helper.list_pool(options, true, args[0])
|
385
396
|
end
|
386
397
|
|
@@ -395,8 +406,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
395
406
|
EOT
|
396
407
|
|
397
408
|
command :lock, lock_desc, :imageid,
|
398
|
-
|
399
|
-
helper.perform_action(args[0],options,
|
409
|
+
:options => [USE, MANAGE, ADMIN, ALL] do
|
410
|
+
helper.perform_action(args[0], options, 'Image locked') do |i|
|
400
411
|
if !options[:use].nil?
|
401
412
|
level = 1
|
402
413
|
elsif !options[:manage].nil?
|
@@ -418,7 +429,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
418
429
|
EOT
|
419
430
|
|
420
431
|
command :unlock, unlock_desc, :imageid do
|
421
|
-
helper.perform_action(args[0],options,
|
432
|
+
helper.perform_action(args[0], options, 'Image unlocked') do |i|
|
422
433
|
i.unlock
|
423
434
|
end
|
424
435
|
end
|
data/bin/onemarket
CHANGED
@@ -16,22 +16,22 @@
|
|
16
16
|
# limitations under the License. #
|
17
17
|
#--------------------------------------------------------------------------- #
|
18
18
|
|
19
|
-
ONE_LOCATION=ENV[
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
|
-
RUBY_LIB_LOCATION=
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
23
|
else
|
24
|
-
RUBY_LIB_LOCATION=ONE_LOCATION+
|
24
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
28
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
29
29
|
|
30
30
|
require 'command_parser'
|
31
31
|
require 'one_helper/onemarket_helper'
|
32
32
|
|
33
|
-
|
34
|
-
usage
|
33
|
+
CommandParser::CmdParser.new(ARGV) do
|
34
|
+
usage '`onemarket` <command> [<args>] [<options>]'
|
35
35
|
version OpenNebulaHelper::ONE_VERSION
|
36
36
|
|
37
37
|
helper = OneMarketPlaceHelper.new
|
@@ -43,7 +43,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
43
43
|
########################################################################
|
44
44
|
# Global Options
|
45
45
|
########################################################################
|
46
|
-
set :option, CommandParser::OPTIONS+OpenNebulaHelper::CLIENT_OPTIONS
|
46
|
+
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
47
47
|
|
48
48
|
list_options = CLIHelper::OPTIONS
|
49
49
|
list_options << OpenNebulaHelper::XML
|
@@ -57,16 +57,18 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
57
57
|
helper.to_id(arg)
|
58
58
|
end
|
59
59
|
|
60
|
-
set :format,
|
60
|
+
set :format,
|
61
|
+
:marketplaceid_list,
|
62
|
+
OneMarketPlaceHelper.list_to_id_desc do |arg|
|
61
63
|
helper.list_to_id(arg)
|
62
64
|
end
|
63
65
|
|
64
|
-
set :format, :groupid, OpenNebulaHelper.rname_to_id_desc(
|
65
|
-
OpenNebulaHelper.rname_to_id(arg,
|
66
|
+
set :format, :groupid, OpenNebulaHelper.rname_to_id_desc('GROUP') do |arg|
|
67
|
+
OpenNebulaHelper.rname_to_id(arg, 'GROUP')
|
66
68
|
end
|
67
69
|
|
68
|
-
set :format, :userid, OpenNebulaHelper.rname_to_id_desc(
|
69
|
-
OpenNebulaHelper.rname_to_id(arg,
|
70
|
+
set :format, :userid, OpenNebulaHelper.rname_to_id_desc('USER') do |arg|
|
71
|
+
OpenNebulaHelper.rname_to_id(arg, 'USER')
|
70
72
|
end
|
71
73
|
|
72
74
|
########################################################################
|
@@ -78,14 +80,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
78
80
|
EOT
|
79
81
|
|
80
82
|
command :create, create_desc, :file do
|
81
|
-
|
82
83
|
helper.create_resource(options) do |marketplace|
|
83
84
|
begin
|
84
85
|
template = File.read(args[0])
|
85
86
|
marketplace.allocate(template)
|
86
|
-
rescue =>e
|
87
|
+
rescue StandardError => e
|
87
88
|
STDERR.puts e.message
|
88
|
-
exit
|
89
|
+
exit(-1)
|
89
90
|
end
|
90
91
|
end
|
91
92
|
end
|
@@ -95,7 +96,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
95
96
|
EOT
|
96
97
|
|
97
98
|
command :delete, delete_desc, [:range, :marketplaceid_list] do
|
98
|
-
helper.perform_actions(args[0],options,
|
99
|
+
helper.perform_actions(args[0], options, 'deleted') do |obj|
|
99
100
|
obj.delete
|
100
101
|
end
|
101
102
|
end
|
@@ -104,8 +105,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
104
105
|
Changes the Marketplace group
|
105
106
|
EOT
|
106
107
|
|
107
|
-
command :chgrp, chgrp_desc,[:range, :marketplaceid_list], :groupid do
|
108
|
-
helper.perform_actions(args[0],options,
|
108
|
+
command :chgrp, chgrp_desc, [:range, :marketplaceid_list], :groupid do
|
109
|
+
helper.perform_actions(args[0], options, 'Group changed') do |obj|
|
109
110
|
obj.chown(-1, args[1].to_i)
|
110
111
|
end
|
111
112
|
end
|
@@ -115,9 +116,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
115
116
|
EOT
|
116
117
|
|
117
118
|
command :chown, chown_desc, [:range, :marketplaceid_list], :userid,
|
118
|
-
[:groupid,nil] do
|
119
|
-
|
120
|
-
helper.perform_actions(args[0],options,
|
119
|
+
[:groupid, nil] do
|
120
|
+
args[2].nil? ? gid = -1 : gid = args[2].to_i
|
121
|
+
helper.perform_actions(args[0], options, 'Owner/Group changed') do |obj|
|
121
122
|
obj.chown(args[1].to_i, gid)
|
122
123
|
end
|
123
124
|
end
|
@@ -127,7 +128,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
127
128
|
EOT
|
128
129
|
|
129
130
|
command :chmod, chmod_desc, [:range, :marketplaceid_list], :octet do
|
130
|
-
helper.perform_actions(args[0],options,
|
131
|
+
helper.perform_actions(args[0], options, 'Permissions changed') do |obj|
|
131
132
|
obj.chmod_octet(args[1])
|
132
133
|
end
|
133
134
|
end
|
@@ -136,7 +137,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
136
137
|
Lists Marketplaces
|
137
138
|
EOT
|
138
139
|
|
139
|
-
command :list, list_desc, :options=>list_options do
|
140
|
+
command :list, list_desc, :options => list_options do
|
140
141
|
helper.list_pool(options)
|
141
142
|
end
|
142
143
|
|
@@ -144,8 +145,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
144
145
|
Shows Marketplace information
|
145
146
|
EOT
|
146
147
|
|
147
|
-
command :show, show_desc,
|
148
|
-
|
148
|
+
command :show, show_desc,
|
149
|
+
:marketplaceid, :options => OpenNebulaHelper::XML do
|
150
|
+
helper.show_resource(args[0], options)
|
149
151
|
end
|
150
152
|
|
151
153
|
update_desc = <<-EOT.unindent
|
@@ -154,8 +156,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
154
156
|
EOT
|
155
157
|
|
156
158
|
command :update, update_desc, :marketplaceid, [:file, nil],
|
157
|
-
|
158
|
-
helper.perform_action(args[0],options,
|
159
|
+
:options => OpenNebulaHelper::APPEND do
|
160
|
+
helper.perform_action(args[0], options, 'modified') do |obj|
|
159
161
|
if options[:append]
|
160
162
|
str = OpenNebulaHelper.append_template(args[0], obj, args[1])
|
161
163
|
else
|
@@ -171,7 +173,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
171
173
|
EOT
|
172
174
|
|
173
175
|
command :rename, rename_desc, :marketplaceid, :name do
|
174
|
-
helper.perform_action(args[0],options,
|
176
|
+
helper.perform_action(args[0], options, 'renamed') do |o|
|
175
177
|
o.rename(args[1])
|
176
178
|
end
|
177
179
|
end
|