opennebula-cli 5.12.7 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oneacct +9 -4
- data/bin/oneacl +8 -5
- data/bin/onecluster +10 -7
- data/bin/onedatastore +10 -7
- data/bin/oneflow +85 -13
- data/bin/oneflow-template +45 -8
- data/bin/onegroup +10 -7
- data/bin/onehook +10 -7
- data/bin/onehost +10 -7
- data/bin/oneimage +100 -9
- data/bin/onemarket +10 -7
- data/bin/onemarketapp +114 -11
- data/bin/onesecgroup +13 -7
- data/bin/oneshowback +18 -10
- data/bin/onetemplate +12 -8
- data/bin/oneuser +30 -7
- data/bin/onevcenter +16 -8
- data/bin/onevdc +10 -7
- data/bin/onevm +147 -12
- data/bin/onevmgroup +13 -7
- data/bin/onevnet +8 -5
- data/bin/onevntemplate +11 -7
- data/bin/onevrouter +10 -7
- data/bin/onezone +11 -8
- data/lib/cli_helper.rb +17 -8
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper.rb +398 -37
- data/lib/one_helper/oneacct_helper.rb +8 -17
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +11 -1
- data/lib/one_helper/oneflow_helper.rb +20 -5
- data/lib/one_helper/oneflowtemplate_helper.rb +28 -2
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehook_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +1 -5
- data/lib/one_helper/oneimage_helper.rb +13 -7
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +500 -96
- data/lib/one_helper/onequota_helper.rb +1 -1
- data/lib/one_helper/onesecgroup_helper.rb +1 -1
- data/lib/one_helper/onetemplate_helper.rb +12 -1
- data/lib/one_helper/oneuser_helper.rb +11 -3
- data/lib/one_helper/onevcenter_helper.rb +176 -146
- data/lib/one_helper/onevdc_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +4 -3
- data/lib/one_helper/onevmgroup_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onevntemplate_helper.rb +1 -1
- data/lib/one_helper/onevrouter_helper.rb +1 -20
- data/lib/one_helper/onezone_helper.rb +24 -17
- data/share/schemas/xsd/acct.xsd +179 -0
- data/share/schemas/xsd/acl_pool.xsd +22 -0
- data/share/schemas/xsd/api_info.xsd +43 -0
- data/share/schemas/xsd/cluster.xsd +34 -0
- data/share/schemas/xsd/cluster_pool.xsd +12 -0
- data/share/schemas/xsd/datastore.xsd +67 -0
- data/share/schemas/xsd/datastore_pool.xsd +12 -0
- data/share/schemas/xsd/document.xsd +42 -0
- data/share/schemas/xsd/document_pool.xsd +12 -0
- data/share/schemas/xsd/group.xsd +179 -0
- data/share/schemas/xsd/group_pool.xsd +194 -0
- data/share/schemas/xsd/hook.xsd +59 -0
- data/share/schemas/xsd/hook_message_api.xsd +14 -0
- data/share/schemas/xsd/hook_message_retry.xsd +12 -0
- data/share/schemas/xsd/hook_message_state.xsd +25 -0
- data/share/schemas/xsd/hook_pool.xsd +12 -0
- data/share/schemas/xsd/host.xsd +164 -0
- data/share/schemas/xsd/host_pool.xsd +12 -0
- data/share/schemas/xsd/image.xsd +123 -0
- data/share/schemas/xsd/image_pool.xsd +12 -0
- data/share/schemas/xsd/index.xsd +50 -0
- data/share/schemas/xsd/marketplace.xsd +44 -0
- data/share/schemas/xsd/marketplace_pool.xsd +12 -0
- data/share/schemas/xsd/marketplaceapp.xsd +56 -0
- data/share/schemas/xsd/marketplaceapp_pool.xsd +12 -0
- data/share/schemas/xsd/monitoring_data.xsd +41 -0
- data/share/schemas/xsd/opennebula_configuration.xsd +412 -0
- data/share/schemas/xsd/raftstatus.xsd +18 -0
- data/share/schemas/xsd/security_group.xsd +74 -0
- data/share/schemas/xsd/security_group_pool.xsd +12 -0
- data/share/schemas/xsd/showback.xsd +29 -0
- data/share/schemas/xsd/user.xsd +186 -0
- data/share/schemas/xsd/user_pool.xsd +201 -0
- data/share/schemas/xsd/vdc.xsd +76 -0
- data/share/schemas/xsd/vdc_pool.xsd +12 -0
- data/share/schemas/xsd/vm.xsd +251 -0
- data/share/schemas/xsd/vm_group.xsd +59 -0
- data/share/schemas/xsd/vm_group_pool.xsd +12 -0
- data/share/schemas/xsd/vm_pool.xsd +114 -0
- data/share/schemas/xsd/vmtemplate.xsd +52 -0
- data/share/schemas/xsd/vmtemplate_pool.xsd +12 -0
- data/share/schemas/xsd/vnet.xsd +137 -0
- data/share/schemas/xsd/vnet_pool.xsd +85 -0
- data/share/schemas/xsd/vntemplate.xsd +50 -0
- data/share/schemas/xsd/vntemplate_pool.xsd +12 -0
- data/share/schemas/xsd/vrouter.xsd +49 -0
- data/share/schemas/xsd/vrouter_pool.xsd +12 -0
- data/share/schemas/xsd/zone.xsd +40 -0
- data/share/schemas/xsd/zone_pool.xsd +36 -0
- metadata +79 -17
- data/lib/one_helper/oneprovision_helper.rb +0 -362
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03449b210a183af54660a90a3c989f5610ad58db
|
4
|
+
data.tar.gz: 71df749058756def41f3bdb2f691f104451a9b5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 457e1c60b5e45b3eaf7907bc664b8050dd3c76ad12d09814209b67c27f8739abc836f66c7d23dae5c090608a5371cf3713657f68ada6a57394b1c9e3f629bdbe
|
7
|
+
data.tar.gz: 01b411b3548c445c4b184a3ff936d4789ce1b880df2cfdb436ad5e12bc8416fdb6d9dbc2577109b739e566e30533f28ee58ec00170eb311aede5c24c2125ef87
|
data/bin/oneacct
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -109,12 +112,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
109
112
|
puts xml_str
|
110
113
|
end
|
111
114
|
else
|
115
|
+
# rubocop:disable Naming/VariableNumber
|
112
116
|
order_by = {}
|
113
117
|
order_by[:order_by_1] = 'VM/UID'
|
114
118
|
|
115
119
|
if options[:split] && !options[:csv]
|
116
120
|
order_by[:order_by_2] = 'VM/ID'
|
117
121
|
end
|
122
|
+
# rubocop:enable Naming/VariableNumber
|
118
123
|
|
119
124
|
acct_hash = pool.accounting(filter_flag,
|
120
125
|
common_opts.merge(order_by))
|
data/bin/oneacl
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -103,7 +106,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
103
106
|
EOT
|
104
107
|
|
105
108
|
command :list, list_desc, :options => [CLIHelper::OPTIONS,
|
106
|
-
OpenNebulaHelper::
|
109
|
+
OpenNebulaHelper::FORMAT,
|
107
110
|
OpenNebulaHelper::DESCRIBE] do
|
108
111
|
helper.list_pool(options)
|
109
112
|
end
|
data/bin/onecluster
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -53,8 +56,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
53
56
|
########################################################################
|
54
57
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
55
58
|
|
56
|
-
list_options
|
57
|
-
list_options
|
59
|
+
list_options = CLIHelper::OPTIONS
|
60
|
+
list_options += OpenNebulaHelper::FORMAT
|
58
61
|
list_options << OpenNebulaHelper::NUMERIC
|
59
62
|
list_options << OpenNebulaHelper::DESCRIBE
|
60
63
|
|
@@ -119,7 +122,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
119
122
|
EOT
|
120
123
|
|
121
124
|
command :show, show_desc, :clusterid,
|
122
|
-
:options => [OpenNebulaHelper::
|
125
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
123
126
|
helper.show_resource(args[0], options)
|
124
127
|
end
|
125
128
|
|
data/bin/onedatastore
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -54,8 +57,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
54
57
|
########################################################################
|
55
58
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
56
59
|
|
57
|
-
list_options
|
58
|
-
list_options
|
60
|
+
list_options = CLIHelper::OPTIONS
|
61
|
+
list_options += OpenNebulaHelper::FORMAT
|
59
62
|
list_options << OpenNebulaHelper::NUMERIC
|
60
63
|
list_options << OpenNebulaHelper::DESCRIBE
|
61
64
|
|
@@ -161,7 +164,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
161
164
|
EOT
|
162
165
|
|
163
166
|
command :show, show_desc, :datastoreid,
|
164
|
-
:options => [OpenNebulaHelper::
|
167
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
165
168
|
helper.show_resource(args[0], options)
|
166
169
|
end
|
167
170
|
|
data/bin/oneflow
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -27,15 +27,19 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
36
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
37
40
|
|
38
41
|
require 'json'
|
42
|
+
require 'tempfile'
|
39
43
|
|
40
44
|
require 'command_parser'
|
41
45
|
require 'opennebula/oneflow_client'
|
@@ -54,12 +58,6 @@ CommandParser::CmdParser.new(ARGV) do
|
|
54
58
|
set :option, CommandParser::VERSION
|
55
59
|
set :option, CommandParser::HELP
|
56
60
|
|
57
|
-
DONE = {
|
58
|
-
:name => 'done',
|
59
|
-
:large => '--done',
|
60
|
-
:description => 'Show services in DONE state'
|
61
|
-
}
|
62
|
-
|
63
61
|
ARGS = {
|
64
62
|
:name => 'args',
|
65
63
|
:large => '--args arg1,arg2',
|
@@ -113,7 +111,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
113
111
|
List the available services
|
114
112
|
EOT
|
115
113
|
|
116
|
-
command :list, list_desc, :options =>
|
114
|
+
command :list, list_desc, :options => OpenNebulaHelper::FORMAT do
|
117
115
|
helper.list_service_pool(helper.client(options), options)
|
118
116
|
end
|
119
117
|
|
@@ -123,7 +121,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
123
121
|
Top the available services
|
124
122
|
EOT
|
125
123
|
|
126
|
-
command :top, top_desc, :options => [CLIHelper::DELAY
|
124
|
+
command :top, top_desc, :options => [CLIHelper::DELAY] do
|
127
125
|
Signal.trap('INT') { exit(-1) }
|
128
126
|
|
129
127
|
helper.top_service_pool(helper.client(options), options)
|
@@ -137,7 +135,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
137
135
|
Show detailed information of a given service
|
138
136
|
EOT
|
139
137
|
|
140
|
-
command :show,
|
138
|
+
command :show,
|
139
|
+
show_desc,
|
140
|
+
:service_id,
|
141
|
+
:options => OpenNebulaHelper::FORMAT do
|
141
142
|
helper.format_resource(helper.client(options), args[0], options)
|
142
143
|
end
|
143
144
|
|
@@ -345,4 +346,75 @@ CommandParser::CmdParser.new(ARGV) do
|
|
345
346
|
client.post("#{RESOURCE_PATH}/#{service_id}/action", json)
|
346
347
|
end
|
347
348
|
end
|
349
|
+
|
350
|
+
###
|
351
|
+
|
352
|
+
update_desc = <<-EOT.unindent
|
353
|
+
Update the template contents. If a path is not provided the editor will
|
354
|
+
be launched to modify the current content.
|
355
|
+
EOT
|
356
|
+
|
357
|
+
command :update, update_desc, :service_id, [:file, nil] do
|
358
|
+
service_id = args[0]
|
359
|
+
client = helper.client(options)
|
360
|
+
|
361
|
+
if args[1]
|
362
|
+
path = args[1]
|
363
|
+
else
|
364
|
+
response = client.get("#{RESOURCE_PATH}/#{service_id}")
|
365
|
+
|
366
|
+
if CloudClient.is_error?(response)
|
367
|
+
exit_with_code response.code.to_i, response.to_s
|
368
|
+
else
|
369
|
+
document = JSON.parse(response.body)['DOCUMENT']
|
370
|
+
template = document['TEMPLATE']['BODY']
|
371
|
+
|
372
|
+
tmp = Tempfile.new(service_id.to_s)
|
373
|
+
path = tmp.path
|
374
|
+
|
375
|
+
tmp.write(JSON.pretty_generate(template))
|
376
|
+
tmp.flush
|
377
|
+
|
378
|
+
if ENV['EDITOR']
|
379
|
+
editor_path = ENV['EDITOR']
|
380
|
+
else
|
381
|
+
editor_path = OpenNebulaHelper::EDITOR_PATH
|
382
|
+
end
|
383
|
+
|
384
|
+
system("#{editor_path} #{path}")
|
385
|
+
|
386
|
+
unless $CHILD_STATUS.exitstatus.zero?
|
387
|
+
STDERR.puts 'Editor not defined'
|
388
|
+
exit(-1)
|
389
|
+
end
|
390
|
+
|
391
|
+
tmp.close
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
response = client.put("#{RESOURCE_PATH}/#{service_id}", File.read(path))
|
396
|
+
|
397
|
+
if CloudClient.is_error?(response)
|
398
|
+
[response.code.to_i, response.to_s]
|
399
|
+
else
|
400
|
+
0
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
###
|
405
|
+
|
406
|
+
purge_done_desc = <<-EOT.unindent
|
407
|
+
Purge and delete services in DONE state
|
408
|
+
EOT
|
409
|
+
|
410
|
+
command :'purge-done', purge_done_desc do
|
411
|
+
client = helper.client(options)
|
412
|
+
response = client.post('/service_pool/purge_done', '')
|
413
|
+
|
414
|
+
if CloudClient.is_error?(response)
|
415
|
+
exit_with_code response.code.to_i, response.to_s
|
416
|
+
else
|
417
|
+
0
|
418
|
+
end
|
419
|
+
end
|
348
420
|
end
|
data/bin/oneflow-template
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -29,9 +29,12 @@ else
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if File.directory?(GEMS_LOCATION)
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
33
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
34
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
35
|
+
require 'rubygems'
|
36
|
+
Gem.use_paths(real_gems_path)
|
37
|
+
end
|
35
38
|
end
|
36
39
|
|
37
40
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -76,6 +79,20 @@ CommandParser::CmdParser.new(ARGV) do
|
|
76
79
|
:description => 'Clone the template recursively (just templates)'
|
77
80
|
}
|
78
81
|
|
82
|
+
DELETE_TEMPLATES = {
|
83
|
+
:name => 'delete_templates',
|
84
|
+
:large => '--delete-vm-templates',
|
85
|
+
:description => 'Delete associated VM templates when deleting ' \
|
86
|
+
'service template'
|
87
|
+
}
|
88
|
+
|
89
|
+
DELETE_IMAGES = {
|
90
|
+
:name => 'delete_images',
|
91
|
+
:large => '--delete-images',
|
92
|
+
:description => 'Delete associated VM templates and images when ' \
|
93
|
+
'deleting service template'
|
94
|
+
}
|
95
|
+
|
79
96
|
usage '`oneflow-template` <command> [<args>] [<options>]'
|
80
97
|
version OpenNebulaHelper::ONE_VERSION
|
81
98
|
|
@@ -113,7 +130,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
113
130
|
List the available Service Templates
|
114
131
|
EOT
|
115
132
|
|
116
|
-
command :list, list_desc, :options =>
|
133
|
+
command :list, list_desc, :options => OpenNebulaHelper::FORMAT do
|
117
134
|
helper.list_service_template_pool(helper.client(options), options)
|
118
135
|
end
|
119
136
|
|
@@ -141,7 +158,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
141
158
|
Show detailed information of a given Service Template
|
142
159
|
EOT
|
143
160
|
|
144
|
-
command :show,
|
161
|
+
command :show,
|
162
|
+
show_desc,
|
163
|
+
:templateid,
|
164
|
+
:options => OpenNebulaHelper::FORMAT do
|
145
165
|
helper.format_resource(helper.client(options), args[0], options)
|
146
166
|
end
|
147
167
|
|
@@ -174,11 +194,28 @@ CommandParser::CmdParser.new(ARGV) do
|
|
174
194
|
Delete a given Service Template
|
175
195
|
EOT
|
176
196
|
|
177
|
-
command :delete,
|
197
|
+
command :delete,
|
198
|
+
delete_desc,
|
199
|
+
[:range, :templateid_list],
|
200
|
+
:options => [DELETE_TEMPLATES, DELETE_IMAGES] do
|
178
201
|
client = helper.client(options)
|
179
202
|
|
203
|
+
# :templates => delete just VM templates
|
204
|
+
# :all => delete VM templates and images
|
205
|
+
# :none => do not delete anything
|
206
|
+
if options.key?(:delete_templates)
|
207
|
+
delete = 'templates'
|
208
|
+
elsif options.key?(:delete_images)
|
209
|
+
delete = 'all'
|
210
|
+
else
|
211
|
+
delete = 'none'
|
212
|
+
end
|
213
|
+
|
214
|
+
body = {}
|
215
|
+
body['delete_type'] = delete
|
216
|
+
|
180
217
|
Service.perform_actions(args[0]) do |template_id|
|
181
|
-
client.delete("#{RESOURCE_PATH}/#{template_id}")
|
218
|
+
client.delete("#{RESOURCE_PATH}/#{template_id}", body.to_json)
|
182
219
|
end
|
183
220
|
end
|
184
221
|
|
data/bin/onegroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -53,8 +56,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
53
56
|
########################################################################
|
54
57
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
55
58
|
|
56
|
-
list_options
|
57
|
-
list_options
|
59
|
+
list_options = CLIHelper::OPTIONS
|
60
|
+
list_options += OpenNebulaHelper::FORMAT
|
58
61
|
list_options << OpenNebulaHelper::NUMERIC
|
59
62
|
list_options << OpenNebulaHelper::DESCRIBE
|
60
63
|
|
@@ -166,7 +169,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
166
169
|
EOT
|
167
170
|
|
168
171
|
command :show, show_desc, [:groupid, nil],
|
169
|
-
:options => OpenNebulaHelper::
|
172
|
+
:options => OpenNebulaHelper::FORMAT do
|
170
173
|
group = args[0] || OpenNebula::Group::SELF
|
171
174
|
helper.show_resource(group, options)
|
172
175
|
end
|