opennebula-cli 6.8.1 → 6.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cf54d4b60a559aec10ac15e21dbbe7b6ec46f6955552809d39f520ef764933f
4
- data.tar.gz: b329c6848fd04338713db8c31728254d54a885fd0c24094d1f67d199a9722b29
3
+ metadata.gz: 15c54d3ad1c7f151f8f8c85761c9e7d807ebaf3b60e11c8ba722f9efa55b5e36
4
+ data.tar.gz: 2162024e4c15e1fe2fcd811adb3a10d84e33943f5f6a67d930a93d2b3734b859
5
5
  SHA512:
6
- metadata.gz: 7509c3cce87f1fc8c0e185612a98b60a91fce02b605c0ba1d551174793730991d099f1f3f66f392c3f0b3a715d8296880da6b4506b578e9017cccce3cdc3ebe2
7
- data.tar.gz: 3c7fde70522ba16e9bbf3e7b8b6719962a23d6c6c51ea21c2ab73151655699aeec66729c2b26213ab91cd432bae5c7932fccdd4d8cc4044eb0ab1604cd9c1000
6
+ metadata.gz: ca211f3593bc2262afaacf6ee1872c00335f7edb86ca52d532fe2abbdfd16d89ba8d4f1b26607c3e44e3bb31e0ed14f33aeefb0cd9cf62b986c0fc8429eb870c
7
+ data.tar.gz: 708bf45d47a6755eb71bba7df087025ee4c2ff016a4d0cb4acff390ff7d3373b3695045e9c63ed5d880011c9520bde7ddc5fc00d20b04d0f8ab3402fb4e96c87
data/bin/onebackupjob CHANGED
@@ -147,8 +147,8 @@ CommandParser::CmdParser.new(ARGV) do
147
147
  begin
148
148
  if args[0]
149
149
  template = File.read(args[0])
150
- elsif STDIN.wait_readable?(0)
151
- template = STDIN.read
150
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
151
+ template = stdin
152
152
  else
153
153
  template = OneBackupJobHelper.create_backupjob_template(options)
154
154
  end
data/bin/onedatastore CHANGED
@@ -115,8 +115,8 @@ CommandParser::CmdParser.new(ARGV) do
115
115
  begin
116
116
  if args[0]
117
117
  template = File.read(args[0])
118
- elsif STDIN.wait_readable(0)
119
- template = STDIN.read
118
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
119
+ template = stdin
120
120
  end
121
121
  datastore.allocate(template, cid)
122
122
  rescue StandardError => e
data/bin/oneflow-template CHANGED
@@ -189,8 +189,8 @@ CommandParser::CmdParser.new(ARGV) do
189
189
 
190
190
  if args[0]
191
191
  template = File.read(args[0])
192
- elsif STDIN.wait_readable(0)
193
- template = STDIN.read
192
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
193
+ template = stdin
194
194
  end
195
195
 
196
196
  if !template
@@ -262,8 +262,8 @@ CommandParser::CmdParser.new(ARGV) do
262
262
 
263
263
  if args[1]
264
264
  template = File.read(args[1])
265
- elsif STDIN.wait_readable(0)
266
- template = STDIN.read
265
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
266
+ template = stdin
267
267
  end
268
268
  params['merge_template'] = JSON.parse(template) if template
269
269
 
data/bin/onehook CHANGED
@@ -176,8 +176,8 @@ CommandParser::CmdParser.new(ARGV) do
176
176
  begin
177
177
  if args[0]
178
178
  template = File.read(args[0])
179
- elsif STDIN.wait_readable(0)
180
- template = STDIN.read
179
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
180
+ template = stdin
181
181
  else
182
182
  STDERR.puts 'No hook template provided'
183
183
  exit(-1)
data/bin/oneimage CHANGED
@@ -216,10 +216,13 @@ CommandParser::CmdParser.new(ARGV) do
216
216
  check_capacity = true
217
217
  end
