opennebula-cli 5.7.80.pre → 5.7.85.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +1 -1
  3. data/bin/oneacl +1 -1
  4. data/bin/onecluster +1 -1
  5. data/bin/onedatastore +1 -1
  6. data/bin/oneflow +1 -1
  7. data/bin/oneflow-template +1 -1
  8. data/bin/onegroup +1 -1
  9. data/bin/onehost +14 -1
  10. data/bin/oneimage +1 -1
  11. data/bin/onemarket +1 -1
  12. data/bin/onemarketapp +1 -1
  13. data/bin/onesecgroup +1 -1
  14. data/bin/oneshowback +1 -1
  15. data/bin/onetemplate +3 -1
  16. data/bin/oneuser +1 -1
  17. data/bin/onevcenter +1 -1
  18. data/bin/onevdc +1 -1
  19. data/bin/onevm +37 -12
  20. data/bin/onevmgroup +1 -1
  21. data/bin/onevnet +1 -1
  22. data/bin/onevntemplate +1 -2
  23. data/bin/onevrouter +1 -1
  24. data/bin/onezone +1 -1
  25. data/lib/cli_helper.rb +13 -3
  26. data/lib/command_parser.rb +1 -1
  27. data/lib/one_helper.rb +15 -11
  28. data/lib/one_helper/oneacct_helper.rb +1 -1
  29. data/lib/one_helper/oneacl_helper.rb +1 -1
  30. data/lib/one_helper/onecluster_helper.rb +1 -1
  31. data/lib/one_helper/onedatastore_helper.rb +1 -1
  32. data/lib/one_helper/onegroup_helper.rb +1 -1
  33. data/lib/one_helper/onehost_helper.rb +329 -204
  34. data/lib/one_helper/oneimage_helper.rb +1 -1
  35. data/lib/one_helper/onemarket_helper.rb +1 -1
  36. data/lib/one_helper/onemarketapp_helper.rb +1 -1
  37. data/lib/one_helper/onequota_helper.rb +1 -1
  38. data/lib/one_helper/onesecgroup_helper.rb +1 -1
  39. data/lib/one_helper/onetemplate_helper.rb +1 -1
  40. data/lib/one_helper/oneuser_helper.rb +1 -1
  41. data/lib/one_helper/onevcenter_helper.rb +1 -1
  42. data/lib/one_helper/onevdc_helper.rb +1 -1
  43. data/lib/one_helper/onevm_helper.rb +8 -1
  44. data/lib/one_helper/onevmgroup_helper.rb +1 -1
  45. data/lib/one_helper/onevnet_helper.rb +1 -1
  46. data/lib/one_helper/onevntemplate_helper.rb +1 -1
  47. data/lib/one_helper/onevrouter_helper.rb +1 -1
  48. data/lib/one_helper/onezone_helper.rb +1 -1
  49. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ba87b7b6263e5d961a1ad9dc27b968dc0b3bc06
4
- data.tar.gz: 4ac8190cf143f12a8045468b313fe15c193342ff
3
+ metadata.gz: 608bcd9d04a44a0a66aafc66cfbc5a301a68c183
4
+ data.tar.gz: 55407832344ac01ed0d331ce5c47e61667c9d260
5
5
  SHA512:
6
- metadata.gz: 70e93597b3f7a76f988c4137b9de0f0bdfd49374dd4572156d4de01581adaba6935bc5af600abed448c117f3f35bbcda43fc1c1b6a2ae9ff1e913b1fe414f5ff
7
- data.tar.gz: cd78e46de0333fe3b769c42a9b3ccfcd0839774f3372693f786ad8f6de14f77d2033dcaf81da0811fb021673d92af6c529e8dbcf73d84070c05537c94607057e
6
+ metadata.gz: e27b7f253050290ab01cb292c9d88e5aa1bc1c611bb0637feea8254af643df71c465d57b620bc9ba6828dc334293a4604fb753952497a628d773c94bb71e87ec
7
+ data.tar.gz: 47be3aceb3b467b79aaa4ed6e89a36e94856597965b7ed08a15f88939515559b7c570f5d4c1b16a69b3ec2b7bcc0d0869450f7966061b2eef084ca7df89d4652
data/bin/oneacct CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/oneacl CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onecluster CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onedatastore CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/oneflow CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/oneflow-template CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onegroup CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onehost CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
@@ -285,4 +285,17 @@ CommandParser::CmdParser.new(ARGV) do
285
285
  o.import_wild(args[1])
286
286
  end
287
287
  end
288
+
289
+ forceupdate_desc = <<-EOT.unindent
290
+ Forces host monitoring update
291
+ Examples:
292
+ onehost forceupdate host01
293
+ onehost forceupdate host01,host02,host03
294
+ onehost forceupdate -c myCluster
295
+ EOT
296
+
297
+ command :forceupdate, forceupdate_desc, [:range, :hostid_list, nil],
298
+ :options => [OneClusterHelper::CLUSTER] do
299
+ helper.forceupdate(args[0], options)
300
+ end
288
301
  end
