opennebula-cli 5.6.2 → 5.7.80.pre
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 +37 -35
- data/bin/oneacl +15 -15
- data/bin/onecluster +31 -31
- data/bin/onedatastore +35 -35
- data/bin/oneflow +274 -237
- data/bin/oneflow-template +161 -138
- data/bin/onegroup +32 -30
- data/bin/onehost +68 -63
- data/bin/oneimage +92 -81
- data/bin/onemarket +31 -29
- data/bin/onemarketapp +83 -75
- data/bin/onesecgroup +37 -33
- data/bin/oneshowback +40 -43
- data/bin/onetemplate +73 -70
- data/bin/oneuser +171 -158
- data/bin/onevcenter +70 -64
- data/bin/onevdc +61 -45
- data/bin/onevm +396 -260
- data/bin/onevmgroup +47 -47
- data/bin/onevnet +94 -158
- data/bin/onevntemplate +361 -0
- data/bin/onevrouter +76 -70
- data/bin/onezone +30 -31
- data/lib/one_helper.rb +106 -22
- data/lib/one_helper/oneacl_helper.rb +6 -4
- data/lib/one_helper/onevcenter_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +134 -91
- data/lib/one_helper/onevnet_helper.rb +20 -8
- data/lib/one_helper/onevntemplate_helper.rb +104 -0
- metadata +9 -6
data/bin/oneshowback
CHANGED
@@ -16,38 +16,37 @@
|
|
16
16
|
# limitations under the License. #
|
17
17
|
#--------------------------------------------------------------------------- #
|
18
18
|
|
19
|
-
ONE_LOCATION=ENV[
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
|
-
RUBY_LIB_LOCATION=
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
23
|
else
|
24
|
-
RUBY_LIB_LOCATION=ONE_LOCATION+
|
24
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
28
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
29
29
|
|
30
30
|
require 'command_parser'
|
31
31
|
require 'one_helper/oneacct_helper'
|
32
32
|
|
33
33
|
require 'json'
|
34
34
|
|
35
|
-
|
35
|
+
CommandParser::CmdParser.new(ARGV) do
|
36
|
+
@formats = {}
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
usage "`oneshowback` <command> [<options>]"
|
40
|
-
description ""
|
38
|
+
usage '`oneshowback` <command> [<options>]'
|
39
|
+
description ''
|
41
40
|
version OpenNebulaHelper::ONE_VERSION
|
42
41
|
|
43
|
-
helper=OpenNebulaHelper::OneHelper.new
|
42
|
+
helper = OpenNebulaHelper::OneHelper.new
|
44
43
|
|
45
44
|
before_proc do
|
46
|
-
options[:timeout] = 60 #60 sec
|
45
|
+
options[:timeout] = 60 # 60 sec
|
47
46
|
helper.set_client(options)
|
48
47
|
end
|
49
48
|
|
50
|
-
command :list,
|
49
|
+
command :list, 'Returns the showback records', :options =>
|
51
50
|
AcctHelper::SHOWBACK_OPTIONS + CommandParser::OPTIONS +
|
52
51
|
[OpenNebulaHelper::DESCRIBE, CLIHelper::LIST, CLIHelper::CSV_OPT] +
|
53
52
|
OpenNebulaHelper::CLIENT_OPTIONS do
|
@@ -62,7 +61,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
62
61
|
start_month = -1
|
63
62
|
start_year = -1
|
64
63
|
|
65
|
-
if
|
64
|
+
if options[:start_time]
|
66
65
|
start_month = options[:start_time].month
|
67
66
|
start_year = options[:start_time].year
|
68
67
|
end
|
@@ -70,18 +69,18 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
70
69
|
end_month = -1
|
71
70
|
end_year = -1
|
72
71
|
|
73
|
-
if
|
72
|
+
if options[:end_time]
|
74
73
|
end_month = options[:end_time].month
|
75
74
|
end_year = options[:end_time].year
|
76
75
|
end
|
77
76
|
|
78
77
|
common_opts = {
|
79
78
|
:start_month => start_month,
|
80
|
-
:start_year
|
81
|
-
:end_month
|
82
|
-
:end_year
|
83
|
-
:group
|
84
|
-
:xpath
|
79
|
+
:start_year => start_year,
|
80
|
+
:end_month => end_month,
|
81
|
+
:end_year => end_year,
|
82
|
+
:group => options[:group],
|
83
|
+
:xpath => options[:xpath]
|
85
84
|
}
|
86
85
|
|
87
86
|
pool = OpenNebula::VirtualMachinePool.new(helper.client)
|
@@ -90,7 +89,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
90
89
|
xml_str = pool.showback_xml(filter_flag, common_opts)
|
91
90
|
if OpenNebula.is_error?(xml_str)
|
92
91
|
puts xml_str.message
|
93
|
-
exit
|
92
|
+
exit(-1)
|
94
93
|
end
|
95
94
|
|
96
95
|
if options[:json]
|
@@ -101,25 +100,22 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
101
100
|
elsif options[:xml]
|
102
101
|
puts xml_str
|
103
102
|
end
|
104
|
-
|
105
|
-
exit_code 0
|
106
103
|
else
|
107
|
-
|
108
|
-
order_by = Hash.new
|
104
|
+
order_by = {}
|
109
105
|
if !options[:csv]
|
110
106
|
order_by[:order_by_1] = 'YEAR'
|
111
107
|
order_by[:order_by_2] = 'MONTH'
|
112
108
|
end
|
113
109
|
|
114
110
|
data_hash = pool.showback(filter_flag,
|
115
|
-
|
111
|
+
common_opts.merge(order_by))
|
116
112
|
if OpenNebula.is_error?(data_hash)
|
117
113
|
puts data_hash.message
|
118
|
-
exit
|
114
|
+
exit(-1)
|
119
115
|
end
|
120
116
|
|
121
117
|
if options[:csv]
|
122
|
-
a =
|
118
|
+
a = []
|
123
119
|
|
124
120
|
if data_hash['SHOWBACK_RECORDS']
|
125
121
|
a = data_hash['SHOWBACK_RECORDS']['SHOWBACK']
|
@@ -129,29 +125,28 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
129
125
|
exit(0)
|
130
126
|
end
|
131
127
|
|
132
|
-
data_hash.each
|
133
|
-
value.each
|
128
|
+
data_hash.each do |year, value|
|
129
|
+
value.each do |month, showback_array|
|
134
130
|
AcctHelper.print_month_header(year, month)
|
135
131
|
|
136
132
|
array = showback_array['SHOWBACK_RECORDS']['SHOWBACK']
|
137
133
|
AcctHelper::SHOWBACK_TABLE.show(array, options)
|
138
134
|
puts
|
139
|
-
|
140
|
-
|
141
|
-
}
|
135
|
+
end
|
136
|
+
end
|
142
137
|
|
143
|
-
exit_code 0
|
144
138
|
end
|
139
|
+
|
140
|
+
exit_code 0
|
145
141
|
end
|
146
142
|
|
147
|
-
command :
|
143
|
+
command :calculate, 'Calculates the showback records', :options =>
|
148
144
|
[AcctHelper::START_TIME_SHOWBACK, AcctHelper::END_TIME_SHOWBACK] do
|
149
145
|
|
150
|
-
|
151
146
|
start_month = -1
|
152
147
|
start_year = -1
|
153
148
|
|
154
|
-
if
|
149
|
+
if options[:start_time]
|
155
150
|
start_month = options[:start_time].month
|
156
151
|
start_year = options[:start_time].year
|
157
152
|
end
|
@@ -159,21 +154,23 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
159
154
|
end_month = -1
|
160
155
|
end_year = -1
|
161
156
|
|
162
|
-
if
|
157
|
+
if options[:end_time]
|
163
158
|
end_month = options[:end_time].month
|
164
159
|
end_year = options[:end_time].year
|
165
160
|
end
|
166
161
|
|
167
|
-
rc = OpenNebula::VirtualMachinePool.new(helper.client)
|
168
|
-
|
162
|
+
rc = OpenNebula::VirtualMachinePool.new(helper.client)
|
163
|
+
.calculate_showback(start_month,
|
164
|
+
start_year,
|
165
|
+
end_month,
|
166
|
+
end_year)
|
169
167
|
|
170
168
|
if OpenNebula.is_error?(rc)
|
171
169
|
warn rc.message
|
172
|
-
exit
|
170
|
+
exit(-1)
|
173
171
|
else
|
174
172
|
puts rc
|
175
173
|
exit_code 0
|
176
174
|
end
|
177
|
-
|
178
175
|
end
|
179
|
-
end
|
176
|
+
end
|
data/bin/onetemplate
CHANGED
@@ -16,23 +16,23 @@
|
|
16
16
|
# limitations under the License. #
|
17
17
|
#--------------------------------------------------------------------------- #
|
18
18
|
|
19
|
-
ONE_LOCATION=ENV[
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
|
-
RUBY_LIB_LOCATION=
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
23
|
else
|
24
|
-
RUBY_LIB_LOCATION=ONE_LOCATION+
|
24
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
28
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
29
29
|
|
30
30
|
require 'command_parser'
|
31
31
|
require 'one_helper/onetemplate_helper'
|
32
32
|
require 'one_helper/onevm_helper'
|
33
33
|
|
34
|
-
|
35
|
-
usage
|
34
|
+
CommandParser::CmdParser.new(ARGV) do
|
35
|
+
usage '`onetemplate` <command> [<args>] [<options>]'
|
36
36
|
version OpenNebulaHelper::ONE_VERSION
|
37
37
|
|
38
38
|
helper = OneTemplateHelper.new
|
@@ -41,34 +41,34 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
41
41
|
helper.set_client(options)
|
42
42
|
end
|
43
43
|
|
44
|
-
USE={
|
45
|
-
:name
|
46
|
-
:large =>
|
47
|
-
:description =>
|
44
|
+
USE = {
|
45
|
+
:name => 'use',
|
46
|
+
:large => '--use',
|
47
|
+
:description => 'lock use actions'
|
48
48
|
}
|
49
49
|
|
50
|
-
MANAGE={
|
51
|
-
:name
|
52
|
-
:large =>
|
53
|
-
:description =>
|
50
|
+
MANAGE = {
|
51
|
+
:name => 'manage',
|
52
|
+
:large => '--manage',
|
53
|
+
:description => 'lock manage actions'
|
54
54
|
}
|
55
55
|
|
56
|
-
ADMIN={
|
57
|
-
:name
|
58
|
-
:large =>
|
59
|
-
:description =>
|
56
|
+
ADMIN = {
|
57
|
+
:name => 'admin',
|
58
|
+
:large => '--admin',
|
59
|
+
:description => 'lock admin actions'
|
60
60
|
}
|
61
61
|
|
62
|
-
ALL={
|
63
|
-
:name
|
64
|
-
:large =>
|
65
|
-
:description =>
|
62
|
+
ALL = {
|
63
|
+
:name => 'all',
|
64
|
+
:large => '--all',
|
65
|
+
:description => 'lock all actions'
|
66
66
|
}
|
67
67
|
|
68
68
|
########################################################################
|
69
69
|
# Global Options
|
70
70
|
########################################################################
|
71
|
-
set :option, CommandParser::OPTIONS+OpenNebulaHelper::CLIENT_OPTIONS
|
71
|
+
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
72
72
|
|
73
73
|
list_options = CLIHelper::OPTIONS
|
74
74
|
list_options << OpenNebulaHelper::XML
|
@@ -80,18 +80,18 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
80
80
|
OneTemplateHelper::MULTIPLE,
|
81
81
|
OneTemplateHelper::USERDATA,
|
82
82
|
OneVMHelper::HOLD,
|
83
|
-
OneTemplateHelper::PERSISTENT
|
83
|
+
OneTemplateHelper::PERSISTENT
|
84
84
|
]
|
85
85
|
|
86
86
|
########################################################################
|
87
87
|
# Formatters for arguments
|
88
88
|
########################################################################
|
89
|
-
set :format, :groupid, OpenNebulaHelper.rname_to_id_desc(
|
90
|
-
OpenNebulaHelper.rname_to_id(arg,
|
89
|
+
set :format, :groupid, OpenNebulaHelper.rname_to_id_desc('GROUP') do |arg|
|
90
|
+
OpenNebulaHelper.rname_to_id(arg, 'GROUP')
|
91
91
|
end
|
92
92
|
|
93
|
-
set :format, :userid, OpenNebulaHelper.rname_to_id_desc(
|
94
|
-
OpenNebulaHelper.rname_to_id(arg,
|
93
|
+
set :format, :userid, OpenNebulaHelper.rname_to_id_desc('USER') do |arg|
|
94
|
+
OpenNebulaHelper.rname_to_id(arg, 'USER')
|
95
95
|
end
|
96
96
|
|
97
97
|
set :format, :templateid, OneTemplateHelper.to_id_desc do |arg|
|
@@ -131,12 +131,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
131
131
|
EOT
|
132
132
|
|
133
133
|
command :create, create_desc, [:file, nil], :options =>
|
134
|
-
[OneTemplateHelper::VM_NAME]+OpenNebulaHelper::TEMPLATE_OPTIONS+
|
134
|
+
[OneTemplateHelper::VM_NAME] + OpenNebulaHelper::TEMPLATE_OPTIONS +
|
135
135
|
[OpenNebulaHelper::DRY] do
|
136
136
|
|
137
137
|
if args[0] && OpenNebulaHelper.create_template_options_used?(options)
|
138
|
-
STDERR.puts
|
139
|
-
|
138
|
+
STDERR.puts 'You can not use both template file and template' \
|
139
|
+
' creation options.'
|
140
140
|
next -1
|
141
141
|
end
|
142
142
|
|
@@ -161,9 +161,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
161
161
|
else
|
162
162
|
tmpl.allocate(template)
|
163
163
|
end
|
164
|
-
rescue => e
|
164
|
+
rescue StandardError => e
|
165
165
|
STDERR.puts e.messsage
|
166
|
-
exit
|
166
|
+
exit(-1)
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
@@ -173,11 +173,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
173
173
|
EOT
|
174
174
|
|
175
175
|
command :clone, clone_desc, :templateid, :name,
|
176
|
-
:options =>OneTemplateHelper::RECURSIVE do
|
176
|
+
:options => OneTemplateHelper::RECURSIVE do
|
177
177
|
|
178
178
|
recursive = (options[:recursive] == true)
|
179
179
|
|
180
|
-
helper.perform_action(args[0],options,
|
180
|
+
helper.perform_action(args[0], options, 'cloned') do |t|
|
181
181
|
res = t.clone(args[1], recursive)
|
182
182
|
|
183
183
|
if !OpenNebula.is_error?(res)
|
@@ -193,11 +193,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
193
193
|
EOT
|
194
194
|
|
195
195
|
command :delete, delete_desc, [:range, :templateid_list],
|
196
|
-
:options =>OneTemplateHelper::RECURSIVE do
|
196
|
+
:options => OneTemplateHelper::RECURSIVE do
|
197
197
|
|
198
198
|
recursive = (options[:recursive] == true)
|
199
199
|
|
200
|
-
helper.perform_actions(args[0],options,
|
200
|
+
helper.perform_actions(args[0], options, 'deleted') do |t|
|
201
201
|
t.delete(recursive)
|
202
202
|
end
|
203
203
|
end
|
@@ -211,12 +211,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
211
211
|
EOT
|
212
212
|
|
213
213
|
command :instantiate, instantiate_desc, :templateid, [:file, nil],
|
214
|
-
:options=>instantiate_options+
|
215
|
-
|
214
|
+
:options => instantiate_options +
|
215
|
+
OpenNebulaHelper::TEMPLATE_OPTIONS do
|
216
|
+
exit_code = 0
|
216
217
|
|
217
218
|
if args[1] && OpenNebulaHelper.create_template_options_used?(options)
|
218
|
-
STDERR.puts
|
219
|
-
|
219
|
+
STDERR.puts 'You cannot use both template file and template' \
|
220
|
+
' creation options.'
|
220
221
|
next -1
|
221
222
|
end
|
222
223
|
|
@@ -224,14 +225,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
224
225
|
user_inputs = nil
|
225
226
|
|
226
227
|
number.times do |i|
|
227
|
-
exit_code=helper.perform_action(args[0], options,
|
228
|
-
|
228
|
+
exit_code = helper.perform_action(args[0], options,
|
229
|
+
'instantiated') do |t|
|
229
230
|
name = options[:name]
|
230
|
-
name = name.gsub(
|
231
|
+
name = name.gsub('%i', i.to_s) if name
|
231
232
|
|
232
|
-
on_hold = options[:hold]
|
233
|
+
on_hold = !options[:hold].nil?
|
233
234
|
|
234
|
-
extra_template =
|
235
|
+
extra_template = ''
|
235
236
|
rc = t.info
|
236
237
|
|
237
238
|
if OpenNebula.is_error?(rc)
|
@@ -252,11 +253,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
252
253
|
extra_template = res.last
|
253
254
|
end
|
254
255
|
|
255
|
-
|
256
|
+
if !user_inputs
|
257
|
+
user_inputs = OneTemplateHelper.get_user_inputs(t.to_hash)
|
258
|
+
end
|
256
259
|
|
257
|
-
extra_template << "\n"
|
260
|
+
extra_template << "\n#{user_inputs}"
|
258
261
|
|
259
|
-
persistent = options[:persistent]
|
262
|
+
persistent = !options[:persistent].nil?
|
260
263
|
|
261
264
|
res = t.instantiate(name, on_hold, extra_template, persistent)
|
262
265
|
|
@@ -267,7 +270,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
267
270
|
res
|
268
271
|
end
|
269
272
|
|
270
|
-
break if exit_code
|
273
|
+
break if exit_code == -1
|
271
274
|
end
|
272
275
|
|
273
276
|
exit_code
|
@@ -277,8 +280,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
277
280
|
Changes the Template group
|
278
281
|
EOT
|
279
282
|
|
280
|
-
command :chgrp, chgrp_desc,[:range, :templateid_list], :groupid do
|
281
|
-
helper.perform_actions(args[0],options,
|
283
|
+
command :chgrp, chgrp_desc, [:range, :templateid_list], :groupid do
|
284
|
+
helper.perform_actions(args[0], options, 'Group changed') do |t|
|
282
285
|
t.chown(-1, args[1].to_i)
|
283
286
|
end
|
284
287
|
end
|
@@ -288,9 +291,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
288
291
|
EOT
|
289
292
|
|
290
293
|
command :chown, chown_desc, [:range, :templateid_list], :userid,
|
291
|
-
[:groupid,nil] do
|
292
|
-
|
293
|
-
helper.perform_actions(args[0],options,
|
294
|
+
[:groupid, nil] do
|
295
|
+
args[2].nil? ? gid = -1 : gid = args[2].to_i
|
296
|
+
helper.perform_actions(args[0], options, 'Owner/Group changed') do |t|
|
294
297
|
t.chown(args[1].to_i, gid)
|
295
298
|
end
|
296
299
|
end
|
@@ -300,11 +303,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
300
303
|
EOT
|
301
304
|
|
302
305
|
command :chmod, chmod_desc, [:range, :templateid_list], :octet,
|
303
|
-
:options =>OneTemplateHelper::RECURSIVE do
|
306
|
+
:options => OneTemplateHelper::RECURSIVE do
|
304
307
|
|
305
308
|
recursive = (options[:recursive] == true)
|
306
309
|
|
307
|
-
helper.perform_actions(args[0],options,
|
310
|
+
helper.perform_actions(args[0], options, 'Permissions changed') do |t|
|
308
311
|
t.chmod_octet(args[1], recursive)
|
309
312
|
end
|
310
313
|
end
|
@@ -315,8 +318,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
315
318
|
EOT
|
316
319
|
|
317
320
|
command :update, update_desc, :templateid, [:file, nil],
|
318
|
-
|
319
|
-
helper.perform_action(args[0],options,
|
321
|
+
:options => OpenNebulaHelper::APPEND do
|
322
|
+
helper.perform_action(args[0], options, 'modified') do |obj|
|
320
323
|
if options[:append]
|
321
324
|
str = OpenNebulaHelper.append_template(args[0], obj, args[1])
|
322
325
|
else
|
@@ -339,12 +342,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
339
342
|
EOT
|
340
343
|
|
341
344
|
command :rename, rename_desc, :templateid, :name do
|
342
|
-
helper.perform_action(args[0],options,
|
345
|
+
helper.perform_action(args[0], options, 'renamed') do |o|
|
343
346
|
o.rename(args[1])
|
344
347
|
end
|
345
348
|
end
|
346
349
|
|
347
|
-
command :list, list_desc, [:filterflag, nil], :options=>list_options do
|
350
|
+
command :list, list_desc, [:filterflag, nil], :options => list_options do
|
348
351
|
helper.list_pool(options, false, args[0])
|
349
352
|
end
|
350
353
|
|
@@ -353,22 +356,22 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
353
356
|
EOT
|
354
357
|
|
355
358
|
command :show, show_desc, :templateid,
|
356
|
-
|
359
|
+
:options => [OpenNebulaHelper::XML, OneTemplateHelper::EXTENDED] do
|
357
360
|
|
358
|
-
helper.show_resource(args[0],options)
|
361
|
+
helper.show_resource(args[0], options)
|
359
362
|
end
|
360
363
|
|
361
364
|
top_desc = <<-EOT.unindent
|
362
365
|
Lists Templates continuously
|
363
366
|
EOT
|
364
367
|
|
365
|
-
command :top, top_desc, [:filterflag, nil], :options=>list_options do
|
368
|
+
command :top, top_desc, [:filterflag, nil], :options => list_options do
|
366
369
|
helper.list_pool(options, true, args[0])
|
367
370
|
end
|
368
371
|
|
369
372
|
lock_desc = <<-EOT.unindent
|
370
|
-
Locks a VM with differents levels for lock any actions with this VM,
|
371
|
-
monitoring never will be locked.
|
373
|
+
Locks a VM with differents levels for lock any actions with this VM,
|
374
|
+
show and monitoring never will be locked.
|
372
375
|
Valid states are: All.
|
373
376
|
Levels:
|
374
377
|
[Use]: locks Admin, Manage and Use actions.
|
@@ -377,8 +380,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
377
380
|
EOT
|
378
381
|
|
379
382
|
command :lock, lock_desc, :templateid,
|
380
|
-
|
381
|
-
helper.perform_action(args[0],options,
|
383
|
+
:options => [USE, MANAGE, ADMIN, ALL] do
|
384
|
+
helper.perform_action(args[0], options, 'Template locked') do |t|
|
382
385
|
if !options[:use].nil?
|
383
386
|
level = 1
|
384
387
|
elsif !options[:manage].nil?
|
@@ -400,7 +403,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
400
403
|
EOT
|
401
404
|
|
402
405
|
command :unlock, unlock_desc, :templateid do
|
403
|
-
helper.perform_action(args[0],options,
|
406
|
+
helper.perform_action(args[0], options, 'Template unlocked') do |t|
|
404
407
|
t.unlock
|
405
408
|
end
|
406
409
|
end
|