218
218
 
219
- if (args[0] || STDIN.wait_readable(0)) &&
220
- OpenNebulaHelper.create_template_options_used?(options)
219
+ conflicting_opts = []
220
+ if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
221
+ OneImageHelper.create_template_options_used?(options, conflicting_opts)
222
+
223
+ STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
224
+ "conflicting options: #{conflicting_opts.join(', ')}."
221
225
 
222
- STDERR.puts 'You cannot use both template and template creation options.'
223
226
  next -1
224
227
  end
225
228
 
@@ -236,8 +239,8 @@ CommandParser::CmdParser.new(ARGV) do
236
239
  begin
237
240
  if args[0]
238
241
  template = File.read(args[0])
239
- elsif STDIN.wait_readable(0)
240
- template = STDIN.read
242
+ elsif !stdin.empty?
243
+ template = stdin
241
244
  else
242
245
  res = OneImageHelper.create_image_template(options)
243
246
 
data/bin/onemarket CHANGED
@@ -107,8 +107,8 @@ CommandParser::CmdParser.new(ARGV) do
107
107
  begin
108
108
  if args[0]
109
109
  template = File.read(args[0])
110
- elsif STDIN.wait_readable(0)
111
- template = STDIN.read
110
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
111
+ template = stdin
112
112
  end
113
113
  marketplace.allocate(template)
114
114
  rescue StandardError => e
data/bin/onemarketapp CHANGED
@@ -191,10 +191,12 @@ CommandParser::CmdParser.new(ARGV) do
191
191
  exit(-1)
192
192
  end
193
193
 
194
- if (args[0] || STDIN.wait_readable(0)) &&
195
- OneMarketPlaceAppHelper.create_template_options_used?(options)
196
- STDERR.puts 'You can not use both template file and template'\
197
- ' creation options.'
194
+ conflicting_opts = []
195
+ if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
196
+ OneMarketPlaceAppHelper.create_template_options_used?(options, conflicting_opts)
197
+
198
+ STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
199
+ "conflicting options: #{conflicting_opts.join(', ')}."
198
200
  next -1
199
201
  end
200
202
 
@@ -202,8 +204,8 @@ CommandParser::CmdParser.new(ARGV) do
202
204
  begin
203
205
  if args[0]
204
206
  template = File.read(args[0])
205
- elsif STDIN.wait_readable(0)
206
- template = STDIN.read
207
+ elsif !stdin.empty?
208
+ template = stdin
207
209
  else
208
210
  res = OneMarketPlaceAppHelper
209
211
  .create_datastore_template(options)
data/bin/onesecgroup CHANGED
@@ -112,8 +112,8 @@ CommandParser::CmdParser.new(ARGV) do
112
112
  begin
113
113
  if args[0]
114
114
  template = File.read(args[0])
115
- elsif STDIN.wait_readable(0)
116
- template = STDIN.read
115
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
116
+ template = stdin
117
117
  else
118
118
  STDERR.puts 'No Security Group description provided'
119
119
  exit(-1)
data/bin/onetemplate CHANGED
@@ -166,10 +166,13 @@ CommandParser::CmdParser.new(ARGV) do
166
166
  command :create, create_desc, [:file, nil], :options =>
167
167
  [OneTemplateHelper::VM_NAME] + OpenNebulaHelper::TEMPLATE_OPTIONS +
168
168
  [OpenNebulaHelper::DRY] do
169
- if (args[0] || STDIN.wait_readable(0)) &&
170
- OpenNebulaHelper.create_template_options_used?(options)
169
+ conflicting_opts = []
170
+ if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
171
+ OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
172
+
173
+ STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
174
+ "conflicting options: #{conflicting_opts.join(', ')}."
171
175
 
172
- STDERR.puts 'You can not use both template file and template creation options.'
173
176
  next -1
174
177
  end
175
178
 
