opennebula-cli 7.1.80.pre → 7.2.1

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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +1 -1
  3. data/bin/oneacl +1 -1
  4. data/bin/onebackupjob +1 -1
  5. data/bin/onecluster +1 -1
  6. data/bin/onedatastore +1 -1
  7. data/bin/oneflow +1 -1
  8. data/bin/oneflow-template +1 -1
  9. data/bin/oneform +1 -1
  10. data/bin/onegroup +1 -1
  11. data/bin/onehook +1 -1
  12. data/bin/onehost +1 -1
  13. data/bin/oneimage +1 -1
  14. data/bin/oneirb +1 -1
  15. data/bin/onelog +1 -1
  16. data/bin/onemarket +1 -1
  17. data/bin/onemarketapp +1 -1
  18. data/bin/onesecgroup +1 -1
  19. data/bin/oneshowback +1 -1
  20. data/bin/onetemplate +1 -1
  21. data/bin/oneuser +1 -1
  22. data/bin/onevdc +1 -1
  23. data/bin/onevm +2 -2
  24. data/bin/onevmgroup +1 -1
  25. data/bin/onevnet +1 -1
  26. data/bin/onevntemplate +1 -1
  27. data/bin/onevrouter +1 -1
  28. data/bin/onezone +1 -1
  29. data/lib/cli_helper.rb +1 -1
  30. data/lib/command_parser.rb +135 -126
  31. data/lib/load_opennebula_paths.rb +5 -0
  32. data/lib/ods_helper.rb +541 -0
  33. data/lib/one_helper/oneacct_helper.rb +117 -109
  34. data/lib/one_helper/oneacl_helper.rb +1 -1
  35. data/lib/one_helper/onebackupjob_helper.rb +1 -1
  36. data/lib/one_helper/onecluster_helper.rb +1 -1
  37. data/lib/one_helper/onedatastore_helper.rb +87 -80
  38. data/lib/one_helper/oneflow_helper.rb +1 -1
  39. data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
  40. data/lib/one_helper/oneform_helper.rb +1 -1
  41. data/lib/one_helper/onegroup_helper.rb +1 -1
  42. data/lib/one_helper/onehook_helper.rb +1 -1
  43. data/lib/one_helper/onehost_helper.rb +1 -1
  44. data/lib/one_helper/oneimage_helper.rb +1 -1
  45. data/lib/one_helper/onemarket_helper.rb +59 -58
  46. data/lib/one_helper/onemarketapp_helper.rb +1 -1
  47. data/lib/one_helper/onequota_helper.rb +240 -190
  48. data/lib/one_helper/onesecgroup_helper.rb +87 -85
  49. data/lib/one_helper/onetemplate_helper.rb +64 -64
  50. data/lib/one_helper/oneuser_helper.rb +2 -2
  51. data/lib/one_helper/onevdc_helper.rb +45 -45
  52. data/lib/one_helper/onevm_helper.rb +6 -8
  53. data/lib/one_helper/onevmgroup_helper.rb +65 -63
  54. data/lib/one_helper/onevnet_helper.rb +1 -1
  55. data/lib/one_helper/onevntemplate_helper.rb +43 -40
  56. data/lib/one_helper/onevrouter_helper.rb +86 -87
  57. data/lib/one_helper/onezone_helper.rb +98 -101
  58. data/lib/one_helper.rb +90 -71
  59. data/share/schemas/xsd/acct.xsd +3 -104
  60. data/share/schemas/xsd/cluster.xsd +4 -21
  61. data/share/schemas/xsd/datastore.xsd +4 -29
  62. data/share/schemas/xsd/document.xsd +3 -25
  63. data/share/schemas/xsd/group.xsd +2 -14
  64. data/share/schemas/xsd/group_pool.xsd +2 -14
  65. data/share/schemas/xsd/hook.xsd +2 -0
  66. data/share/schemas/xsd/host.xsd +5 -7
  67. data/share/schemas/xsd/image.xsd +2 -25
  68. data/share/schemas/xsd/marketplace.xsd +3 -22
  69. data/share/schemas/xsd/marketplaceapp.xsd +3 -25
  70. data/share/schemas/xsd/opennebula_configuration.xsd +3 -2
  71. data/share/schemas/xsd/requirements.xsd +3 -21
  72. data/share/schemas/xsd/security_group.xsd +6 -43
  73. data/share/schemas/xsd/shared.xsd +3 -3
  74. data/share/schemas/xsd/vdc.xsd +2 -7
  75. data/share/schemas/xsd/vm_group.xsd +3 -25
  76. data/share/schemas/xsd/vm_pool.xsd +2 -0
  77. data/share/schemas/xsd/vmtemplate.xsd +3 -25
  78. data/share/schemas/xsd/vnet.xsd +9 -67
  79. data/share/schemas/xsd/vnet_pool.xsd +8 -57
  80. data/share/schemas/xsd/vntemplate.xsd +3 -25
  81. data/share/schemas/xsd/vrouter.xsd +4 -32
  82. metadata +8 -6
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -19,115 +19,115 @@ require 'opennebula/datastore'
19
19
  require 'opennebula/datastore_pool'