data/bin/oneimage CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onemarket CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onemarketapp CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onesecgroup CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/oneshowback CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onetemplate CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
@@ -259,6 +259,8 @@ CommandParser::CmdParser.new(ARGV) do
259
259
 
260
260
  extra_template << "\n#{user_inputs}"
261
261
 
262
+ extra_template.strip!
263
+
262
264
  persistent = !options[:persistent].nil?
263
265
 
264
266
  res = t.instantiate(name, on_hold, extra_template, persistent)
data/bin/oneuser CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onevcenter CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onevdc CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onevm CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
@@ -557,8 +557,10 @@ CommandParser::CmdParser.new(ARGV) do
557
557
  EOT
558
558
 
559
559
  command :migrate, migrate_desc, [:range, :vmid_list], :hostid,
560
- [:datastoreid, nil], :options => [ENFORCE, OneVMHelper::LIVE,
561
- OneVMHelper::POFF, OneVMHelper::POFFHARD] do
560
+ [:datastoreid, nil], :options => [ENFORCE,
561
+ OneVMHelper::LIVE,
562
+ OneVMHelper::POFF,
563
+ OneVMHelper::POFFHARD] do
562
564
  host_id = args[1]
563
565
  verbose = "migrating to #{host_id}"
564
566
 
@@ -795,7 +797,8 @@ CommandParser::CmdParser.new(ARGV) do
795
797
 
796
798
  if ip
797
799
  if !nic_alias && !nic_name
798
- template = "NIC = [ NETWORK_ID = #{network_id}, IP = #{ip} ]"
800
+ template = "NIC = [ NETWORK_ID = #{network_id}, \
801
+ IP = #{ip} ]"
799
802
  elsif !nic_alias && nic_name
800
803
  template = "NIC = [ NETWORK_ID = #{network_id},
801
804
  IP = #{ip},
@@ -1044,8 +1047,28 @@ CommandParser::CmdParser.new(ARGV) do
1044
1047
 
1045
1048
  command :list, list_desc, [:filterflag, nil],
1046
1049
  :options => CLIHelper::OPTIONS + OpenNebulaHelper::OPTIONS +
1047
- [OpenNebulaHelper::DESCRIBE] do
1048
- helper.list_pool(options, false, args[0])
1050
+ [OpenNebulaHelper::DESCRIBE] + [OneVMHelper::SEARCH] do
1051
+ if !options[:search]
1052
+ helper.list_pool(options, false, args[0])
1053
+ else
1054
+ table = helper.format_pool(options)
1055
+ pool = OpenNebula::VirtualMachinePool.new(OneVMHelper.get_client)
1056
+
1057
+ rc = pool.info_search(:query => options[:search])
1058
+
1059
+ if !rc.nil?
1060
+ puts rc.message
1061
+ exit(-1)
1062
+ end
1063
+
1064
+ if options[:xml]
1065
+ puts pool.to_xml
1066
+ else
1067
+ table.show(pool.to_hash, options)
1068
+ end
1069
+
1070
+ 0
1071
+ end
1049
1072
  end
1050
1073
 
1051
1074
  show_desc = <<-EOT.unindent
@@ -1128,11 +1151,12 @@ CommandParser::CmdParser.new(ARGV) do
1128
1151
  This command accepts a template file or opens an editor, the full list of
1129
1152
  configuration attributes are:
1130
1153
 
1131
- OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT"]
1132
- FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT"]
1133
- INPUT = ["TYPE", "BUS"]
1134
- GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
1135
- RAW = ["DATA", "DATA_VMX", "TYPE"]
1154
+ OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT"]
1155
+ FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT"]
1156
+ INPUT = ["TYPE", "BUS"]
1157
+ GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
1158
+ RAW = ["DATA", "DATA_VMX", "TYPE"]
1159
+ CPU_MODEL = ["MODEL"]
1136
1160
  CONTEXT (any value, **variable substitution will be made**)
1137
1161
  EOT
1138
1162
 
@@ -1153,7 +1177,8 @@ CommandParser::CmdParser.new(ARGV) do
1153
1177
 
1154
1178
  template = vm.template_like_str('TEMPLATE', true,
1155
1179
  'OS | FEATURES | INPUT | '\
1156
- 'GRAPHICS | RAW | CONTEXT')
1180
+ 'GRAPHICS | RAW | CONTEXT | '\
1181
+ 'CPU_MODEL')
1157
1182
  template = OpenNebulaHelper.editor_input(template)
1158
1183
  end
1159
1184
 
data/bin/onevmgroup CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onevnet CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onevntemplate CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
@@ -30,7 +30,6 @@ $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
30
30
  require 'command_parser'
31
31
  require 'one_helper/onevntemplate_helper'