@@ -177,8 +180,8 @@ CommandParser::CmdParser.new(ARGV) do
177
180
  begin
178
181
  if args[0]
179
182
  template = File.read(args[0])
180
- elsif STDIN.wait_readable(0)
181
- template = STDIN.read
183
+ elsif !stdin.empty?
184
+ template = stdin
182
185
  else
183
186
  res = OpenNebulaHelper.create_template(options)
184
187
 
@@ -255,11 +258,13 @@ CommandParser::CmdParser.new(ARGV) do
255
258
  command :instantiate, instantiate_desc, :templateid, [:file, nil],
256
259
  :options => instantiate_options + OpenNebulaHelper::TEMPLATE_OPTIONS do
257
260
  exit_code = 0
261
+ conflicting_opts = []
262
+ if (args[1] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
263
+ OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
258
264
 
259
- if (args[1] || STDIN.wait_readable(0)) &&
260
- OpenNebulaHelper.create_template_options_used?(options)
265
+ STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
266
+ "conflicting options: #{conflicting_opts.join(', ')}."
261
267
 
262
- STDERR.puts 'You cannot use both template and template creation options.'
263
268
  next -1
264
269
  end
265
270
 
@@ -305,8 +310,8 @@ CommandParser::CmdParser.new(ARGV) do
305
310
 
306
311
  if args[1]
307
312
  extra_template = File.read(args[1])
308
- elsif STDIN.wait_readable(0)
309
- extra_template = STDIN.read
313
+ elsif !stdin.empty?
314
+ extra_template = stdin
310
315
  else
311
316
  res = OpenNebulaHelper.create_template(options, t)
312
317
 
data/bin/oneuser CHANGED
@@ -621,7 +621,7 @@ CommandParser::CmdParser.new(ARGV) do
621
621
  Example, request a valid token for a generic driver (e.g. core auth, LDAP...):
622
622
  oneuser token-create my_user --time 3600
623
623
 
624
- Example, request a group spefici token (new resources will be created in that
624
+ Example, request a group specific token (new resources will be created in that
625
625
  group and only resources that belong to that group will be listed):
626
626
  oneuser token-create my_user --group <id|group>
627
627
 
data/bin/onevcenter CHANGED
@@ -261,7 +261,7 @@ CommandParser::CmdParser.new(ARGV) do
261
261
  Examples:
262
262
  - importing first datastore
263
263
 
264
- onevcenter list -o templates -h <host_id>
264
+ onevcenter import -o templates -h <host_id>
265
265
 
266
266
  - importing 2 concrete templates:
267
267
 
data/bin/onevm CHANGED
@@ -349,19 +349,21 @@ CommandParser::CmdParser.new(ARGV) do
349
349
  number = options[:multiple] || 1
350
350
  exit_code = nil
351
351
 
352
- if (args[0] || STDIN.wait_readable(0)) &&
353
- OpenNebulaHelper.create_template_options_used?(options)
352
+ conflicting_opts = []
353
+ if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
354
+ OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
355
+
356
+ STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
357
+ "conflicting options: #{conflicting_opts.join(', ')}."
354
358
 
355
- STDERR.puts 'You can not use both template file and template'\
356
- ' creation options.'
357
359
  exit(-1)
358
360
  end
359
361
 
360
362
  begin
361
363
  if args[0]
362
364
  template = File.read(args[0])
363
- elsif STDIN.wait_readable(0)
364
- template = STDIN.read
365
+ elsif !stdin.empty?
366
+ template = stdin
365
367
  else
366
368
  res = OpenNebulaHelper.create_template(options)
367
369
 
@@ -615,8 +617,8 @@ CommandParser::CmdParser.new(ARGV) do
615
617
 
616
618
  if options[:file]
617
619
  extra_template = File.read(options[:file])
618
- elsif STDIN.wait_readable(0)
619
- extra_template = STDIN.read
620
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
621
+ extra_template = stdin
620
622
  end
621
623
 
622
624
  helper.perform_actions(args[0], options, verbose) do |vm|
@@ -689,7 +691,7 @@ CommandParser::CmdParser.new(ARGV) do
689
691
  end
690
692
 
691
693
  resume_desc = <<-EOT.unindent
692
- Resumes the execution of the a saved VM
694
+ Resumes the execution of a saved VM
693
695
 
694
696
  States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF, UNKNOWN
695
697
  EOT
@@ -718,7 +720,7 @@ CommandParser::CmdParser.new(ARGV) do
718
720
  States for success/failure recovers: Any ACTIVE state.
719
721
  States for a retry recover: Any *FAILURE state
720
722
  States for delete: Any
721
- States for delete-recreate: Any but STOP/UNDEPLOYED
723
+ States for recreate: Any but DONE/POWEROFF/SUSPENDED
722
724
  States for delete-db: Any
723
725
  EOT
724
726
 
@@ -774,8 +776,8 @@ CommandParser::CmdParser.new(ARGV) do
774
776
  TARGET, CACHE, DISCARD, PREFIX] do
775
777
  if options[:file]
776
778
  template = File.read(options[:file])
777
- elsif STDIN.wait_readable(0)
778
- template = STDIN.read
779
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
780
+ template = stdin
779
781
  elsif options[:image]
780
782
  image_id = options[:image]
781
783
  target = options[:target]
@@ -851,8 +853,8 @@ CommandParser::CmdParser.new(ARGV) do
851
853
  ] do
