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.
- checksums.yaml +4 -4
- data/bin/oneacct +1 -1
- data/bin/oneacl +1 -1
- data/bin/onebackupjob +1 -1
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +1 -1
- data/bin/oneform +1 -1
- data/bin/onegroup +1 -1
- data/bin/onehook +1 -1
- data/bin/onehost +1 -1
- data/bin/oneimage +1 -1
- data/bin/oneirb +1 -1
- data/bin/onelog +1 -1
- data/bin/onemarket +1 -1
- data/bin/onemarketapp +1 -1
- data/bin/onesecgroup +1 -1
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +1 -1
- data/bin/oneuser +1 -1
- data/bin/onevdc +1 -1
- data/bin/onevm +2 -2
- data/bin/onevmgroup +1 -1
- data/bin/onevnet +1 -1
- data/bin/onevntemplate +1 -1
- data/bin/onevrouter +1 -1
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +1 -1
- data/lib/command_parser.rb +135 -126
- data/lib/load_opennebula_paths.rb +5 -0
- data/lib/ods_helper.rb +541 -0
- data/lib/one_helper/oneacct_helper.rb +117 -109
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onebackupjob_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +87 -80
- data/lib/one_helper/oneflow_helper.rb +1 -1
- data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
- data/lib/one_helper/oneform_helper.rb +1 -1
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehook_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +1 -1
- data/lib/one_helper/oneimage_helper.rb +1 -1
- data/lib/one_helper/onemarket_helper.rb +59 -58
- data/lib/one_helper/onemarketapp_helper.rb +1 -1
- data/lib/one_helper/onequota_helper.rb +240 -190
- data/lib/one_helper/onesecgroup_helper.rb +87 -85
- data/lib/one_helper/onetemplate_helper.rb +64 -64
- data/lib/one_helper/oneuser_helper.rb +2 -2
- data/lib/one_helper/onevdc_helper.rb +45 -45
- data/lib/one_helper/onevm_helper.rb +6 -8
- data/lib/one_helper/onevmgroup_helper.rb +65 -63
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onevntemplate_helper.rb +43 -40
- data/lib/one_helper/onevrouter_helper.rb +86 -87
- data/lib/one_helper/onezone_helper.rb +98 -101
- data/lib/one_helper.rb +90 -71
- data/share/schemas/xsd/acct.xsd +3 -104
- data/share/schemas/xsd/cluster.xsd +4 -21
- data/share/schemas/xsd/datastore.xsd +4 -29
- data/share/schemas/xsd/document.xsd +3 -25
- data/share/schemas/xsd/group.xsd +2 -14
- data/share/schemas/xsd/group_pool.xsd +2 -14
- data/share/schemas/xsd/hook.xsd +2 -0
- data/share/schemas/xsd/host.xsd +5 -7
- data/share/schemas/xsd/image.xsd +2 -25
- data/share/schemas/xsd/marketplace.xsd +3 -22
- data/share/schemas/xsd/marketplaceapp.xsd +3 -25
- data/share/schemas/xsd/opennebula_configuration.xsd +3 -2
- data/share/schemas/xsd/requirements.xsd +3 -21
- data/share/schemas/xsd/security_group.xsd +6 -43
- data/share/schemas/xsd/shared.xsd +3 -3
- data/share/schemas/xsd/vdc.xsd +2 -7
- data/share/schemas/xsd/vm_group.xsd +3 -25
- data/share/schemas/xsd/vm_pool.xsd +2 -0
- data/share/schemas/xsd/vmtemplate.xsd +3 -25
- data/share/schemas/xsd/vnet.xsd +9 -67
- data/share/schemas/xsd/vnet_pool.xsd +8 -57
- data/share/schemas/xsd/vntemplate.xsd +3 -25
- data/share/schemas/xsd/vrouter.xsd +4 -32
- metadata +8 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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,78 +18,78 @@ require 'one_helper'
|
|
|
18
18
|
require 'opennebula/security_group'
|
|
19
19
|
require 'opennebula/security_group_pool'
|
|
20
20
|
|
|
21
|
+
# Helper class for Security Group commands
|
|
21
22
|
class OneSecurityGroupHelper < OpenNebulaHelper::OneHelper
|
|
23
|
+
|
|
22
24
|
RECOVER = {
|
|
23
|
-
:name =>
|
|
24
|
-
:short =>
|
|
25
|
-
:large =>
|
|
26
|
-
:description =>
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
:name => 'recover',
|
|
26
|
+
:short => '-r',
|
|
27
|
+
:large => '--recover',
|
|
28
|
+
:description => 'If set the commit operation will only operate on '\
|
|
29
|
+
'outdated and error VMs. This is intended for retrying updates of '\
|
|
30
|
+
'VMs or reinitialize the updating process if oned stopped or fail.'
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
def self.rname
|
|
32
|
-
|
|
34
|
+
'SECURITY_GROUP'
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def self.conf_file
|
|
36
|
-
|
|
38
|
+
'onesecgroup.yaml'
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
def format_pool(options)
|
|
40
42
|
config_file = self.class.table_conf
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
column :ID,
|
|
44
|
-
d[
|
|
44
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
45
|
+
column :ID, 'ONE identifier for the Security Group', :size=>4 do |d|
|
|
46
|
+
d['ID']
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
column :NAME,
|
|
48
|
-
d[
|
|
49
|
+
column :NAME, 'Name of the Security Group', :left, :size=>20 do |d|
|
|
50
|
+
d['NAME']
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
column :USER,
|
|
52
|
-
|
|
53
|
+
column :USER, 'Username of the Security Group owner', :left,
|
|
54
|
+
:size=>15 do |d|
|
|
53
55
|
helper.user_name(d, options)
|
|
54
56
|
end
|
|
55
57
|
|
|
56
|
-
column :GROUP,
|
|
58
|
+
column :GROUP, 'Group of the Security Group', :left, :size=>15 do |d|
|
|
57
59
|
helper.group_name(d, options)
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
column :UPDATED,
|
|
61
|
-
if d[
|
|
62
|
-
|
|
62
|
+
column :UPDATED, 'Number of VMs with updated rules', :size=>8 do |d|
|
|
63
|
+
if d['UPDATED_VMS']['ID'].nil?
|
|
64
|
+
'0'
|
|
63
65
|
else
|
|
64
|
-
[d[
|
|
66
|
+
[d['UPDATED_VMS']['ID']].flatten.size
|
|
65
67
|
end
|
|
66
68
|
end
|
|
67
69
|
|
|
68
|
-
column :OUTDATED,
|
|
69
|
-
if d[
|
|
70
|
-
|
|
70
|
+
column :OUTDATED, 'Number of VMs with outdated rules', :size=>8 do |d|
|
|
71
|
+
if d['OUTDATED_VMS']['ID'].nil?
|
|
72
|
+
'0'
|
|
71
73
|
else
|
|
72
|
-
[d[
|
|
74
|
+
[d['OUTDATED_VMS']['ID']].flatten.size
|
|
73
75
|
end
|
|
74
76
|
end
|
|
75
77
|
|
|
76
|
-
column :ERROR,
|
|
77
|
-
if d[
|
|
78
|
-
|
|
78
|
+
column :ERROR, 'Number of VMs that failed to update rules', :size=>8 do |d|
|
|
79
|
+
if d['ERROR_VMS']['ID'].nil?
|
|
80
|
+
'0'
|
|
79
81
|
else
|
|
80
|
-
[d[
|
|
82
|
+
[d['ERROR_VMS']['ID']].flatten.size
|
|
81
83
|
end
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
default :ID, :USER, :GROUP, :NAME, :UPDATED, :OUTDATED, :ERROR
|
|
85
87
|
end
|
|
86
|
-
|
|
87
|
-
table
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
private
|
|
91
91
|
|
|
92
|
-
def factory(id=nil)
|
|
92
|
+
def factory(id = nil)
|
|
93
93
|
if id
|
|
94
94
|
OpenNebula::SecurityGroup.new_with_id(id, @client)
|
|
95
95
|
else
|
|
@@ -98,107 +98,109 @@ class OneSecurityGroupHelper < OpenNebulaHelper::OneHelper
|
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
def factory_pool(user_flag
|
|
101
|
+
def factory_pool(user_flag = -2)
|
|
102
102
|
OpenNebula::SecurityGroupPool.new(@client, user_flag)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
def format_resource(secgroup,
|
|
106
|
-
str=
|
|
107
|
-
str_h1=
|
|
105
|
+
def format_resource(secgroup, _options = {})
|
|
106
|
+
str='%-15s: %-20s'
|
|
107
|
+
str_h1='%-80s'
|
|
108
108
|
|
|
109
109
|
CLIHelper.print_header(
|
|
110
|
-
str_h1 % "SECURITY GROUP #{secgroup['ID']} INFORMATION"
|
|
111
|
-
|
|
112
|
-
puts str
|
|
113
|
-
puts str
|
|
114
|
-
puts str
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
mask
|
|
121
|
-
mask[
|
|
122
|
-
mask[
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
str_h1 % "SECURITY GROUP #{secgroup['ID']} INFORMATION"
|
|
111
|
+
)
|
|
112
|
+
puts format(str, 'ID', secgroup.id.to_s)
|
|
113
|
+
puts format(str, 'NAME', secgroup.name)
|
|
114
|
+
puts format(str, 'USER', secgroup['UNAME'])
|
|
115
|
+
puts format(str, 'GROUP', secgroup['GNAME'])
|
|
116
|
+
|
|
117
|
+
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
118
|
+
|
|
119
|
+
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
|
120
|
+
mask = '---'
|
|
121
|
+
mask[0] = 'u' if secgroup["PERMISSIONS/#{e}_U"] == '1'
|
|
122
|
+
mask[1] = 'm' if secgroup["PERMISSIONS/#{e}_M"] == '1'
|
|
123
|
+
mask[2] = 'a' if secgroup["PERMISSIONS/#{e}_A"] == '1'
|
|
124
|
+
|
|
125
|
+
puts format(str, e, mask)
|
|
126
|
+
end
|
|
126
127
|
|
|
127
128
|
puts
|
|
128
129
|
|
|
129
|
-
CLIHelper.print_header(str_h1 %
|
|
130
|
+
CLIHelper.print_header(str_h1 % 'VIRTUAL MACHINES', false)
|
|
130
131
|
|
|
131
132
|
updated, outdated, error = secgroup.vm_ids
|
|
132
133
|
|
|
133
|
-
puts str
|
|
134
|
-
puts str
|
|
135
|
-
puts str
|
|
134
|
+
puts format(str, 'UPDATED', updated.join(','))
|
|
135
|
+
puts format(str, 'OUTDATED', outdated.join(','))
|
|
136
|
+
puts format(str, 'ERROR', error.join(','))
|
|
136
137
|
|
|
137
138
|
puts
|
|
138
139
|
|
|
139
|
-
CLIHelper.print_header(str_h1
|
|
140
|
+
CLIHelper.print_header(format(str_h1, 'RULES'), false)
|
|
140
141
|
|
|
141
142
|
if !secgroup.to_hash['SECURITY_GROUP']['TEMPLATE']['RULE'].nil?
|
|
142
143
|
rule_list = [secgroup.to_hash['SECURITY_GROUP']['TEMPLATE']['RULE']].flatten
|
|
143
144
|
end
|
|
144
145
|
|
|
145
146
|
CLIHelper::ShowTable.new(nil, self) do
|
|
146
|
-
column :TYPE,
|
|
147
|
-
d[
|
|
147
|
+
column :TYPE, '', :left, :size=>8 do |d|
|
|
148
|
+
d['RULE_TYPE']
|
|
148
149
|
end
|
|
149
150
|
|
|
150
|
-
column :PROTOCOL,
|
|
151
|
-
d[
|
|
151
|
+
column :PROTOCOL, '', :left, :size=>8 do |d|
|
|
152
|
+
d['PROTOCOL']
|
|
152
153
|
end
|
|
153
154
|
|
|
154
|
-
column :ICMP_TYPE,
|
|
155
|
-
d[
|
|
155
|
+
column :ICMP_TYPE, '', :left, :size=>9 do |d|
|
|
156
|
+
d['ICMP_TYPE']
|
|
156
157
|
end
|
|
157
158
|
|
|
158
|
-
column :ICMVP6_TYPE,
|
|
159
|
-
d[
|
|
159
|
+
column :ICMVP6_TYPE, '', :left, :size=>11 do |d|
|
|
160
|
+
d['ICMPV6_TYPE']
|
|
160
161
|
end
|
|
161
162
|
|
|
162
|
-
column :NETWORK,
|
|
163
|
-
network =
|
|
164
|
-
if(!d[
|
|
165
|
-
network +=
|
|
163
|
+
column :NETWORK, '', :left, :adjust, :size=>35 do |d|
|
|
164
|
+
network = ''
|
|
165
|
+
if(!d['NETWORK_ID'].nil? && d['NETWORK_ID'] != '')
|
|
166
|
+
network += 'VNet ' + d['NETWORK_ID']
|
|
166
167
|
end
|
|
167
168
|
|
|
168
|
-
if(!d[
|
|
169
|
-
if(network !=
|
|
170
|
-
network +=
|
|
169
|
+
if(!d['SIZE'].nil? && d['SIZE'] != '')
|
|
170
|
+
if(network != '')
|
|
171
|
+
network += ': '
|
|
171
172
|
end
|
|
172
173
|
|
|
173
|
-
if(!d[
|
|
174
|
-
network +=
|
|
175
|
-
elsif(!d[
|
|
176
|
-
network +=
|
|
174
|
+
if(!d['IP'].nil? && d['IP'] != '')
|
|
175
|
+
network += 'Start: ' + d['IP'] + ', '
|
|
176
|
+
elsif(!d['MAC'] != undefined && d['MAC'] != '')
|
|
177
|
+
network += 'Start: ' + d['MAC'] + ', '
|
|
177
178
|
end
|
|
178
179
|
|
|
179
|
-
network +=
|
|
180
|
+
network += 'Size: ' + d['SIZE']
|
|
180
181
|
end
|
|
181
182
|
|
|
182
|
-
if(network ==
|
|
183
|
-
network =
|
|
183
|
+
if(network == '')
|
|
184
|
+
network = 'Any'
|
|
184
185
|
end
|
|
185
186
|
|
|
186
|
-
network +=
|
|
187
|
+
network += ' '
|
|
187
188
|
network
|
|
188
189
|
end
|
|
189
190
|
|
|
190
|
-
column :RANGE,
|
|
191
|
-
d[
|
|
191
|
+
column :RANGE, '', :left, :adjust, :size=>16 do |d|
|
|
192
|
+
d['RANGE']
|
|
192
193
|
end
|
|
193
194
|
end.show(rule_list, {})
|
|
194
195
|
|
|
195
|
-
while secgroup.has_elements?(
|
|
196
|
-
secgroup.delete_element(
|
|
196
|
+
while secgroup.has_elements?('/SECURITY_GROUP/TEMPLATE/RULE')
|
|
197
|
+
secgroup.delete_element('/SECURITY_GROUP/TEMPLATE/RULE')
|
|
197
198
|
end
|
|
198
199
|
|
|
199
200
|
puts
|
|
200
201
|
|
|
201
|
-
CLIHelper.print_header(str_h1 %
|
|
202
|
+
CLIHelper.print_header(str_h1 % 'TEMPLATE CONTENTS', false)
|
|
202
203
|
puts secgroup.template_str
|
|
203
204
|
end
|
|
205
|
+
|
|
204
206
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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,57 +18,58 @@ require 'one_helper'
|
|
|
18
18
|
require 'opennebula/template'
|
|
19
19
|
require 'opennebula/template_pool'
|
|
20
20
|
|
|
21
|
+
# Helper class for Template commands
|
|
21
22
|
class OneTemplateHelper < OpenNebulaHelper::OneHelper
|
|
23
|
+
|
|
22
24
|
VM_NAME={
|
|
23
|
-
:name =>
|
|
24
|
-
:large =>
|
|
25
|
+
:name => 'name',
|
|
26
|
+
:large => '--name name',
|
|
25
27
|
:format => String,
|
|
26
|
-
:description =>
|
|
27
|
-
Name of the new VM or TEMPLATE. When instantiating
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
EOT
|
|
28
|
+
:description => <<~EOT.strip
|
|
29
|
+
Name of the new VM or TEMPLATE. When instantiating
|
|
30
|
+
multiple VMs you can use the \"%i\" wildcard to produce
|
|
31
|
+
different names such as vm-0, vm-1...
|
|
32
|
+
EOT
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
MULTIPLE={
|
|
34
|
-
:name =>
|
|
35
|
-
:short =>
|
|
36
|
-
:large =>
|
|
36
|
+
:name => 'multiple',
|
|
37
|
+
:short => '-m x',
|
|
38
|
+
:large => '--multiple x',
|
|
37
39
|
:format => Integer,
|
|
38
|
-
:description =>
|
|
40
|
+
:description => 'Instance multiple VMs'
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
EXTENDED={
|
|
42
|
-
:name =>
|
|
43
|
-
:large =>
|
|
44
|
-
:description =>
|
|
45
|
-
|
|
44
|
+
:name => 'extended',
|
|
45
|
+
:large => '--extended',
|
|
46
|
+
:description => 'Process the template and included extended '+
|
|
47
|
+
'information, such as the SIZE for each DISK'
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
RECURSIVE={
|
|
49
|
-
:name =>
|
|
50
|
-
:short =>
|
|
51
|
-
:large =>
|
|
52
|
-
:description =>
|
|
53
|
-
|
|
51
|
+
:name => 'recursive',
|
|
52
|
+
:short => '-R',
|
|
53
|
+
:large => '--recursive',
|
|
54
|
+
:description => 'Applies the action to the template plus any '+
|
|
55
|
+
'image defined in DISK'
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
PERSISTENT={
|
|
57
|
-
:name =>
|
|
58
|
-
:large =>
|
|
59
|
-
:description =>
|
|
60
|
-
|
|
59
|
+
:name => 'persistent',
|
|
60
|
+
:large => '--persistent',
|
|
61
|
+
:description => 'Creates a private persistent copy of the template '+
|
|
62
|
+
'plus any image defined in DISK, and instantiates that copy'
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
def self.rname
|
|
64
|
-
|
|
66
|
+
'VMTEMPLATE'
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
def self.conf_file
|
|
68
|
-
|
|
70
|
+
'onetemplate.yaml'
|
|
69
71
|
end
|
|
70
72
|
|
|
71
|
-
|
|
72
73
|
def show_resource(id, options)
|
|
73
74
|
resource = retrieve_resource(id)
|
|
74
75
|
|
|
@@ -102,33 +103,31 @@ EOT
|
|
|
102
103
|
def format_pool(options)
|
|
103
104
|
config_file = self.class.table_conf
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
column :ID,
|
|
107
|
-
d[
|
|
106
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
107
|
+
column :ID, 'ONE identifier for the Template', :size=>4 do |d|
|
|
108
|
+
d['ID']
|
|
108
109
|
end
|
|
109
110
|
|
|
110
|
-
column :NAME,
|
|
111
|
-
d[
|
|
111
|
+
column :NAME, 'Name of the Template', :left, :size=>27 do |d|
|
|
112
|
+
d['NAME']
|
|
112
113
|
end
|
|
113
114
|
|
|
114
|
-
column :USER,
|
|
115
|
-
|
|
115
|
+
column :USER, 'Username of the Template owner', :left,
|
|
116
|
+
:size=>15 do |d|
|
|
116
117
|
helper.user_name(d, options)
|
|
117
118
|
end
|
|
118
119
|
|
|
119
|
-
column :GROUP,
|
|
120
|
+
column :GROUP, 'Group of the Template', :left, :size=>15 do |d|
|
|
120
121
|
helper.group_name(d, options)
|
|
121
122
|
end
|
|
122
123
|
|
|
123
|
-
column :REGTIME,
|
|
124
|
-
|
|
125
|
-
OpenNebulaHelper.time_to_str(d[
|
|
124
|
+
column :REGTIME, 'Registration time of the Template',
|
|
125
|
+
:size=>15 do |d|
|
|
126
|
+
OpenNebulaHelper.time_to_str(d['REGTIME'])
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
default :ID, :USER, :GROUP, :NAME, :REGTIME
|
|
129
130
|
end
|
|
130
|
-
|
|
131
|
-
table
|
|
132
131
|
end
|
|
133
132
|
|
|
134
133
|
INT_EXP = /^-?\d+$/
|
|
@@ -153,7 +152,7 @@ EOT
|
|
|
153
152
|
# template. Useful for cpu, mem, vcpu
|
|
154
153
|
if key != template['VMTEMPLATE']['TEMPLATE'][key]
|
|
155
154
|
answers_s << "#{key} = \""
|
|
156
|
-
answers_s << val.gsub('"', "
|
|
155
|
+
answers_s << val.gsub('"', '\"') << "\"\n"
|
|
157
156
|
end
|
|
158
157
|
end
|
|
159
158
|
|
|
@@ -162,7 +161,7 @@ EOT
|
|
|
162
161
|
|
|
163
162
|
private
|
|
164
163
|
|
|
165
|
-
def factory(id=nil)
|
|
164
|
+
def factory(id = nil)
|
|
166
165
|
if id
|
|
167
166
|
OpenNebula::Template.new_with_id(id, @client)
|
|
168
167
|
else
|
|
@@ -171,38 +170,39 @@ EOT
|
|
|
171
170
|
end
|
|
172
171
|
end
|
|
173
172
|
|
|
174
|
-
def factory_pool(user_flag
|
|
173
|
+
def factory_pool(user_flag = -2)
|
|
175
174
|
OpenNebula::TemplatePool.new(@client, user_flag)
|
|
176
175
|
end
|
|
177
176
|
|
|
178
|
-
def format_resource(template,
|
|
179
|
-
str=
|
|
180
|
-
str_h1=
|
|
177
|
+
def format_resource(template, _options = {})
|
|
178
|
+
str='%-15s: %-20s'
|
|
179
|
+
str_h1='%-80s'
|
|
181
180
|
|
|
182
181
|
CLIHelper.print_header(
|
|
183
|
-
str_h1 % "TEMPLATE #{template['ID']} INFORMATION"
|
|
184
|
-
|
|
185
|
-
puts str
|
|
186
|
-
puts str
|
|
187
|
-
puts str
|
|
188
|
-
puts str
|
|
189
|
-
puts str
|
|
190
|
-
|
|
182
|
+
str_h1 % "TEMPLATE #{template['ID']} INFORMATION"
|
|
183
|
+
)
|
|
184
|
+
puts format(str, 'ID', template.id.to_s)
|
|
185
|
+
puts format(str, 'NAME', template.name)
|
|
186
|
+
puts format(str, 'USER', template['UNAME'])
|
|
187
|
+
puts format(str, 'GROUP', template['GNAME'])
|
|
188
|
+
puts format(str, 'LOCK', OpenNebulaHelper.level_lock_to_str(template['LOCK/LOCKED']))
|
|
189
|
+
puts format(str, 'REGISTER TIME', OpenNebulaHelper.time_to_str(template['REGTIME']))
|
|
191
190
|
puts
|
|
192
191
|
|
|
193
|
-
CLIHelper.print_header(str_h1 %
|
|
192
|
+
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
194
193
|
|
|
195
|
-
[
|
|
196
|
-
mask =
|
|
197
|
-
mask[0] =
|
|
198
|
-
mask[1] =
|
|
199
|
-
mask[2] =
|
|
194
|
+
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
|
195
|
+
mask = '---'
|
|
196
|
+
mask[0] = 'u' if template["PERMISSIONS/#{e}_U"] == '1'
|
|
197
|
+
mask[1] = 'm' if template["PERMISSIONS/#{e}_M"] == '1'
|
|
198
|
+
mask[2] = 'a' if template["PERMISSIONS/#{e}_A"] == '1'
|
|
200
199
|
|
|
201
|
-
puts str
|
|
202
|
-
|
|
200
|
+
puts format(str, e, mask)
|
|
201
|
+
end
|
|
203
202
|
puts
|
|
204
203
|
|
|
205
|
-
CLIHelper.print_header(str_h1 %
|
|
204
|
+
CLIHelper.print_header(str_h1 % 'TEMPLATE CONTENTS', false)
|
|
206
205
|
puts template.template_str
|
|
207
206
|
end
|
|
207
|
+
|
|
208
208
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
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 #
|
|
@@ -410,7 +410,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
|
410
410
|
|
|
411
411
|
# In case of multiple quotas, use the global quota or the first
|
|
412
412
|
if q.is_a?(Array)
|
|
413
|
-
global_q = q.find {|h| h['CLUSTER_IDS'].nil? ||
|
|
413
|
+
global_q = q.find {|h| h['CLUSTER_IDS'].nil? || h['CLUSTER_IDS'].empty? }
|
|
414
414
|
q = global_q || q[0]
|
|
415
415
|
end
|
|
416
416
|
|