20
20
  require 'opennebula/image'
21
21
 
22
+ # Helper class for Datastore commands
22
23
  class OneDatastoreHelper < OpenNebulaHelper::OneHelper
24
+
23
25
  DATASTORE = {
24
- :name => "datastore",
25
- :short => "-d id|name",
26
- :large => "--datastore id|name" ,
27
- :description => "Selects the datastore",
26
+ :name => 'datastore',
27
+ :short => '-d id|name',
28
+ :large => '--datastore id|name',
29
+ :description => 'Selects the datastore',
28
30
  :format => String,
29
- :proc => lambda { |o, options|
30
- OpenNebulaHelper.rname_to_id(o, "DATASTORE")
31
+ :proc => lambda {|o, _options|
32
+ OpenNebulaHelper.rname_to_id(o, 'DATASTORE')
31
33
  }
32
34
  }
33
35
 
34
36
  FILE_DATASTORE = {
35
- :name => "file_datastore",
36
- :large => "--file-datastore id|name" ,
37
- :description => "Selects the file datastore",
37
+ :name => 'file_datastore',
38
+ :large => '--file-datastore id|name',
39
+ :description => 'Selects the file datastore',
38
40
  :format => String,
39
- :proc => lambda { |o, options|
40
- OpenNebulaHelper.rname_to_id(o, "DATASTORE")
41
+ :proc => lambda {|o, _options|
42
+ OpenNebulaHelper.rname_to_id(o, 'DATASTORE')
41
43
  }
42
44
  }
43
45
 
44
46
  def self.rname
45
- "DATASTORE"
47
+ 'DATASTORE'
46
48
  end
47
49
 
48
50
  def self.conf_file
49
- "onedatastore.yaml"
51
+ 'onedatastore.yaml'
50
52
  end
51
53
 
52
54
  def format_pool(options)
53
55
  config_file = self.class.table_conf
54
56
 
55
- table = CLIHelper::ShowTable.new(config_file, self) do
56
- column :ID, "ONE identifier for the Datastore", :size=>4 do |d|
57
- d["ID"]
57
+ CLIHelper::ShowTable.new(config_file, self) do
58
+ column :ID, 'ONE identifier for the Datastore', :size=>4 do |d|
59
+ d['ID']
58
60
  end
59
61
 
60
- column :USER, "Username of the Datastore owner", :left,
61
- :size=>10 do |d|
62
+ column :USER, 'Username of the Datastore owner', :left,
63
+ :size=>10 do |d|
62
64
  helper.user_name(d, options)
63
65
  end
64
66
 
65
- column :GROUP, "Group of the Datastore", :left,
66
- :size=>10 do |d|
67
+ column :GROUP, 'Group of the Datastore', :left,
68
+ :size=>10 do |d|
67
69
  helper.group_name(d, options)
68
70
  end
69
71
 
70
- column :NAME, "Name of the Datastore", :left, :size=>13 do |d|
71
- d["NAME"]
72
+ column :NAME, 'Name of the Datastore', :left, :size=>13 do |d|
73
+ d['NAME']
72
74
  end
73
75
 
74
- column :SIZE, "Datastore total size", :size =>10 do |d|
76
+ column :SIZE, 'Datastore total size', :size =>10 do |d|
75
77
  shared = d['TEMPLATE']['SHARED']
76
- if shared != nil && shared.upcase == 'NO'
77
- "-"
78
+ if !shared.nil? && shared.upcase == 'NO'
79
+ '-'
78
80
  else
79
81
  OpenNebulaHelper.unit_to_str(d['TOTAL_MB'].to_i, {}, 'M')
80
82
  end
81
83
  end
82
84
 
83
- column :AVAIL, "Datastore free size", :left, :size =>5 do |d|
85
+ column :AVAIL, 'Datastore free size', :left, :size =>5 do |d|
84
86
  if d['TOTAL_MB'].to_i == 0
85
- "-"
87
+ '-'
86
88
  else
87
- "#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round()}%"
89
+ "#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round}%"
88
90
  end
89
91
  end
90
92
 
91
- column :CLUSTERS, "Cluster IDs", :left, :size=>12 do |d|
92
- OpenNebulaHelper.clusters_str(d["CLUSTERS"]["ID"])
93
+ column :CLUSTERS, 'Cluster IDs', :left, :size=>12 do |d|
94
+ OpenNebulaHelper.clusters_str(d['CLUSTERS']['ID'])
93
95
  end
94
96
 
95
- column :IMAGES, "Number of Images", :size=>6 do |d|
96
- if d["IMAGES"]["ID"].nil?
97
- "0"
97
+ column :IMAGES, 'Number of Images', :size=>6 do |d|
98
+ if d['IMAGES']['ID'].nil?
99
+ '0'
98
100
  else
99
- [d["IMAGES"]["ID"]].flatten.size
101
+ [d['IMAGES']['ID']].flatten.size
100
102
  end
101
103
  end
102
104
 
103
- column :TYPE, "Datastore type", :left, :size=>4 do |d|
104
- type = OpenNebula::Datastore::DATASTORE_TYPES[d["TYPE"].to_i]
105
+ column :TYPE, 'Datastore type', :left, :size=>4 do |d|
106
+ type = OpenNebula::Datastore::DATASTORE_TYPES[d['TYPE'].to_i]
105
107
  OpenNebula::Datastore::SHORT_DATASTORE_TYPES[type]
106
108
  end
107
109
 
108
- column :DS, "Datastore driver", :left, :size=>7 do |d|
109
- d["DS_MAD"]
110
+ column :DS, 'Datastore driver', :left, :size=>7 do |d|
111
+ d['DS_MAD']
110
112
  end
111
113
 
112
- column :TM, "Transfer driver", :left, :size=>7 do |d|
113
- d["TM_MAD"]
114
+ column :TM, 'Transfer driver', :left, :size=>7 do |d|
115
+ d['TM_MAD']
114
116
  end
115
117
 
116
- column :STAT, "State of the Datastore", :left, :size=>3 do |d|
117
- state = OpenNebula::Datastore::DATASTORE_STATES[d["STATE"].to_i]
118
+ column :STAT, 'State of the Datastore', :left, :size=>3 do |d|
119
+ state = OpenNebula::Datastore::DATASTORE_STATES[d['STATE'].to_i]
118
120
  OpenNebula::Datastore::SHORT_DATASTORE_STATES[state]
119
121
  end
120
122
 
121
123
  default :ID, :USER, :GROUP, :NAME, :SIZE, :AVAIL, :CLUSTERS, :IMAGES,
122
124
  :TYPE, :DS, :TM, :STAT
123
125
  end
124
-
125
- table
126
126
  end
127
127
 
128
128
  private
129
129
 
130
- def factory(id=nil)
130
+ def factory(id = nil)
131
131
  if id
132
132
  OpenNebula::Datastore.new_with_id(id, @client)
133
133
  else
@@ -136,62 +136,69 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
136
136
  end
137
137
  end
138
138
 
139
- def factory_pool(user_flag=-2)
139
+ def factory_pool(_user_flag = -2)
140
140
  OpenNebula::DatastorePool.new(@client)
141
141
  end
142
142
 
143
- def format_resource(datastore, options = {})
144
- str="%-15s: %-20s"
145
- str_h1="%-80s"
143
+ def format_resource(datastore, _options = {})
144
+ str='%-15s: %-20s'
145
+ str_h1='%-80s'
146
146
 
147
147
  CLIHelper.print_header(str_h1 % "DATASTORE #{datastore['ID']} INFORMATION")
148
- puts str % ["ID", datastore.id.to_s]
149
- puts str % ["NAME", datastore.name]
150
- puts str % ["USER", datastore['UNAME']]
151
- puts str % ["GROUP", datastore['GNAME']]
152
- puts str % ["CLUSTERS",
153
- OpenNebulaHelper.clusters_str(datastore.retrieve_elements("CLUSTERS/ID"))]
154
-
155
- puts str % ["TYPE", datastore.type_str]
156
- puts str % ["DS_MAD", datastore['DS_MAD']]
157
- puts str % ["TM_MAD", datastore['TM_MAD']]
158
- puts str % ["BASE PATH",datastore['BASE_PATH']]
159
- puts str % ["DISK_TYPE",Image::DISK_TYPES[datastore['DISK_TYPE'].to_i]]
160
- puts str % ["STATE", datastore.state_str]
148
+ puts format(str, 'ID', datastore.id.to_s)
149
+ puts format(str, 'NAME', datastore.name)
150
+ puts format(str, 'USER', datastore['UNAME'])
151
+ puts format(str, 'GROUP', datastore['GNAME'])
152
+ puts format(str, 'CLUSTERS',
153
+ OpenNebulaHelper.clusters_str(datastore.retrieve_elements('CLUSTERS/ID')))
154
+
155
+ puts format(str, 'TYPE', datastore.type_str)
156
+ puts format(str, 'DS_MAD', datastore['DS_MAD'])
157
+ puts format(str, 'TM_MAD', datastore['TM_MAD'])
158
+ puts format(str, 'BASE PATH', datastore['BASE_PATH'])
159
+ puts format(str, 'DISK_TYPE', Image::DISK_TYPES[datastore['DISK_TYPE'].to_i])
160
+ puts format(str, 'STATE', datastore.state_str)
161
161
  puts
162
162
 
163
- CLIHelper.print_header(str_h1 % "DATASTORE CAPACITY", false)
163
+ CLIHelper.print_header(str_h1 % 'DATASTORE CAPACITY', false)
164
164
 
165
165
  shared = datastore['TEMPLATE/SHARED']
166
- local = shared != nil && shared.upcase == 'NO'
166
+ local = !shared.nil? && shared.upcase == 'NO'
167
167
  limit_mb = datastore['TEMPLATE/LIMIT_MB']
168
168
 
169
- puts str % ["TOTAL:", local ? '-' : OpenNebulaHelper.unit_to_str(datastore['TOTAL_MB'].to_i, {},'M')]
170
- puts str % ["FREE:", local ? '-' : OpenNebulaHelper.unit_to_str(datastore['FREE_MB'].to_i, {},'M')]
171
- puts str % ["USED: ", local ? '-' : OpenNebulaHelper.unit_to_str(datastore['USED_MB'].to_i, {},'M')]
172
- puts str % ["LIMIT:", local || limit_mb.nil? ? '-' : OpenNebulaHelper.unit_to_str(limit_mb.to_i, {},'M')]
169
+ puts format(str, 'TOTAL:',
170
+ local ? '-' : OpenNebulaHelper.unit_to_str(datastore['TOTAL_MB'].to_i, {}, 'M'))
171
+ puts format(str, 'FREE:',
172
+ local ? '-' : OpenNebulaHelper.unit_to_str(datastore['FREE_MB'].to_i, {}, 'M'))
173
+ puts format(str, 'USED: ',
174
+ local ? '-' : OpenNebulaHelper.unit_to_str(datastore['USED_MB'].to_i, {}, 'M'))
175
+ puts format(str, 'LIMIT:',
176
+ local || limit_mb.nil? ? '-' : OpenNebulaHelper.unit_to_str(
177
+ limit_mb.to_i, {}, 'M'
178
+ ))
173
179
  puts
174
180
 
175
- CLIHelper.print_header(str_h1 % "PERMISSIONS",false)
181
+ CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
176
182
 
177
- ["OWNER", "GROUP", "OTHER"].each { |e|
178
- mask = "---"
179
- mask[0] = "u" if datastore["PERMISSIONS/#{e}_U"] == "1"
180
- mask[1] = "m" if datastore["PERMISSIONS/#{e}_M"] == "1"
181
- mask[2] = "a" if datastore["PERMISSIONS/#{e}_A"] == "1"
183
+ ['OWNER', 'GROUP', 'OTHER'].each do |e|
184
+ mask = '---'
185
+ mask[0] = 'u' if datastore["PERMISSIONS/#{e}_U"] == '1'
186
+ mask[1] = 'm' if datastore["PERMISSIONS/#{e}_M"] == '1'
187
+ mask[2] = 'a' if datastore["PERMISSIONS/#{e}_A"] == '1'
182
188
 
183
- puts str % [e, mask]
184
- }
189
+ puts format(str, e, mask)
190
+ end
185
191
  puts
186
192
 
187
- CLIHelper.print_header(str_h1 % "DATASTORE TEMPLATE", false)
193
+ CLIHelper.print_header(str_h1 % 'DATASTORE TEMPLATE', false)
188
194
  puts datastore.template_str
189
195
 
190
196
  puts
191
197
 
192
- CLIHelper.print_header("%-15s" % "IMAGES")
198
+ CLIHelper.print_header(format('%-15s', 'IMAGES'))
193
199
  datastore.img_ids.each do |id|
194
- puts "%-15s" % [id]
200
+ puts format('%-15s', id)
195
201
  end
196
202
  end
203
+
197
204
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #
@@ -18,24 +18,26 @@ require 'one_helper'
18
18
  require 'opennebula/marketplace'
19
19
  require 'opennebula/marketplace_pool'
20
20
 
21
+ # Helper class for Marketplace commands
21
22
  class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
23
+
22
24
  MARKETPLACE = {
23
- :name => "marketplace",
24
- :short => "-m id|name",
25
- :large => "--marketplace id|name" ,
26
- :description => "Selects the marketplace",
25
+ :name => 'marketplace',
26
+ :short => '-m id|name',
27
+ :large => '--marketplace id|name',
28
+ :description => 'Selects the marketplace',
27
29
  :format => String,
28
- :proc => lambda { |o, options|
29
- OpenNebulaHelper.rname_to_id(o, "MARKETPLACE")
30
+ :proc => lambda {|o, _options|
31
+ OpenNebulaHelper.rname_to_id(o, 'MARKETPLACE')
30
32
  }
31
33
  }
32
34
 
33
35
  def self.rname
34
- "MARKETPLACE"
36
+ 'MARKETPLACE'
35
37
  end
36
38
 
37
39
  def self.conf_file
38
- "onemarket.yaml"
40
+ 'onemarket.yaml'
39
41
  end
40
42
 
41
43
  def self.state_to_str(id)
@@ -47,51 +49,51 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
47
49
  def format_pool(options)
48
50
  config_file = self.class.table_conf
49
51
 
50
- table = CLIHelper::ShowTable.new(config_file, self) do
51
- column :ID, "ONE identifier for the Marketplace", :size=>4 do |d|
52
- d["ID"]
52
+ CLIHelper::ShowTable.new(config_file, self) do
53
+ column :ID, 'ONE identifier for the Marketplace', :size=>4 do |d|
54
+ d['ID']
53
55
  end
54
56
 
55
- column :USER, "Username of the Marketplace owner", :left,
56
- :size=>10 do |d|
57
+ column :USER, 'Username of the Marketplace owner', :left,
58
+ :size=>10 do |d|
57
59
  helper.user_name(d, options)
58
60
  end
59
61
 
60
- column :GROUP, "Group of the Marketplace", :left,
61
- :size=>10 do |d|
62
+ column :GROUP, 'Group of the Marketplace', :left,
63
+ :size=>10 do |d|
62
64
  helper.group_name(d, options)
63
65
  end
64
66
 
65
- column :NAME, "Name of the Marketplace", :left, :size=>30 do |d|
66
- d["NAME"]
67
+ column :NAME, 'Name of the Marketplace', :left, :size=>30 do |d|
68
+ d['NAME']
67
69
  end
68
70
 
69
- column :SIZE, "Marketplace total size", :size =>10 do |d|
71
+ column :SIZE, 'Marketplace total size', :size =>10 do |d|
70
72
  OpenNebulaHelper.unit_to_str(d['TOTAL_MB'].to_i, {}, 'M')
71
73
  end
72
74
 
73
- column :AVAIL, "Marketplace free size", :left, :size =>10 do |d|
75
+ column :AVAIL, 'Marketplace free size', :left, :size =>10 do |d|
74
76
  if d['TOTAL_MB'].to_i == 0
75
- "-"
77
+ '-'
76
78
  else
77
- "#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round()}%"
79
+ "#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round}%"
78
80
  end
79
81
  end
80
82
 
81
- column :APPS, "Number of marketplace apps", :size=>6 do |d|
82
- if d["MARKETPLACEAPPS"]["ID"].nil?
83
- "0"
83
+ column :APPS, 'Number of marketplace apps', :size=>6 do |d|
84
+ if d['MARKETPLACEAPPS']['ID'].nil?
85
+ '0'
84
86
  else
85
- [d["MARKETPLACEAPPS"]["ID"]].flatten.size
87
+ [d['MARKETPLACEAPPS']['ID']].flatten.size
86
88
  end
87
89
  end
88
90
 
89
- column :MAD, "Marketplace driver", :left, :size=>7 do |d|
90
- d["MARKET_MAD"]
91
+ column :MAD, 'Marketplace driver', :left, :size=>7 do |d|
92
+ d['MARKET_MAD']
91
93
  end
92
94
 
93
- column :ZONE, "Zone ID", :size=>4 do |d|
94
- d["ZONE_ID"]
95
+ column :ZONE, 'Zone ID', :size=>4 do |d|
96
+ d['ZONE_ID']
95
97
  end
96
98
 
97
99
  column :STAT, 'Markeplace status', :left, :size => 4 do |d|
@@ -100,13 +102,11 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
100
102
 
101
103
  default :ID, :NAME, :SIZE, :AVAIL, :APPS, :MAD, :ZONE, :STAT
102
104
  end
103
-
104
- table
105
105
  end
106
106
 
107
107
  private
108
108
 
109
- def factory(id=nil)
109
+ def factory(id = nil)
110
110
  if id
111
111
  OpenNebula::MarketPlace.new_with_id(id, @client)
112
112
  else
@@ -115,51 +115,52 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
115
115
  end
116
116
  end
117
117
 
118
- def factory_pool(user_flag=-2)
118
+ def factory_pool(_user_flag = -2)
119
119
  OpenNebula::MarketPlacePool.new(@client)
120
120
  end
121
121
 
122
- def format_resource(market, options = {})
123
- str="%-15s: %-20s"
124
- str_h1="%-80s"
122
+ def format_resource(market, _options = {})
123
+ str='%-15s: %-20s'
124
+ str_h1='%-80s'
125
125
 
126
126
  CLIHelper.print_header(str_h1 % "MARKETPLACE #{market['ID']} INFORMATION")
127
- puts str % ["ID", market.id.to_s]
128
- puts str % ["NAME", market.name]
129
- puts str % ["USER", market['UNAME']]
130
- puts str % ["GROUP", market['GNAME']]
131
- puts str % ["STATE", market.state_str]
127
+ puts format(str, 'ID', market.id.to_s)
128
+ puts format(str, 'NAME', market.name)
129
+ puts format(str, 'USER', market['UNAME'])
130
+ puts format(str, 'GROUP', market['GNAME'])
131
+ puts format(str, 'STATE', market.state_str)
132
132
 
133
- puts str % ["MARKET_MAD", market['MARKET_MAD']]
133
+ puts format(str, 'MARKET_MAD', market['MARKET_MAD'])
134
134
  puts
135
135
 
136
- CLIHelper.print_header(str_h1 % "MARKETPLACE CAPACITY", false)
136
+ CLIHelper.print_header(str_h1 % 'MARKETPLACE CAPACITY', false)
137
137
 
138
- puts str % ["TOTAL:", OpenNebulaHelper.unit_to_str(market['TOTAL_MB'].to_i,{},'M')]
139
- puts str % ["FREE:", OpenNebulaHelper.unit_to_str(market['FREE_MB'].to_i, {},'M')]
140
- puts str % ["USED: ", OpenNebulaHelper.unit_to_str(market['USED_MB'].to_i, {},'M')]
138
+ puts format(str, 'TOTAL:', OpenNebulaHelper.unit_to_str(market['TOTAL_MB'].to_i, {}, 'M'))
139
+ puts format(str, 'FREE:', OpenNebulaHelper.unit_to_str(market['FREE_MB'].to_i, {}, 'M'))
140
+ puts format(str, 'USED: ', OpenNebulaHelper.unit_to_str(market['USED_MB'].to_i, {}, 'M'))
141
141
  puts
142
142
 
143
- CLIHelper.print_header(str_h1 % "PERMISSIONS",false)
143
+ CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
144
144
 
145
- ["OWNER", "GROUP", "OTHER"].each { |e|
146
- mask = "---"
147
- mask[0] = "u" if market["PERMISSIONS/#{e}_U"] == "1"
148
- mask[1] = "m" if market["PERMISSIONS/#{e}_M"] == "1"
149
- mask[2] = "a" if market["PERMISSIONS/#{e}_A"] == "1"
145
+ ['OWNER', 'GROUP', 'OTHER'].each do |e|
146
+ mask = '---'
147
+ mask[0] = 'u' if market["PERMISSIONS/#{e}_U"] == '1'
148
+ mask[1] = 'm' if market["PERMISSIONS/#{e}_M"] == '1'
149
+ mask[2] = 'a' if market["PERMISSIONS/#{e}_A"] == '1'
150
150
 
151
- puts str % [e, mask]
152
- }
151
+ puts format(str, e, mask)
152
+ end
153
153
  puts
154
154
 
155
- CLIHelper.print_header(str_h1 % "MARKETPLACE TEMPLATE", false)
155
+ CLIHelper.print_header(str_h1 % 'MARKETPLACE TEMPLATE', false)
156
156
  puts market.template_str
157
157
 
158
158
  puts
159
159
 
160
- CLIHelper.print_header("%-15s" % "MARKETAPPS")
160
+ CLIHelper.print_header(format('%-15s', 'MARKETAPPS'))
161
161
  market.marketapp_ids.each do |id|
162
- puts "%-15s" % [id]
162
+ puts format('%-15s', id)
163
163
  end
164
164
  end
165
+
165
166
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2026, 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 #