852
854
  if options[:file]
853
855
  template = File.read(options[:file])
854
- elsif STDIN.wait_readable(0)
855
- template = STDIN.read
856
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
857
+ template = stdin
856
858
  elsif options[:network]
857
859
  network_id = options[:network]
858
860
  ip = options[:ip]
@@ -1276,8 +1278,8 @@ CommandParser::CmdParser.new(ARGV) do
1276
1278
  :options => OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE, OpenNebulaHelper::FILE] do
1277
1279
  if options[:file]
1278
1280
  template = File.read(options[:file])
1279
- elsif STDIN.wait_readable(0)
1280
- template = STDIN.read
1281
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
1282
+ template = stdin
1281
1283
  else
1282
1284
  template = ''
1283
1285
 
@@ -1373,8 +1375,8 @@ CommandParser::CmdParser.new(ARGV) do
1373
1375
  begin
1374
1376
  if args[1]
1375
1377
  template = File.read(args[1])
1376
- elsif STDIN.wait_readable(0)
1377
- template = STDIN.read
1378
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
1379
+ template = stdin
1378
1380
  end
1379
1381
  rescue StandardError => e
1380
1382
  STDERR.puts "Error reading template: #{e.message}."
@@ -1608,6 +1610,68 @@ CommandParser::CmdParser.new(ARGV) do
1608
1610
  '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
1609
1611
  EOT
1610
1612
 
