opennebula-cli 5.12.13 → 5.13.80.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/oneacct +5 -14
- data/bin/oneacl +4 -15
- data/bin/onecluster +6 -17
- data/bin/onedatastore +6 -17
- data/bin/oneflow +81 -23
- data/bin/oneflow-template +51 -27
- data/bin/onegroup +6 -17
- data/bin/onehook +6 -17
- data/bin/onehost +4 -15
- data/bin/oneimage +95 -18
- data/bin/onemarket +6 -17
- data/bin/onemarketapp +113 -20
- data/bin/onesecgroup +9 -17
- data/bin/oneshowback +14 -20
- data/bin/onetemplate +8 -18
- data/bin/oneuser +26 -17
- data/bin/onevcenter +6 -28
- data/bin/onevdc +6 -17
- data/bin/onevm +142 -21
- data/bin/onevmgroup +9 -17
- data/bin/onevnet +4 -15
- data/bin/onevntemplate +7 -17
- data/bin/onevrouter +6 -17
- data/bin/onezone +6 -17
- data/lib/cli_helper.rb +7 -10
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper/oneacct_helper.rb +9 -22
- 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 +7 -7
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +494 -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 +9 -9
- 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 +12 -1
- data/lib/one_helper.rb +398 -37
- 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 +49 -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/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 +92 -30
- data/lib/one_helper/oneprovision_helper.rb +0 -362
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 133ad6e159617025214647d52dbcb5d41f3093cf
|
4
|
+
data.tar.gz: 11cdb1ed429159108f9374034cf3fbe7a7866b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6450713483ad56c4eea014eb294043d0c83b6d29175c5c123a50e854bc5b08ffc9ecfe034dd19b7dc04655b6581152d047df29e475fdbd16bb812ee9b3701cf
|
7
|
+
data.tar.gz: 2633fb675faf36ec1c5d7bf20c57ecaf22f2af9404a5141a7310049108574f2e41b75f260936aa4e9109051ad600341605f350ccd2beeb9d5c61e2bb4e4a0657
|
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 #
|
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -123,12 +112,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
123
112
|
puts xml_str
|
124
113
|
end
|
125
114
|
else
|
115
|
+
# rubocop:disable Naming/VariableNumber
|
126
116
|
order_by = {}
|
127
117
|
order_by[:order_by_1] = 'VM/UID'
|
128
118
|
|
129
119
|
if options[:split] && !options[:csv]
|
130
120
|
order_by[:order_by_2] = 'VM/ID'
|
131
121
|
end
|
122
|
+
# rubocop:enable Naming/VariableNumber
|
132
123
|
|
133
124
|
acct_hash = pool.accounting(filter_flag,
|
134
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 #
|
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -117,7 +106,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
117
106
|
EOT
|
118
107
|
|
119
108
|
command :list, list_desc, :options => [CLIHelper::OPTIONS,
|
120
|
-
OpenNebulaHelper::
|
109
|
+
OpenNebulaHelper::FORMAT,
|
121
110
|
OpenNebulaHelper::DESCRIBE] do
|
122
111
|
helper.list_pool(options)
|
123
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 #
|
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -67,8 +56,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
67
56
|
########################################################################
|
68
57
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
69
58
|
|
70
|
-
list_options
|
71
|
-
list_options
|
59
|
+
list_options = CLIHelper::OPTIONS
|
60
|
+
list_options += OpenNebulaHelper::FORMAT
|
72
61
|
list_options << OpenNebulaHelper::NUMERIC
|
73
62
|
list_options << OpenNebulaHelper::DESCRIBE
|
74
63
|
|
@@ -133,7 +122,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
133
122
|
EOT
|
134
123
|
|
135
124
|
command :show, show_desc, :clusterid,
|
136
|
-
:options => [OpenNebulaHelper::
|
125
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
137
126
|
helper.show_resource(args[0], options)
|
138
127
|
end
|
139
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 #
|
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -68,8 +57,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
68
57
|
########################################################################
|
69
58
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
70
59
|
|
71
|
-
list_options
|
72
|
-
list_options
|
60
|
+
list_options = CLIHelper::OPTIONS
|
61
|
+
list_options += OpenNebulaHelper::FORMAT
|
73
62
|
list_options << OpenNebulaHelper::NUMERIC
|
74
63
|
list_options << OpenNebulaHelper::DESCRIBE
|
75
64
|
|
@@ -175,7 +164,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
175
164
|
EOT
|
176
165
|
|
177
166
|
command :show, show_desc, :datastoreid,
|
178
|
-
:options => [OpenNebulaHelper::
|
167
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
179
168
|
helper.show_resource(args[0], options)
|
180
169
|
end
|
181
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 #
|
@@ -26,30 +26,20 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
51
40
|
|
52
41
|
require 'json'
|
42
|
+
require 'tempfile'
|
53
43
|
|
54
44
|
require 'command_parser'
|
55
45
|
require 'opennebula/oneflow_client'
|
@@ -68,12 +58,6 @@ CommandParser::CmdParser.new(ARGV) do
|
|
68
58
|
set :option, CommandParser::VERSION
|
69
59
|
set :option, CommandParser::HELP
|
70
60
|
|
71
|
-
DONE = {
|
72
|
-
:name => 'done',
|
73
|
-
:large => '--done',
|
74
|
-
:description => 'Show services in DONE state'
|
75
|
-
}
|
76
|
-
|
77
61
|
ARGS = {
|
78
62
|
:name => 'args',
|
79
63
|
:large => '--args arg1,arg2',
|
@@ -127,7 +111,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
127
111
|
List the available services
|
128
112
|
EOT
|
129
113
|
|
130
|
-
command :list, list_desc, :options =>
|
114
|
+
command :list, list_desc, :options => OpenNebulaHelper::FORMAT do
|
131
115
|
helper.list_service_pool(helper.client(options), options)
|
132
116
|
end
|
133
117
|
|
@@ -137,7 +121,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
137
121
|
Top the available services
|
138
122
|
EOT
|
139
123
|
|
140
|
-
command :top, top_desc, :options => [CLIHelper::DELAY
|
124
|
+
command :top, top_desc, :options => [CLIHelper::DELAY] do
|
141
125
|
Signal.trap('INT') { exit(-1) }
|
142
126
|
|
143
127
|
helper.top_service_pool(helper.client(options), options)
|
@@ -151,7 +135,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
151
135
|
Show detailed information of a given service
|
152
136
|
EOT
|
153
137
|
|
154
|
-
command :show,
|
138
|
+
command :show,
|
139
|
+
show_desc,
|
140
|
+
:service_id,
|
141
|
+
:options => OpenNebulaHelper::FORMAT do
|
155
142
|
helper.format_resource(helper.client(options), args[0], options)
|
156
143
|
end
|
157
144
|
|
@@ -359,4 +346,75 @@ CommandParser::CmdParser.new(ARGV) do
|
|
359
346
|
client.post("#{RESOURCE_PATH}/#{service_id}/action", json)
|
360
347
|
end
|
361
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
|
362
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 #
|
@@ -28,25 +28,14 @@ else
|
|
28
28
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
29
29
|
end
|
30
30
|
|
31
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
32
31
|
if File.directory?(GEMS_LOCATION)
|
33
32
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
34
33
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
35
34
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
36
|
-
|
37
|
-
|
38
|
-
# https://github.com/OpenNebula/one/issues/5379
|
39
|
-
begin
|
40
|
-
verb = $VERBOSE
|
41
|
-
$VERBOSE = nil
|
42
|
-
require 'rubygems'
|
43
|
-
Gem.use_paths(real_gems_path)
|
44
|
-
ensure
|
45
|
-
$VERBOSE = verb
|
46
|
-
end
|
35
|
+
require 'rubygems'
|
36
|
+
Gem.use_paths(real_gems_path)
|
47
37
|
end
|
48
38
|
end
|
49
|
-
# %%RUBYGEMS_SETUP_END%%
|
50
39
|
|
51
40
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
52
41
|
$LOAD_PATH << ONEFLOW_LOCATION
|
@@ -90,6 +79,20 @@ CommandParser::CmdParser.new(ARGV) do
|
|
90
79
|
:description => 'Clone the template recursively (just templates)'
|
91
80
|
}
|
92
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
|
+
|
93
96
|
usage '`oneflow-template` <command> [<args>] [<options>]'
|
94
97
|
version OpenNebulaHelper::ONE_VERSION
|
95
98
|
|
@@ -127,7 +130,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
127
130
|
List the available Service Templates
|
128
131
|
EOT
|
129
132
|
|
130
|
-
command :list, list_desc, :options =>
|
133
|
+
command :list, list_desc, :options => OpenNebulaHelper::FORMAT do
|
131
134
|
helper.list_service_template_pool(helper.client(options), options)
|
132
135
|
end
|
133
136
|
|
@@ -155,7 +158,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
155
158
|
Show detailed information of a given Service Template
|
156
159
|
EOT
|
157
160
|
|
158
|
-
command :show,
|
161
|
+
command :show,
|
162
|
+
show_desc,
|
163
|
+
:templateid,
|
164
|
+
:options => OpenNebulaHelper::FORMAT do
|
159
165
|
helper.format_resource(helper.client(options), args[0], options)
|
160
166
|
end
|
161
167
|
|
@@ -188,11 +194,28 @@ CommandParser::CmdParser.new(ARGV) do
|
|
188
194
|
Delete a given Service Template
|
189
195
|
EOT
|
190
196
|
|
191
|
-
command :delete,
|
197
|
+
command :delete,
|
198
|
+
delete_desc,
|
199
|
+
[:range, :templateid_list],
|
200
|
+
:options => [DELETE_TEMPLATES, DELETE_IMAGES] do
|
192
201
|
client = helper.client(options)
|
193
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
|
+
|
194
217
|
Service.perform_actions(args[0]) do |template_id|
|
195
|
-
client.delete("#{RESOURCE_PATH}/#{template_id}")
|
218
|
+
client.delete("#{RESOURCE_PATH}/#{template_id}", body.to_json)
|
196
219
|
end
|
197
220
|
end
|
198
221
|
|
@@ -202,26 +225,26 @@ CommandParser::CmdParser.new(ARGV) do
|
|
202
225
|
Instantiate a Service Template
|
203
226
|
EOT
|
204
227
|
|
205
|
-
command :instantiate,
|
228
|
+
command :instantiate,
|
229
|
+
instantiate_desc,
|
230
|
+
:templateid,
|
231
|
+
[:file, nil],
|
206
232
|
:options => [MULTIPLE, Service::JSON_FORMAT, Service::TOP] do
|
207
233
|
number = options[:multiple] || 1
|
208
234
|
params = {}
|
209
235
|
rc = 0
|
210
|
-
client = helper.client(options)
|
211
236
|
|
212
237
|
number.times do
|
213
238
|
params['merge_template'] = nil
|
214
239
|
params['merge_template'] = JSON.parse(File.read(args[1])) if args[1]
|
215
240
|
|
216
241
|
unless params['merge_template']
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
break
|
222
|
-
end
|
242
|
+
service_template = OpenNebula::ServiceTemplate
|
243
|
+
.new_with_id(args[0],
|
244
|
+
OpenNebula::Client.new)
|
245
|
+
service_template.info
|
223
246
|
|
224
|
-
body = JSON.parse(
|
247
|
+
body = JSON.parse(service_template['/DOCUMENT/TEMPLATE/BODY'])
|
225
248
|
|
226
249
|
params['merge_template'] = helper.custom_attrs(
|
227
250
|
body['custom_attrs']
|
@@ -234,6 +257,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
234
257
|
end
|
235
258
|
|
236
259
|
json = Service.build_json_action('instantiate', params)
|
260
|
+
client = helper.client(options)
|
237
261
|
response = client.post("#{RESOURCE_PATH}/#{args[0]}/action", json)
|
238
262
|
|
239
263
|
if CloudClient.is_error?(response)
|
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 #
|
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -67,8 +56,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
67
56
|
########################################################################
|
68
57
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
69
58
|
|
70
|
-
list_options
|
71
|
-
list_options
|
59
|
+
list_options = CLIHelper::OPTIONS
|
60
|
+
list_options += OpenNebulaHelper::FORMAT
|
72
61
|
list_options << OpenNebulaHelper::NUMERIC
|
73
62
|
list_options << OpenNebulaHelper::DESCRIBE
|
74
63
|
|
@@ -180,7 +169,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
180
169
|
EOT
|
181
170
|
|
182
171
|
command :show, show_desc, [:groupid, nil],
|
183
|
-
:options => OpenNebulaHelper::
|
172
|
+
:options => OpenNebulaHelper::FORMAT do
|
184
173
|
group = args[0] || OpenNebula::Group::SELF
|
185
174
|
helper.show_resource(group, options)
|
186
175
|
end
|
data/bin/onehook
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 #
|
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -147,8 +136,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
147
136
|
########################################################################
|
148
137
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
149
138
|
|
150
|
-
list_options
|
151
|
-
list_options
|
139
|
+
list_options = CLIHelper::OPTIONS
|
140
|
+
list_options += OpenNebulaHelper::FORMAT
|
152
141
|
list_options << OpenNebulaHelper::NUMERIC
|
153
142
|
list_options << OpenNebulaHelper::DESCRIBE
|
154
143
|
|
@@ -242,7 +231,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
242
231
|
EOT
|
243
232
|
|
244
233
|
command :show, show_desc, :hookid,
|
245
|
-
:options => [OpenNebulaHelper::
|
234
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::EXTENDED,
|
246
235
|
EXECUTION] do
|
247
236
|
helper.show_resource(args[0], options)
|
248
237
|
end
|