opennebula-cli 5.12.12 → 5.13.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 +5 -5
- data/bin/oneacct +4 -13
- data/bin/oneacl +3 -14
- data/bin/onecluster +5 -16
- data/bin/onedatastore +5 -16
- data/bin/oneflow +80 -22
- data/bin/oneflow-template +40 -17
- data/bin/onegroup +5 -16
- data/bin/onehook +5 -16
- data/bin/onehost +3 -14
- data/bin/oneimage +94 -17
- data/bin/onemarket +5 -16
- data/bin/onemarketapp +112 -19
- data/bin/onesecgroup +8 -16
- data/bin/oneshowback +13 -19
- data/bin/onetemplate +7 -17
- data/bin/oneuser +25 -16
- data/bin/onevcenter +5 -27
- data/bin/onevdc +5 -16
- data/bin/onevm +141 -20
- data/bin/onevmgroup +8 -16
- data/bin/onevnet +3 -14
- data/bin/onevntemplate +6 -16
- data/bin/onevrouter +5 -16
- data/bin/onezone +5 -16
- data/lib/cli_helper.rb +6 -9
- data/lib/one_helper/oneacct_helper.rb +8 -21
- data/lib/one_helper/onedatastore_helper.rb +10 -0
- data/lib/one_helper/oneflow_helper.rb +19 -4
- data/lib/one_helper/oneflowtemplate_helper.rb +27 -1
- data/lib/one_helper/onehost_helper.rb +0 -4
- data/lib/one_helper/oneimage_helper.rb +6 -6
- data/lib/one_helper/onemarketapp_helper.rb +493 -95
- data/lib/one_helper/onetemplate_helper.rb +11 -0
- data/lib/one_helper/oneuser_helper.rb +10 -2
- data/lib/one_helper/onevcenter_helper.rb +175 -145
- data/lib/one_helper/onevm_helper.rb +8 -8
- data/lib/one_helper/onevrouter_helper.rb +0 -19
- data/lib/one_helper/onezone_helper.rb +11 -0
- data/lib/one_helper.rb +396 -35
- 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
data/bin/oneimage
CHANGED
|
@@ -26,29 +26,19 @@ 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
|
|
|
41
|
+
require 'tempfile'
|
|
52
42
|
require 'command_parser'
|
|
53
43
|
require 'one_helper/oneimage_helper'
|
|
54
44
|
require 'one_helper/onedatastore_helper'
|
|
@@ -87,17 +77,25 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
87
77
|
:description => 'lock all actions'
|
|
88
78
|
}
|
|
89
79
|
|
|
80
|
+
NO_CONTEXT = {
|
|
81
|
+
:name => 'no_context',
|
|
82
|
+
:large => '--no-context',
|
|
83
|
+
:description => 'Do not add context when building from Dockerfile'
|
|
84
|
+
}
|
|
85
|
+
|
|
90
86
|
########################################################################
|
|
91
87
|
# Global Options
|
|
92
88
|
########################################################################
|
|
93
89
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
94
90
|
|
|
95
|
-
list_options
|
|
96
|
-
list_options
|
|
91
|
+
list_options = CLIHelper::OPTIONS
|
|
92
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
97
93
|
list_options << OpenNebulaHelper::NUMERIC
|
|
98
94
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
99
95
|
|
|
100
|
-
CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
|
96
|
+
CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
|
97
|
+
OneImageHelper::IMAGE,
|
|
98
|
+
NO_CONTEXT]
|
|
101
99
|
|
|
102
100
|
########################################################################
|
|
103
101
|
# Formatters for arguments
|
|
@@ -182,6 +180,15 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
182
180
|
next -1
|
|
183
181
|
end
|
|
184
182
|
|
|
183
|
+
# Add context information when building image (just working on Docker)
|
|
184
|
+
if (options.key? :no_context) && options[:path]
|
|
185
|
+
if options[:path].include?('?')
|
|
186
|
+
options[:path] << '&context=no'
|
|
187
|
+
else
|
|
188
|
+
options[:path] << '?context=no'
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
185
192
|
helper.create_resource(options) do |image|
|
|
186
193
|
begin
|
|
187
194
|
if args[0]
|
|
@@ -404,7 +411,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
404
411
|
Shows information for the given Image
|
|
405
412
|
EOT
|
|
406
413
|
|
|
407
|
-
command :show, show_desc, :imageid,
|
|
414
|
+
command :show, show_desc, :imageid,
|
|
415
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
|
408
416
|
helper.show_resource(args[0], options)
|
|
409
417
|
end
|
|
410
418
|
|
|
@@ -464,4 +472,73 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
464
472
|
|
|
465
473
|
return 0
|
|
466
474
|
end
|
|
475
|
+
|
|
476
|
+
dockerfile_desc = <<-EOT.unindent
|
|
477
|
+
Create an image based on a Dockerfile
|
|
478
|
+
EOT
|
|
479
|
+
|
|
480
|
+
command :dockerfile,
|
|
481
|
+
dockerfile_desc,
|
|
482
|
+
:options => CREATE_OPTIONS +
|
|
483
|
+
OneImageHelper::TEMPLATE_OPTIONS do
|
|
484
|
+
# Check user options
|
|
485
|
+
unless options[:datastore]
|
|
486
|
+
STDERR.puts 'Datastore to save the image is mandatory: '
|
|
487
|
+
STDERR.puts '\t -d datastore_id'
|
|
488
|
+
exit(-1)
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
unless options[:name]
|
|
492
|
+
STDERR.puts 'No name provided'
|
|
493
|
+
exit(-1)
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
unless options[:size]
|
|
497
|
+
STDERR.puts 'No size given'
|
|
498
|
+
exit(-1)
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
# Prepare editor
|
|
502
|
+
tmp = Tempfile.new('dockerfile')
|
|
503
|
+
|
|
504
|
+
if ENV['EDITOR']
|
|
505
|
+
editor_path = ENV['EDITOR']
|
|
506
|
+
else
|
|
507
|
+
editor_path = EDITOR_PATH
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
system("#{editor_path} #{tmp.path}")
|
|
511
|
+
|
|
512
|
+
unless $CHILD_STATUS.exitstatus.zero?
|
|
513
|
+
STDERR.puts('Editor not defined')
|
|
514
|
+
exit(-1)
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
tmp.close
|
|
518
|
+
|
|
519
|
+
# Create image
|
|
520
|
+
helper.create_resource(options) do |image|
|
|
521
|
+
begin
|
|
522
|
+
b64 = Base64.strict_encode64(File.read(tmp.path))
|
|
523
|
+
options[:path] = "dockerfile:///?fileb64=#{b64}&" \
|
|
524
|
+
"size=#{options[:size]}"
|
|
525
|
+
|
|
526
|
+
options[:path] << '&context=no' if options.key?(:no_context)
|
|
527
|
+
|
|
528
|
+
res = OneImageHelper.create_image_template(options)
|
|
529
|
+
|
|
530
|
+
if res.first != 0
|
|
531
|
+
STDERR.puts res.last
|
|
532
|
+
next -1
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
template = res.last
|
|
536
|
+
|
|
537
|
+
image.allocate(template, options[:datastore], false)
|
|
538
|
+
rescue StandardError => e
|
|
539
|
+
STDERR.puts e.message
|
|
540
|
+
exit(-1)
|
|
541
|
+
end
|
|
542
|
+
end
|
|
543
|
+
end
|
|
467
544
|
end
|
data/bin/onemarket
CHANGED
|
@@ -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
|
|
|
@@ -168,7 +157,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
168
157
|
EOT
|
|
169
158
|
|
|
170
159
|
command :show, show_desc,
|
|
171
|
-
:marketplaceid, :options => OpenNebulaHelper::
|
|
160
|
+
:marketplaceid, :options => OpenNebulaHelper::FORMAT do
|
|
172
161
|
helper.show_resource(args[0], options)
|
|
173
162
|
end
|
|
174
163
|
|
data/bin/onemarketapp
CHANGED
|
@@ -28,25 +28,14 @@ else
|
|
|
28
28
|
VAR_LOCATION = ONE_LOCATION + '/var'
|
|
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 << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -56,6 +45,9 @@ require 'one_helper/onemarketapp_helper'
|
|
|
56
45
|
require 'one_helper/onemarket_helper'
|
|
57
46
|
require 'one_helper/onedatastore_helper'
|
|
58
47
|
|
|
48
|
+
require 'vcenter_driver'
|
|
49
|
+
CONFIG = VCenterConf.new
|
|
50
|
+
|
|
59
51
|
CommandParser::CmdParser.new(ARGV) do
|
|
60
52
|
usage '`onemarket` <command> [<args>] [<options>]'
|
|
61
53
|
version OpenNebulaHelper::ONE_VERSION
|
|
@@ -97,20 +89,56 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
97
89
|
:description => 'DockerHub image tag (default latest)'
|
|
98
90
|
}
|
|
99
91
|
|
|
92
|
+
YES = {
|
|
93
|
+
:name => 'yes',
|
|
94
|
+
:large => '--yes',
|
|
95
|
+
:description => 'Import associated VM templates/images',
|
|
96
|
+
:proc => lambda do |_, options|
|
|
97
|
+
options[:yes] = 'yes'
|
|
98
|
+
end
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
NO = {
|
|
102
|
+
:name => 'no',
|
|
103
|
+
:large => '--no',
|
|
104
|
+
:description => 'Do not import/export associated VM templates/images',
|
|
105
|
+
:proc => lambda do |_, options|
|
|
106
|
+
options[:no] = 'no'
|
|
107
|
+
end
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
TEMPLATE = {
|
|
111
|
+
:name => 'template',
|
|
112
|
+
:large => '--template template_id ',
|
|
113
|
+
:description => 'Associate with VM template',
|
|
114
|
+
:format => Integer
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
MARKET = {
|
|
118
|
+
:name => 'market',
|
|
119
|
+
:large => '--market market_id',
|
|
120
|
+
:format => Integer,
|
|
121
|
+
:description => 'Market to import all objects'
|
|
122
|
+
}
|
|
123
|
+
|
|
100
124
|
########################################################################
|
|
101
125
|
# Global Options
|
|
102
126
|
########################################################################
|
|
103
127
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
104
128
|
|
|
105
|
-
list_options
|
|
106
|
-
list_options
|
|
129
|
+
list_options = CLIHelper::OPTIONS
|
|
130
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
107
131
|
list_options << OpenNebulaHelper::NUMERIC
|
|
108
132
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
109
133
|
|
|
110
134
|
CREATE_OPTIONS = [OneMarketPlaceHelper::MARKETPLACE]
|
|
111
135
|
EXPORT_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
|
136
|
+
OneDatastoreHelper::FILE_DATASTORE,
|
|
112
137
|
OneMarketPlaceAppHelper::VMNAME,
|
|
113
|
-
TAG
|
|
138
|
+
TAG,
|
|
139
|
+
NO,
|
|
140
|
+
TEMPLATE]
|
|
141
|
+
IMPORT_OPTIONS = [YES, NO, MARKET, OneMarketPlaceAppHelper::VMNAME]
|
|
114
142
|
|
|
115
143
|
########################################################################
|
|
116
144
|
# Formatters for arguments
|
|
@@ -189,6 +217,60 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
189
217
|
end
|
|
190
218
|
end
|
|
191
219
|
|
|
220
|
+
import_desc = <<-EOT.unindent
|
|
221
|
+
Imports a service template into the marketplace
|
|
222
|
+
EOT
|
|
223
|
+
|
|
224
|
+
command [:'service-template', :import],
|
|
225
|
+
import_desc,
|
|
226
|
+
:service_template_id,
|
|
227
|
+
:options => IMPORT_OPTIONS do
|
|
228
|
+
helper.import(args[0], ServiceTemplate) do |id|
|
|
229
|
+
helper.import_service_template(id, options)
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
vm_import_desc = <<-EOT.unindent
|
|
234
|
+
Imports a VM template into the marketplace
|
|
235
|
+
EOT
|
|
236
|
+
|
|
237
|
+
command [:'vm-template', :import],
|
|
238
|
+
vm_import_desc,
|
|
239
|
+
:vm_template_id,
|
|
240
|
+
:options => IMPORT_OPTIONS do
|
|
241
|
+
helper.import(args[0], TemplatePool) do |id|
|
|
242
|
+
helper.import_vm_template(id, options)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
vm_import_desc = <<-EOT.unindent
|
|
247
|
+
Imports a VM into the marketplace
|
|
248
|
+
EOT
|
|
249
|
+
|
|
250
|
+
command [:vm, :import],
|
|
251
|
+
vm_import_desc,
|
|
252
|
+
:vm_id,
|
|
253
|
+
:options => IMPORT_OPTIONS do
|
|
254
|
+
t_id = helper.save_as_template(
|
|
255
|
+
helper.get_obj_id(args[0], VirtualMachinePool)
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
if OpenNebula.is_error?(t_id)
|
|
259
|
+
STDERR.puts t_id.message
|
|
260
|
+
exit(-1)
|
|
261
|
+
else
|
|
262
|
+
helper.import(t_id, TemplatePool) do |id|
|
|
263
|
+
helper.import_vm_template(id, options)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
puts
|
|
268
|
+
puts 'To delete saved template use: ' \
|
|
269
|
+
"`onetemplate delete #{t_id} --recursive`"
|
|
270
|
+
|
|
271
|
+
0
|
|
272
|
+
end
|
|
273
|
+
|
|
192
274
|
export_desc = <<-EOT.unindent
|
|
193
275
|
Exports the marketplace app to the OpenNebula cloud
|
|
194
276
|
EOT
|
|
@@ -197,20 +279,31 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
197
279
|
helper.perform_action(args[0], options, 'exported') do |obj|
|
|
198
280
|
tag ="tag=#{options[:tag]}" if options[:tag]
|
|
199
281
|
|
|
282
|
+
obj.extend(MarketPlaceAppExt)
|
|
283
|
+
|
|
200
284
|
rc = obj.export(
|
|
201
285
|
:dsid => options[:datastore],
|
|
202
286
|
:name => args[1],
|
|
203
287
|
:vmtemplate_name => options[:vmname],
|
|
204
|
-
:url_args => tag
|
|
288
|
+
:url_args => tag,
|
|
289
|
+
:notemplate => options[:no] == 'no',
|
|
290
|
+
:template => options[:template],
|
|
291
|
+
:default_template => CONFIG[:default_template]
|
|
205
292
|
)
|
|
206
293
|
|
|
207
|
-
|
|
294
|
+
if OpenNebula.is_error?(rc)
|
|
295
|
+
STDERR.puts rc.message
|
|
296
|
+
exit(-1)
|
|
297
|
+
end
|
|
208
298
|
|
|
209
299
|
rc.each do |key, value|
|
|
300
|
+
next if value.nil? || value.empty? || key == :image_type
|
|
301
|
+
|
|
210
302
|
puts key.to_s.upcase
|
|
211
303
|
value.each do |id|
|
|
212
304
|
if OpenNebula.is_error?(id)
|
|
213
305
|
puts id.to_str
|
|
306
|
+
exit(-1)
|
|
214
307
|
else
|
|
215
308
|
puts " ID: #{id}"
|
|
216
309
|
end
|
|
@@ -314,7 +407,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
314
407
|
Shows information for the given marketplace app
|
|
315
408
|
EOT
|
|
316
409
|
|
|
317
|
-
command :show, show_desc, :appid, :options => OpenNebulaHelper::
|
|
410
|
+
command :show, show_desc, :appid, :options => OpenNebulaHelper::FORMAT do
|
|
318
411
|
helper.show_resource(args[0], options)
|
|
319
412
|
end
|
|
320
413
|
|
data/bin/onesecgroup
CHANGED
|
@@ -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
|
|
|
@@ -235,7 +224,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
235
224
|
Shows information for the given Security Group
|
|
236
225
|
EOT
|
|
237
226
|
|
|
238
|
-
command :show,
|
|
227
|
+
command :show,
|
|
228
|
+
show_desc,
|
|
229
|
+
:secgroupid,
|
|
230
|
+
:options => OpenNebulaHelper::FORMAT do
|
|
239
231
|
helper.show_resource(args[0], options)
|
|
240
232
|
end
|
|
241
233
|
end
|
data/bin/oneshowback
CHANGED
|
@@ -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'
|
|
@@ -106,27 +95,31 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
106
95
|
|
|
107
96
|
pool = OpenNebula::VirtualMachinePool.new(helper.client)
|
|
108
97
|
|
|
109
|
-
if options[:json] || options[:xml]
|
|
98
|
+
if options[:json] || options[:xml] || options[:yaml]
|
|
110
99
|
xml_str = pool.showback_xml(filter_flag, common_opts)
|
|
111
100
|
if OpenNebula.is_error?(xml_str)
|
|
112
101
|
puts xml_str.message
|
|
113
102
|
exit(-1)
|
|
114
103
|
end
|
|
115
104
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
xmldoc.initialize_xml(xml_str, 'SHOWBACK_RECORDS')
|
|
105
|
+
xmldoc = XMLElement.new
|
|
106
|
+
xmldoc.initialize_xml(xml_str, 'SHOWBACK_RECORDS')
|
|
119
107
|
|
|
108
|
+
if options[:json]
|
|
120
109
|
puts JSON.pretty_generate(xmldoc.to_hash)
|
|
110
|
+
elsif options[:yaml]
|
|
111
|
+
puts xmldoc.to_hash.to_yaml(:indent => 4)
|
|
121
112
|
elsif options[:xml]
|
|
122
113
|
puts xml_str
|
|
123
114
|
end
|
|
124
115
|
else
|
|
116
|
+
# rubocop:disable Naming/VariableNumber
|
|
125
117
|
order_by = {}
|
|
126
118
|
if !options[:csv]
|
|
127
119
|
order_by[:order_by_1] = 'YEAR'
|
|
128
120
|
order_by[:order_by_2] = 'MONTH'
|
|
129
121
|
end
|
|
122
|
+
# rubocop:enable Naming/VariableNumber
|
|
130
123
|
|
|
131
124
|
data_hash = pool.showback(filter_flag,
|
|
132
125
|
common_opts.merge(order_by))
|
|
@@ -186,8 +179,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
186
179
|
end_year)
|
|
187
180
|
|
|
188
181
|
if OpenNebula.is_error?(rc)
|
|
189
|
-
if rc.message.include?
|
|
190
|
-
warn
|
|
182
|
+
if rc.message.include? 'ReadTimeout'
|
|
183
|
+
warn 'Showback calculation takes too long, '\
|
|
184
|
+
'continuing in background'
|
|
191
185
|
exit_code 0
|
|
192
186
|
else
|
|
193
187
|
warn rc.message
|
data/bin/onetemplate
CHANGED
|
@@ -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'
|
|
@@ -92,8 +81,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
92
81
|
########################################################################
|
|
93
82
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
94
83
|
|
|
95
|
-
list_options
|
|
96
|
-
list_options
|
|
84
|
+
list_options = CLIHelper::OPTIONS
|
|
85
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
97
86
|
list_options << OpenNebulaHelper::NUMERIC
|
|
98
87
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
99
88
|
|
|
@@ -277,7 +266,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
277
266
|
else
|
|
278
267
|
optionals = OneTemplateHelper.get_user_inputs(
|
|
279
268
|
t.to_hash,
|
|
280
|
-
options[:user_inputs_keys]
|
|
269
|
+
options[:user_inputs_keys]
|
|
281
270
|
)
|
|
282
271
|
|
|
283
272
|
user_inputs = user_inputs + "\n" + optionals
|
|
@@ -383,7 +372,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
383
372
|
EOT
|
|
384
373
|
|
|
385
374
|
command :show, show_desc, :templateid,
|
|
386
|
-
:options => [OpenNebulaHelper::
|
|
375
|
+
:options => [OpenNebulaHelper::FORMAT,
|
|
376
|
+
OneTemplateHelper::EXTENDED] do
|
|
387
377
|
helper.show_resource(args[0], options)
|
|
388
378
|
end
|
|
389
379
|
|
data/bin/oneuser
CHANGED
|
@@ -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'
|
|
@@ -82,8 +71,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
82
71
|
########################################################################
|
|
83
72
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
84
73
|
|
|
85
|
-
list_options
|
|
86
|
-
list_options
|
|
74
|
+
list_options = CLIHelper::OPTIONS
|
|
75
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
87
76
|
list_options << OpenNebulaHelper::NUMERIC
|
|
88
77
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
89
78
|
|
|
@@ -573,7 +562,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
573
562
|
EOT
|
|
574
563
|
|
|
575
564
|
command :show, show_desc, [:userid, nil],
|
|
576
|
-
:options => OpenNebulaHelper::
|
|
565
|
+
:options => OpenNebulaHelper::FORMAT do
|
|
577
566
|
user = args[0] || OpenNebula::User::SELF
|
|
578
567
|
helper.show_resource(user, options)
|
|
579
568
|
end
|
|
@@ -815,4 +804,24 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
815
804
|
user.login(username, '', 0)
|
|
816
805
|
end
|
|
817
806
|
end
|
|
807
|
+
|
|
808
|
+
enable_desc = <<-EOT.unindent
|
|
809
|
+
Enables the given User
|
|
810
|
+
EOT
|
|
811
|
+
|
|
812
|
+
command :enable, enable_desc, [:range, :userid_list] do
|
|
813
|
+
helper.perform_actions(args[0], options, 'enabled') do |user|
|
|
814
|
+
user.enable
|
|
815
|
+
end
|
|
816
|
+
end
|
|
817
|
+
|
|
818
|
+
disable_desc = <<-EOT.unindent
|
|
819
|
+
Disables the given User
|
|
820
|
+
EOT
|
|
821
|
+
|
|
822
|
+
command :disable, disable_desc, [:range, :userid_list] do
|
|
823
|
+
helper.perform_actions(args[0], options, 'disabled') do |user|
|
|
824
|
+
user.disable
|
|
825
|
+
end
|
|
826
|
+
end
|
|
818
827
|
end
|