1613
+ pci_attach_desc = <<-EOT.unindent
1614
+ Attaches a PCI to a VM.
1615
+
1616
+ You can specify the PCI device with --pci (short_address) or
1617
+ --pci_device (device ID), --pci_class (class ID) and/or --pci_vendor (vendor ID).
1618
+
1619
+ States: POWEROFF
1620
+ EOT
1621
+
1622
+ command :"pci-attach", pci_attach_desc, :vmid,
1623
+ :options => [
1624
+ OpenNebulaHelper::FILE,
1625
+ PCI,
1626
+ PCI_CLASS,
1627
+ PCI_VENDOR,
1628
+ PCI_DEVICE
1629
+ ] do
1630
+ pci_attrs = [:pci, :pci_device, :pci_vendor, :pci_class].any? do |o|
1631
+ !options[o].nil?
1632
+ end
1633
+
1634
+ if options[:file]
1635
+ template = File.read(options[:file])
1636
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
1637
+ template = stdin
1638
+ elsif pci_attrs
1639
+ pcia = options[:pci]
1640
+ pcid = options[:pci_device]
1641
+ pcic = options[:pci_class]
1642
+ pciv = options[:pci_vendor]
1643
+
1644
+ pcis = []
1645
+ pcis << "SHORT_ADDRESS = \"#{pcia}\"" if pcia
1646
+ pcis << "DEVICE = \"#{pcid}\"" if pcid
1647
+ pcis << "CLASS = \"#{pcic}\"" if pcic
1648
+ pcis << "VENDOR = \"#{pciv}\"" if pciv
1649
+
1650
+ template = "PCI = [ #{pcis.join(',')} ]"
1651
+ else
1652
+ STDERR.puts 'Provide a PCI description file with --file or the relevant pci options:'
1653
+ exit(-1)
1654
+ end
1655
+
1656
+ helper.perform_action(args[0], options, 'Attaching PCI device') do |vm|
1657
+ vm.pci_attach(template)
1658
+ end
1659
+ end
1660
+
1661
+ pci_detach_desc = <<-EOT.unindent
1662
+ Detaches a PCI device from a VM
1663
+
1664
+ States: POWEROFF
1665
+ EOT
1666
+
1667
+ command :"pci-detach", pci_detach_desc, :vmid, :pciid do
1668
+ pciid = args[1].to_i
1669
+
1670
+ helper.perform_action(args[0], options, 'Detaching PCI') do |vm|
1671
+ vm.pci_detach(pciid)
1672
+ end
1673
+ end
1674
+
1611
1675
  command :ssh,
1612
1676
  ssh_desc,
1613
1677
  :vmid,
data/bin/onevmgroup CHANGED
@@ -138,8 +138,8 @@ CommandParser::CmdParser.new(ARGV) do
138
138
  begin
139
139
  if args[0]
140
140
  template = File.read(args[0])
141
- elsif STDIN.wait_readable(0)
142
- template = STDIN.read
141
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
142
+ template = stdin
143
143
  else
144
144
  STDERR.puts 'No VM Group description provided'
145
145
  exit(-1)
@@ -292,8 +292,8 @@ CommandParser::CmdParser.new(ARGV) do
292
292
  begin
293
293
  if args[1]
294
294
  template = File.read(args[1])
295
- elsif STDIN.wait_readable(0)
296
- template = STDIN.read
295
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
296
+ template = stdin
297
297
  end
298
298
  rescue StandardError => e
299
299
  STDERR.puts "Error reading template: #{e.message}."
data/bin/onevnet CHANGED
@@ -173,8 +173,8 @@ CommandParser::CmdParser.new(ARGV) do
173
173
  begin
174
174
  if args[0]
175
175
  template = File.read(args[0])
176
- elsif STDIN.wait_readable(0)
177
- template = STDIN.read
176
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
177
+ template = stdin
178
178
  end
179
179
  vn.allocate(template, cid)
180
180
  rescue StandardError => e
@@ -203,8 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
203
203
  helper.perform_action(args[0], options, 'address range added') do |vn|
204
204
  if args[1]
205
205
  ar = File.read(args[1])
206
- elsif STDIN.wait_readable(0)
207
- ar = STDIN.read
206
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
207
+ ar = stdin
208
208
  else
209
209
  ar = OpenNebulaHelper.create_ar(options)
210
210
  end
@@ -479,7 +479,7 @@ CommandParser::CmdParser.new(ARGV) do
479
479
  States for delete: Any but READY
480
480
  EOT
481
481
 
482
- command :recover, recover_desc, [:range, :vmid_list],
482
+ command :recover, recover_desc, [:range, :vnetid_list],
483
483
  :options => [SUCCESS, FAILURE, DELETE, RETRY] do
484
484
  if !options[:success].nil?
485
485
  result = 1
data/bin/onevntemplate CHANGED
@@ -161,8 +161,8 @@ CommandParser::CmdParser.new(ARGV) do
161
161
  begin
