opennebula-cli 5.12.4 → 5.12.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 806947ac1f01c5fa987378a3391772955b54e2d2
4
- data.tar.gz: 2c2f5d50a2dcca17e29699e2161a3ee2785ef9e9
3
+ metadata.gz: 6ffe5519361d8bfe5ec8049e21fcc525f31df1af
4
+ data.tar.gz: c6c8c856980868f1940e2006f9e606e7e2541a20
5
5
  SHA512:
6
- metadata.gz: d349474f920bd5d31403068e415cef40b53907f298f3c7512bfab0d09f754c25c9c84077978ba5b03d000f63b879b0ff140a878c664f7310a6bacde5c0d7b618
7
- data.tar.gz: 118f7024189d248b6dfe16d8b6c41e1d3e8a02d720aeadc98eac4447f7efcf27822238473387a7c648071f9111268bc7cc44c69ac2e8ccbf2800cf82d9bd3870
6
+ metadata.gz: 547bae16979befeb2d672f25718e6b46e34a7fb3dd86f18dbce903dc86a44d6289b7fbed81e5e944b0e3605e6e617f4c12d8e91e0a69b320d91e367420353b2f
7
+ data.tar.gz: 714d0229222f5f7b6fbe512b6b830f9393ddb4409622013d0a0a6bf6e3ac21a1d45be6596d97f30918457dc454a72435f6426562b8cb8b05371b5270a440d9a6
data/bin/oneshowback CHANGED
@@ -172,8 +172,13 @@ CommandParser::CmdParser.new(ARGV) do
172
172
  end_year)
173
173
 
174
174
  if OpenNebula.is_error?(rc)
175
- warn rc.message
176
- exit(-1)
175
+ if rc.message.include? "ReadTimeout"
176
+ warn "Showback calculation takes too long, continuing in background"
177
+ exit_code 0
178
+ else
179
+ warn rc.message
180
+ exit(-1)
181
+ end
177
182
  else
178
183
  puts rc
179
184
  exit_code 0
data/bin/onetemplate CHANGED
@@ -261,8 +261,11 @@ CommandParser::CmdParser.new(ARGV) do
261
261
  if !user_inputs
262
262
  user_inputs = OneTemplateHelper.get_user_inputs(t.to_hash)
263
263
  else
264
- optionals = OneTemplateHelper.get_user_inputs(t.to_hash,
265
- true)
264
+ optionals = OneTemplateHelper.get_user_inputs(
265
+ t.to_hash,
266
+ options[:user_inputs_keys],
267
+ )
268
+
266
269
  user_inputs = user_inputs + "\n" + optionals
267
270
  end
268
271
 
data/bin/onevcenter CHANGED
@@ -155,6 +155,7 @@ CommandParser::CmdParser.new(ARGV) do
155
155
  begin
156
156
  args = helper.parse_opts(options)
157
157
  args[:filter] = true
158
+ args[:short] = true
158
159
  vi_client = VCenterDriver::VIClient.new_from_host(options[:host])
159
160
  importer = VCenterDriver::VcImporter
160
161
  .new_child(helper.client, vi_client, options[:object])
@@ -185,6 +186,7 @@ CommandParser::CmdParser.new(ARGV) do
185
186
  begin
186
187
  args = helper.parse_opts(options)
187
188
  args[:filter] = false
189
+ args[:short] = true
188
190
  vi_client = VCenterDriver::VIClient.new_from_host(options[:host])
189
191
  importer = VCenterDriver::VcImporter
190
192
  .new_child(helper.client, vi_client, options[:object])
@@ -255,10 +257,21 @@ CommandParser::CmdParser.new(ARGV) do
255
257
  importer = VCenterDriver::VcImporter.new_child(helper.client,
256
258
  vi_client,
257
259
  options[:object])
258
- importer.retrieve_resources(helper.parse_opts(options))
259
- indexes = importer.get_indexes(args.first)
260
260
 
261
- importer.process_import(indexes)
261
+ if options[:object] == "networks" && !args.first.nil?
262
+ indexes = args.first
263
+ else
264
+ importer.retrieve_resources(helper.parse_opts(options))
265
+ indexes = importer.get_indexes(args.first)
266
+ end
267
+
268
+ if indexes.nil?
269
+ raise "Could not get any unimported #{options[:object]}"\
270
+ " resources info in host: #{options[:host]} with"\
271
+ " this input: #{args.first}"
272
+ end
273
+
274
+ importer.process_import(indexes, options)
262
275
 