32
32
  require 'one_helper/onevnet_helper'
33
- require 'pry'
34
33
 
35
34
  CommandParser::CmdParser.new(ARGV) do
36
35
  usage '`onevntemplate` <command> [<args>] [<options>]'
data/bin/onevrouter CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/bin/onezone CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2019, 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 #
data/lib/cli_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -71,8 +71,18 @@ module CLIHelper
71
71
  :description => "Sets the delay in seconds for top command"
72
72
  }
73
73
 
74
+ NO_PAGER = {
75
+ :name => "no_pager",
76
+ :large => "--no-pager",
77
+ :format => String,
78
+ :description => "Disable pagination",
79
+ :proc => lambda { |o, options|
80
+ ENV['ONE_PAGER'] = 'cat' if File.exists?('/bin/cat')
81
+ }
82
+ }
83
+
74
84
  #OPTIONS = [LIST, ORDER, FILTER, HEADER, DELAY]
75
- OPTIONS = [LIST, LISTCONF, DELAY, FILTER, CSV_OPT]
85
+ OPTIONS = [LIST, LISTCONF, DELAY, FILTER, CSV_OPT, NO_PAGER]
76
86
 
77
87
  # Sets bold font
78
88
  def CLIHelper.scr_bold
@@ -293,7 +303,7 @@ module CLIHelper
293
303
 
294
304
  begin
295
305
  if options[:csv]
296
- puts CSV.generate_line(@default_columns)
306
+ puts CSV.generate_line(@default_columns) if !options[:noheader]
297
307
  res_data.each {|l| puts CSV.generate_line(l) }
298
308
  else
299
309
  res_data.each{|l|
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
data/lib/one_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -30,7 +30,7 @@ include OpenNebula
30
30
  module OpenNebulaHelper
31
31
  ONE_VERSION=<<-EOT
32
32
  OpenNebula #{OpenNebula::VERSION}
33
- Copyright 2002-2018, OpenNebula Project, OpenNebula Systems
33
+ Copyright 2002-2019, OpenNebula Project, OpenNebula Systems
34
34
 
35
35
  Licensed under the Apache License, Version 2.0 (the "License"); you may
36
36
  not use this file except in compliance with the License. You may obtain
@@ -516,11 +516,13 @@ EOT
516
516
  # List pool functions
517
517
  #-----------------------------------------------------------------------
518
518
  def start_pager
519
- pager = ENV['ONE_PAGER'] || 'less'
519
+ pager = ENV['ONE_PAGER'] || 'more'
520
520
 
521
521
  # Start pager, defaults to less
522
522
  p_r, p_w = IO.pipe
523
523
 
524
+ Signal.trap('PIPE', 'SIG_IGN')
525
+
524
526
  lpid = fork do
525
527
  $stdin.reopen(p_r)
526
528
 
@@ -531,7 +533,7 @@ EOT
531
533
 
532
534
  exec([pager, pager])
533
535
  end
534
-
536
+
535
537
  # Send listing to pager pipe
536
538
  $stdout.close
537
539
  $stdout = p_w.dup
@@ -547,6 +549,9 @@ EOT
547
549
 
548
550
  begin
549
551
  Process.wait(lpid)
552
+ rescue Interrupt
553
+ Process.kill("TERM", lpid)
554
+ Process.wait(lpid)
550
555
  rescue Errno::ECHILD
551
556
  end
552
557
  end
@@ -558,12 +563,11 @@ EOT
558
563
  elements = 0
559
564
  page = ""
560
565
 
561
- pool.each {|e|
562
- elements += 1
566
+ pool.each {|e|
567
+ elements += 1
563
568
  page << e.to_xml(true) << "\n"
564
569
  }
565
570
  else
566
-
567
571
  pname = pool.pool_name
568
572
  ename = pool.element_name
569
573
 
@@ -585,8 +589,8 @@ EOT
585
589
  # output
586
590
  #-----------------------------------------------------------------------
587
591
  def list_pool_table(table, pool, options, filter_flag)
588
- if $stdout.isatty and (!options.key?:no_pager)
589
- size = $stdout.winsize[0] - 1
592
+ if $stdout.isatty and (!options.key?:no_pager)
593
+ size = $stdout.winsize[0] - 1
590
594
 
591
595
  # ----------- First page, check if pager is needed -------------
592
596
  rc = pool.get_page(size, 0)
@@ -662,8 +666,8 @@ EOT
662
666
  # List pool in XML format, pagination is used in interactive output
663
667
  #-----------------------------------------------------------------------
664
668
  def list_pool_xml(pool, options, filter_flag)
665
- if $stdout.isatty
666
- size = $stdout.winsize[0] - 1
669
+ if $stdout.isatty
670
+ size = $stdout.winsize[0] - 1
667
671
 
668
672
  # ----------- First page, check if pager is needed -------------
669
673
  rc = pool.get_page(size, 0)