162
162
  if args[0]
163
163
  template = File.read(args[0])
164
- elsif STDIN.wait_readable(0)
165
- template = STDIN.read
164
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
165
+ template = stdin
166
166
  end
167
167
 
168
168
  if options[:dry]
@@ -256,8 +256,8 @@ CommandParser::CmdParser.new(ARGV) do
256
256
 
257
257
  if args[1]
258
258
  extra_template = File.read(args[1])
259
- elsif STDIN.wait_readable(0)
260
- extra_template = STDIN.read
259
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
260
+ extra_template = stdin
261
261
  else
262
262
  res = OpenNebulaHelper.create_template(options, t)
263
263
 
data/bin/onevrouter CHANGED
@@ -142,8 +142,8 @@ CommandParser::CmdParser.new(ARGV) do
142
142
  begin
143
143
  if args[0]
144
144
  template = File.read(args[0])
145
- elsif STDIN.wait_readable(0)
146
- template = STDIN.read
145
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
146
+ template = stdin
147
147
  end
148
148
  obj.allocate(template)
149
149
  rescue StandardError => e
@@ -174,10 +174,12 @@ CommandParser::CmdParser.new(ARGV) do
174
174
  :vrouterid, :templateid, [:file, nil],
175
175
  :options => instantiate_options +
176
176
  OpenNebulaHelper::TEMPLATE_OPTIONS do
177
- if (args[2] || STDIN.wait_readable(0)) &&
178
- OpenNebulaHelper.create_template_options_used?(options)
177
+ conflicting_opts = []
178
+ if (args[2] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
179
+ OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
179
180
 
180
- STDERR.puts 'You cannot use both template and template creation options.'
181
+ STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
182
+ "conflicting options: #{conflicting_opts.join(', ')}."
181
183
  exit(-1)
182
184
  end
183
185
 
@@ -201,8 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
201
203
 
202
204
  if args[2]
203
205
  extra_template = File.read(args[2])
204
- elsif STDIN.wait_readable(0)
205
- extra_template = STDIN.read
206
+ elsif !stdin.empty?
207
+ extra_template = stdin
206
208
  else
207
209
  res = OpenNebulaHelper.create_template(options, t)
208
210
 
@@ -307,8 +309,8 @@ CommandParser::CmdParser.new(ARGV) do
307
309
  OneVirtualRouterHelper::FLOAT] do
308
310
  if options[:file]
309
311
  template = File.read(options[:file])
310
- elsif STDIN.wait_readable(0)
311
- template = STDIN.read
312
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
313
+ template = stdin
312
314
  elsif options[:network]
313
315
  network_id = options[:network]
314
316
  ip = options[:ip]
data/bin/onezone CHANGED
@@ -111,8 +111,8 @@ CommandParser::CmdParser.new(ARGV) do
111
111
  begin
112
112
  if args[0]
113
113
  template = File.read(args[0])
114
- elsif STDIN.wait_readable(0)
115
- template = STDIN.read
114
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
115
+ template = stdin
116
116
  else
117
117
  STDERR.puts 'No zone template provided'
118
118
  exit(-1)
@@ -155,8 +155,8 @@ class OneBackupJobHelper < OpenNebulaHelper::OneHelper
155
155
  # Get user information
156
156
  if file
157
157
  str = File.read(file)
158
- elsif STDIN.wait_readable(0)
159
- str = STDIN.read
158
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
159
+ str = stdin
160
160
  else
161
161
  str = OpenNebulaHelper.update_template(id, bj, nil, xpath)
162
162
  end
@@ -794,6 +794,8 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
794
794
  numa_nodes.each do |node|
795
795
  mon_node = monitoring.find {|x| x['NODE_ID'] == node['NODE_ID'] }
796
796
 
797
+ next if mon_node.nil?
798
+
797
799
  node['MEMORY']['FREE'] = mon_node['MEMORY']['FREE']