263
276
  importer.stdout
264
277
  rescue StandardError => e
data/bin/onevm CHANGED
@@ -1271,7 +1271,7 @@ CommandParser::CmdParser.new(ARGV) do
1271
1271
  lock_desc = <<-EOT.unindent
1272
1272
  Locks a VM with differents levels for lock any actions with this VM, show and
1273
1273
  monitoring never will be locked.
1274
- Aalid states are: All.
1274
+ Valid states are: All.
1275
1275
  EOT
1276
1276
 
1277
1277
  command :lock, lock_desc, :vmid,
data/lib/cli_helper.rb CHANGED
@@ -532,7 +532,7 @@ module CLIHelper
532
532
  # @param data [Array] Array with data to show
533
533
  # @param del [Char] CSV delimiter
534
534
  def print_csv_data(data, del)
535
- del ? del = del : del = ','
535
+ del ||= ','
536
536
 
537
537
  data.each do |l|
538
538
  result = []
data/lib/one_helper.rb CHANGED
@@ -383,9 +383,15 @@ EOT
383
383
  :format => Array,
384
384
  :description => 'Specify the user inputs values when instantiating',
385
385
  :proc => lambda do |o, options|
386
+ # Store user inputs that has been already processed
387
+ options[:user_inputs_keys] = []
388
+
386
389
  # escape values
387
390
  options[:user_inputs].map! do |user_input|
388
391
  user_input_split = user_input.split('=')
392
+
393
+ options[:user_inputs_keys] << user_input_split[0]
394
+
389
395
  "#{user_input_split[0]}=\"#{user_input_split[1]}\""
390
396
  end
391
397
 
@@ -519,8 +525,12 @@ EOT
519
525
  @translation_hash = nil
520
526
  end
521
527
 
522
- def set_client(options)
523
- @client=OpenNebulaHelper::OneHelper.get_client(options, true)
528
+ def set_client(options, client=nil)
529
+ if client.nil?
530
+ @client=OpenNebulaHelper::OneHelper.get_client(options, true)
531
+ else
532
+ @client = client
533
+ end
524
534
  end
525
535
 
526
536
  def create_resource(options, &block)
@@ -1705,8 +1715,8 @@ EOT
1705
1715
  end
1706
1716
  end
1707
1717
 
1708
- def OpenNebulaHelper.parse_user_inputs(inputs, get_defaults = false)
1709
- unless get_defaults
1718
+ def OpenNebulaHelper.parse_user_inputs(inputs, keys = [])
1719
+ unless inputs.keys == keys
1710
1720
  puts 'There are some parameters that require user input. ' \
1711
1721
  'Use the string <<EDITOR>> to launch an editor ' \
1712
1722
  '(e.g. for multi-line inputs)'
@@ -1715,6 +1725,8 @@ EOT
1715
1725
  answers = {}
1716
1726
 
1717
1727
  inputs.each do |key, val|
1728
+ next if keys.include? key
1729
+
1718
1730
  input_cfg = val.split('|', -1)
1719
1731
 
1720
1732
  if input_cfg.length < 3
@@ -1741,11 +1753,6 @@ EOT
1741
1753
  initial.strip!
1742
1754
  end
1743
1755
 
1744
- if get_defaults
1745
- answers[key]= initial unless mandatory == 'M'
1746
- next
1747
- end
1748
-
1749
1756
  puts " * (#{key}) #{description}"
1750
1757
 
1751
1758
  header = ' '
@@ -20,6 +20,10 @@ require 'one_helper/onevm_helper'
20
20
  # CLI helper for oneimage command
21
21
  class OneImageHelper < OpenNebulaHelper::OneHelper
22
22
 
23
+ # This list contains prefixes that should skip adding user home to the path
24
+ # This must have the same content as the case $FROM in downloader.sh
25
+ PREFIXES = %w[http https ssh s3 rbd vcenter lxd docker]
26
+
23
27
  TEMPLATE_OPTIONS=[
24
28
  {
25
29
  :name => 'name',
@@ -82,7 +86,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
82
86
  :description => 'Path of the image file',
83
87
  :format => String,
84
88
  :proc => lambda do |o, _options|
85
- next [0, o] if o.match(%r{^(https?|docker)://})
89
+ next [0, o] if o.match(%r{^(#{PREFIXES.join('|')})://})
86
90
 
87
91
  if o[0, 1]=='/'
88
92
  path=o
@@ -128,15 +128,16 @@ EOT
128
128
  INT_EXP = /^-?\d+$/
129
129
  FLOAT_EXP = /^-?\d+(\.\d+)?$/
130
130
 
131
- def self.get_user_inputs(template, get_defaults = false)
131
+ def self.get_user_inputs(template, keys = [])
132
132
  user_inputs = template['VMTEMPLATE']['TEMPLATE']['USER_INPUTS']
133
133
 
134
134
  return '' unless user_inputs
135
135
 
136
- answers = OpenNebulaHelper.parse_user_inputs(user_inputs, get_defaults)
137
-
136
+ answers = OpenNebulaHelper.parse_user_inputs(user_inputs, keys)
138
137
  answers_s = ''
139
138
  answers.each do |key, val|
139
+ next unless val
140
+
140
141
  # Do not replace values that are equal to the ones already in the
141
142
  # template. Useful for cpu, mem, vcpu
142
143
  if key != template['VMTEMPLATE']['TEMPLATE'][key]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.12.4
4
+ version: 5.12.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,19 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.12.4
19
+ version: 5.12.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.12.4
26
+ version: 5.12.9
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.io
29
29
  executables:
30
30
  - oneacct
31
- - onevcenter
32
31
  - oneacl
33
32
  - onecluster
34
33
  - onedatastore
@@ -44,6 +43,7 @@ executables:
44
43
  - oneshowback
45
44
  - onetemplate
46
45
  - oneuser
46
+ - onevcenter
47
47
  - onevdc
48
48
  - onevm
49
49
  - onevmgroup
@@ -55,7 +55,6 @@ extensions: []
55
55
  extra_rdoc_files: []
56
56
  files:
57
57
  - bin/oneacct
58
- - bin/onevcenter
59
58
  - bin/oneacl
60
59
  - bin/onecluster
61
60
  - bin/onedatastore
@@ -71,6 +70,7 @@ files:
71
70
  - bin/oneshowback
72
71
  - bin/onetemplate
73
72
  - bin/oneuser
73
+ - bin/onevcenter
74
74
  - bin/onevdc
75
75
  - bin/onevm
76
76
  - bin/onevmgroup
@@ -78,17 +78,22 @@ files:
78
78
  - bin/onevntemplate
79
79
  - bin/onevrouter
80
80
  - bin/onezone
81
- - lib/command_parser.rb
82
81
  - lib/cli_helper.rb
82
+ - lib/command_parser.rb
83
83
  - lib/one_helper.rb
84
+ - lib/one_helper/oneacct_helper.rb
84
85
  - lib/one_helper/oneacl_helper.rb
85
86
  - lib/one_helper/onecluster_helper.rb
86
87
  - lib/one_helper/onedatastore_helper.rb
88
+ - lib/one_helper/oneflow_helper.rb
89
+ - lib/one_helper/oneflowtemplate_helper.rb
87
90
  - lib/one_helper/onegroup_helper.rb
88
91
  - lib/one_helper/onehook_helper.rb
92
+ - lib/one_helper/onehost_helper.rb
89
93
  - lib/one_helper/oneimage_helper.rb
90
94
  - lib/one_helper/onemarket_helper.rb
91
95
  - lib/one_helper/onemarketapp_helper.rb
96
+ - lib/one_helper/oneprovision_helper.rb
92
97
  - lib/one_helper/onequota_helper.rb
93
98
  - lib/one_helper/onesecgroup_helper.rb
94
99
  - lib/one_helper/onetemplate_helper.rb
@@ -101,11 +106,6 @@ files:
101
106
  - lib/one_helper/onevntemplate_helper.rb
102
107
  - lib/one_helper/onevrouter_helper.rb
103
108
  - lib/one_helper/onezone_helper.rb
104
- - lib/one_helper/oneacct_helper.rb
105
- - lib/one_helper/oneflow_helper.rb
106
- - lib/one_helper/oneflowtemplate_helper.rb
107
- - lib/one_helper/onehost_helper.rb
108
- - lib/one_helper/oneprovision_helper.rb
109
109
  - NOTICE
110
110
  - LICENSE
111
111
  homepage: http://opennebula.io