798
800
  node['MEMORY']['USED'] = mon_node['MEMORY']['USED']
799
801
 
@@ -518,6 +518,18 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
518
518
  [0, template]
519
519
  end
520
520
 
521
+ def create_template_options_used?(options, conflicting_opts)
522
+ # Get the template options names as symbols, options hash uses symbols
523
+ template_options=TEMPLATE_OPTIONS.map do |o|
524
+ o[:name].to_sym
525
+ end
526
+
527
+ # Check if one at least one of the template options is in options hash
528
+ conflicting_opts.replace(options.keys & template_options)
529
+
530
+ !conflicting_opts.empty?
531
+ end
532
+
521
533
  end
522
534
 
523
535
  end
@@ -129,16 +129,17 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
129
129
  end
130
130
  end
131
131
 
132
- def self.create_template_options_used?(options)
132
+ def self.create_template_options_used?(options, conflicting_opts)
133
133
  # Get the template options names as symbols. options hash
134
134
  # uses symbols
135
135
  template_options=self::TEMPLATE_OPTIONS.map do |o|
136
136
  o[:name].to_sym
137
137
  end
138
138
 
139
- # Check if one at least one of the template options is
140
- # in options hash
141
- (template_options-options.keys)!=template_options
139
+ # Check if at least one of the template options is in options hash
140
+ conflicting_opts.replace(options.keys & template_options)
141
+
142
+ !conflicting_opts.empty?
142
143
  end
143
144
 
144
145
  # Import object into marketplace
@@ -397,8 +397,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
397
397
  # Get user information
398
398
  if file
399
399
  str = File.read(file)
400
- elsif STDIN.wait_readable(0)
401
- str = STDIN.read
400
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
401
+ str = stdin
402
402
  else
403
403
  str = OpenNebulaHelper.update_template(vm_id, vm, nil, xpath)
404
404
  end
data/lib/one_helper.rb CHANGED
@@ -1712,8 +1712,8 @@ Bash symbols must be escaped on STDIN passing'
1712
1712
  def self.update_template_helper(append, _id, resource, path, xpath, update = true)
1713
1713
  if path
1714
1714
  File.read(path)
1715
- elsif STDIN.wait_readable(0)
1716
- STDIN.read
1715
+ elsif !(stdin = self.read_stdin).empty?
1716
+ stdin
1717
1717
  elsif append
1718
1718
  editor_input
1719
1719
  else
@@ -2095,16 +2095,17 @@ Bash symbols must be escaped on STDIN passing'
2095
2095
  ar << ']'
2096
2096
  end
2097
2097
 
2098
- def self.create_template_options_used?(options)
2098
+ def self.create_template_options_used?(options, conflicting_opts)
2099
2099
  # Get the template options names as symbols. options hash
2100
2100
  # uses symbols
2101
2101
  template_options=OpenNebulaHelper::TEMPLATE_OPTIONS.map do |o|
2102
2102
  o[:name].to_sym
2103
2103
  end
2104
2104
 
2105
- # Check if one at least one of the template options is
2106
- # in options hash
2107
- (template_options-options.keys)!=template_options
2105
+ # Check if at least one of the template options is in options hash
2106
+ conflicting_opts.replace(options.keys & template_options)
2107
+
2108
+ !conflicting_opts.empty?
2108
2109
  end
2109
2110
 
2110
2111
  def self.sunstone_url
@@ -2660,4 +2661,11 @@ Bash symbols must be escaped on STDIN passing'
2660
2661
  end
2661
2662
  end
2662
2663
 
2664
+ def self.read_stdin
2665
+ if STDIN.wait_readable(0)
2666
+ STDIN.read()
2667
+ else
2668
+ ''
2669
+ end
2670
+ end
2663
2671
  end
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: 6.8.1
4
+ version: 6.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-16 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.8.1
19
+ version: 6.8.2
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: 6.8.1
26
+ version: 6.8.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement