opennebula-cli 5.8.5 → 5.9.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 +6 -0
- data/bin/oneacl +8 -1
- data/bin/onecluster +8 -1
- data/bin/onedatastore +8 -1
- data/bin/oneflow +28 -17
- data/bin/oneflow-template +6 -0
- data/bin/onegroup +6 -0
- data/bin/onehook +303 -0
- data/bin/onehost +9 -3
- data/bin/oneimage +16 -0
- data/bin/onemarket +6 -0
- data/bin/onemarketapp +6 -0
- data/bin/onesecgroup +6 -0
- data/bin/oneshowback +6 -0
- data/bin/onetemplate +6 -0
- data/bin/oneuser +11 -6
- data/bin/onevcenter +17 -3
- data/bin/onevdc +6 -0
- data/bin/onevm +18 -5
- data/bin/onevmgroup +6 -0
- data/bin/onevnet +19 -1
- data/bin/onevntemplate +6 -0
- data/bin/onevrouter +6 -0
- data/bin/onezone +6 -0
- data/lib/cli_helper.rb +589 -195
- data/lib/one_helper.rb +37 -2
- data/lib/one_helper/oneacl_helper.rb +99 -84
- data/lib/one_helper/onehook_helper.rb +250 -0
- data/lib/one_helper/onehost_helper.rb +200 -0
- data/lib/one_helper/oneimage_helper.rb +23 -0
- data/lib/one_helper/onesecgroup_helper.rb +2 -2
- data/lib/one_helper/oneuser_helper.rb +3 -3
- data/lib/one_helper/onevcenter_helper.rb +2 -1
- data/lib/one_helper/onevm_helper.rb +729 -599
- data/lib/one_helper/onevnet_helper.rb +24 -2
- data/lib/one_helper/onevrouter_helper.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7daaa3be3b192be84b9cddeba135a6e28622ccbf
|
4
|
+
data.tar.gz: 0400970ef76f852acd9c65d548df83a7b5705a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e4142161c7efdc5541cb9cd020a8ba384e5b9800ec62acebf151e74f9942ec3ff5398be3e63debb67a9a3d455d8b5791108632e11128abeed130d1e9d1e5fa
|
7
|
+
data.tar.gz: 283b1c11a82c8a29f74d575c03b096b7f3397c90dcf6f609e9485212f87850edbeca7310677d174721e052c3fd3d78b23d69565feee5c5c95f637845de6701aa
|
data/bin/oneacct
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/oneacl
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -94,7 +100,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
94
100
|
Lists the ACL rule set
|
95
101
|
EOT
|
96
102
|
|
97
|
-
command :list, list_desc, :options => [
|
103
|
+
command :list, list_desc, :options => [CLIHelper::OPTIONS,
|
104
|
+
OpenNebulaHelper::XML,
|
98
105
|
OpenNebulaHelper::DESCRIBE] do
|
99
106
|
helper.list_pool(options)
|
100
107
|
end
|
data/bin/onecluster
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -110,7 +116,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
110
116
|
Shows information for the given Cluster
|
111
117
|
EOT
|
112
118
|
|
113
|
-
command :show, show_desc, :clusterid,
|
119
|
+
command :show, show_desc, :clusterid,
|
120
|
+
:options => [OpenNebulaHelper::XML, OpenNebulaHelper::DECRYPT] do
|
114
121
|
helper.show_resource(args[0], options)
|
115
122
|
end
|
116
123
|
|
data/bin/onedatastore
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -152,7 +158,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
152
158
|
Shows information for the given Datastore
|
153
159
|
EOT
|
154
160
|
|
155
|
-
command :show, show_desc, :datastoreid,
|
161
|
+
command :show, show_desc, :datastoreid,
|
162
|
+
:options => [OpenNebulaHelper::XML, OpenNebulaHelper::DECRYPT] do
|
156
163
|
helper.show_resource(args[0], options)
|
157
164
|
end
|
158
165
|
|
data/bin/oneflow
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -224,16 +230,17 @@ def show_service(client, args, options)
|
|
224
230
|
'INFORMATION'
|
225
231
|
CLIHelper.print_header(str_h1 % str_header)
|
226
232
|
|
227
|
-
puts format(str,
|
228
|
-
puts format(str,
|
229
|
-
puts format(str,
|
230
|
-
puts format(str,
|
233
|
+
puts Kernel.format(str, 'ID', document_hash['DOCUMENT']['ID'])
|
234
|
+
puts Kernel.format(str, 'NAME', document_hash['DOCUMENT']['NAME'])
|
235
|
+
puts Kernel.format(str, 'USER', document_hash['DOCUMENT']['UNAME'])
|
236
|
+
puts Kernel.format(str, 'GROUP', document_hash['DOCUMENT']['GNAME'])
|
231
237
|
|
232
|
-
puts format(str,
|
233
|
-
puts format(str,
|
234
|
-
|
238
|
+
puts Kernel.format(str, 'STRATEGY', template['deployment'])
|
239
|
+
puts Kernel.format(str,
|
240
|
+
'SERVICE STATE',
|
241
|
+
Service.state_str(template['state']))
|
235
242
|
if template['shutdown_action']
|
236
|
-
puts format(str,
|
243
|
+
puts Kernel.format(str, 'SHUTDOWN', template['shutdown_action'])
|
237
244
|
end
|
238
245
|
|
239
246
|
puts
|
@@ -247,7 +254,7 @@ def show_service(client, args, options)
|
|
247
254
|
mask[1] = 'm' if permissions_hash["#{e}_M"] == '1'
|
248
255
|
mask[2] = 'a' if permissions_hash["#{e}_A"] == '1'
|
249
256
|
|
250
|
-
puts format(str,
|
257
|
+
puts Kernel.format(str, e, mask)
|
251
258
|
end
|
252
259
|
|
253
260
|
puts
|
@@ -255,23 +262,27 @@ def show_service(client, args, options)
|
|
255
262
|
template['roles'].each do |role|
|
256
263
|
CLIHelper.print_header("ROLE #{role['name']}", false)
|
257
264
|
|
258
|
-
puts format(str,
|
265
|
+
puts Kernel.format(str,
|
266
|
+
'ROLE STATE',
|
267
|
+
Role.state_str(role['state']))
|
259
268
|
if role['parents']
|
260
|
-
puts format(str,
|
269
|
+
puts Kernel.format(str,
|
270
|
+
'PARENTS',
|
271
|
+
role['parents'].join(', '))
|
261
272
|
end
|
262
|
-
puts format(str,
|
263
|
-
puts format(str,
|
273
|
+
puts Kernel.format(str, 'VM TEMPLATE', role['vm_template'])
|
274
|
+
puts Kernel.format(str, 'CARDINALITY', role['cardinality'])
|
264
275
|
if role['min_vms']
|
265
|
-
puts format(str,
|
276
|
+
puts Kernel.format(str, 'MIN VMS', role['min_vms'])
|
266
277
|
end
|
267
278
|
if role['max_vms']
|
268
|
-
puts format(str,
|
279
|
+
puts Kernel.format(str, 'MAX VMS', role['max_vms'])
|
269
280
|
end
|
270
281
|
if role['coolddown']
|
271
|
-
puts format(str,
|
282
|
+
puts Kernel.format(str, 'COOLDOWN', "#{role['cooldown']}s")
|
272
283
|
end
|
273
284
|
if role['shutdown_action']
|
274
|
-
puts format(str,
|
285
|
+
puts Kernel.format(str, 'SHUTDOWN', role['shutdown_action'])
|
275
286
|
end
|
276
287
|
|
277
288
|
puts 'NODES INFORMATION'
|
data/bin/oneflow-template
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onegroup
CHANGED
@@ -20,8 +20,14 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
25
31
|
end
|
26
32
|
|
27
33
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onehook
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# -------------------------------------------------------------------------- #
|
4
|
+
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
|
5
|
+
# #
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
|
+
# not use this file except in compliance with the License. You may obtain #
|
8
|
+
# a copy of the License at #
|
9
|
+
# #
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
|
+
# #
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
15
|
+
# See the License for the specific language governing permissions and #
|
16
|
+
# limitations under the License. #
|
17
|
+
#--------------------------------------------------------------------------- #
|
18
|
+
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
|
+
|
21
|
+
if !ONE_LOCATION
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
24
|
+
else
|
25
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
28
|
+
|
29
|
+
if File.directory?(GEMS_LOCATION)
|
30
|
+
Gem.use_paths(GEMS_LOCATION)
|
31
|
+
end
|
32
|
+
|
33
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
34
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
35
|
+
|
36
|
+
require 'command_parser'
|
37
|
+
require 'one_helper'
|
38
|
+
require 'one_helper/onehook_helper'
|
39
|
+
|
40
|
+
CommandParser::CmdParser.new(ARGV) do
|
41
|
+
usage '`onehook` <command> [<args>] [<options>]'
|
42
|
+
version OpenNebulaHelper::ONE_VERSION
|
43
|
+
|
44
|
+
helper = OneHookHelper.new
|
45
|
+
|
46
|
+
before_proc do
|
47
|
+
helper.set_client(options)
|
48
|
+
end
|
49
|
+
|
50
|
+
USE = {
|
51
|
+
:name => 'use',
|
52
|
+
:large => '--use',
|
53
|
+
:description => 'lock use actions'
|
54
|
+
}
|
55
|
+
|
56
|
+
MANAGE = {
|
57
|
+
:name => 'manage',
|
58
|
+
:large => '--manage',
|
59
|
+
:description => 'lock manage actions'
|
60
|
+
}
|
61
|
+
|
62
|
+
ADMIN = {
|
63
|
+
:name => 'admin',
|
64
|
+
:large => '--admin',
|
65
|
+
:description => 'lock admin actions'
|
66
|
+
}
|
67
|
+
|
68
|
+
ALL = {
|
69
|
+
:name => 'all',
|
70
|
+
:large => '--all',
|
71
|
+
:description => 'lock all actions'
|
72
|
+
}
|
73
|
+
|
74
|
+
EXECUTION = {
|
75
|
+
:name => 'execution',
|
76
|
+
:large => '--execution exeid',
|
77
|
+
:short => '-e exeid',
|
78
|
+
:format => String,
|
79
|
+
:description => 'execution ID'
|
80
|
+
}
|
81
|
+
|
82
|
+
set :format, :hookid, OpenNebulaHelper.rname_to_id_desc('HOOK') do |arg|
|
83
|
+
OpenNebulaHelper.rname_to_id(arg, 'HOOK')
|
84
|
+
end
|
85
|
+
|
86
|
+
########################################################################
|
87
|
+
# Hook log Options
|
88
|
+
########################################################################
|
89
|
+
|
90
|
+
ERROR = {
|
91
|
+
:name => 'error',
|
92
|
+
:large => '--error',
|
93
|
+
:description => 'Show only fail executions'
|
94
|
+
}
|
95
|
+
|
96
|
+
SUCCESS = {
|
97
|
+
:name => 'success',
|
98
|
+
:large => '--success',
|
99
|
+
:description => 'Show only success executions'
|
100
|
+
}
|
101
|
+
|
102
|
+
HOOK_ID = {
|
103
|
+
:name => 'hook_id',
|
104
|
+
:large => '--hook-id id',
|
105
|
+
:description => 'Hook ID to check logs',
|
106
|
+
:format => Integer
|
107
|
+
}
|
108
|
+
|
109
|
+
SINCE = {
|
110
|
+
:name => 'since',
|
111
|
+
:large => '--since date',
|
112
|
+
:description => 'First date to take logs',
|
113
|
+
:format => String
|
114
|
+
}
|
115
|
+
|
116
|
+
UNTIL = {
|
117
|
+
:name => 'until',
|
118
|
+
:large => '--until date',
|
119
|
+
:description => 'Last date to take logs',
|
120
|
+
:format => String
|
121
|
+
}
|
122
|
+
|
123
|
+
LOG_OPTIONS = [ERROR, SUCCESS, HOOK_ID, SINCE, UNTIL]
|
124
|
+
|
125
|
+
########################################################################
|
126
|
+
# Global Options
|
127
|
+
########################################################################
|
128
|
+
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
129
|
+
|
130
|
+
list_options = CLIHelper::OPTIONS
|
131
|
+
list_options << OpenNebulaHelper::XML
|
132
|
+
list_options << OpenNebulaHelper::NUMERIC
|
133
|
+
list_options << OpenNebulaHelper::DESCRIBE
|
134
|
+
|
135
|
+
########################################################################
|
136
|
+
# Commands
|
137
|
+
########################################################################
|
138
|
+
|
139
|
+
create_desc = <<-EOT.unindent
|
140
|
+
Creates a new Hook from the given description
|
141
|
+
|
142
|
+
Examples:
|
143
|
+
- using a Hook description file:
|
144
|
+
|
145
|
+
onehook create hook.tmpl
|
146
|
+
|
147
|
+
EOT
|
148
|
+
|
149
|
+
command :create, create_desc, :file, :options =>
|
150
|
+
[OpenNebulaHelper::DRY] do
|
151
|
+
helper.create_resource(options) do |tmpl|
|
152
|
+
begin
|
153
|
+
if args[0]
|
154
|
+
template = File.read(args[0])
|
155
|
+
end
|
156
|
+
|
157
|
+
if options[:dry]
|
158
|
+
puts template
|
159
|
+
exit 0
|
160
|
+
else
|
161
|
+
tmpl.allocate(template)
|
162
|
+
end
|
163
|
+
rescue StandardError => e
|
164
|
+
STDERR.puts e.messsage
|
165
|
+
exit(-1)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
delete_desc = <<-EOT.unindent
|
171
|
+
Deletes the given Hook
|
172
|
+
EOT
|
173
|
+
|
174
|
+
command :delete, delete_desc, [:range, :hookid_list] do
|
175
|
+
helper.perform_actions(args[0], options, 'deleted') do |t|
|
176
|
+
t.delete
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
update_desc = <<-EOT.unindent
|
181
|
+
Update the Hook contents. If a path is not provided the editor will
|
182
|
+
be launched to modify the current content.
|
183
|
+
EOT
|
184
|
+
|
185
|
+
command :update, update_desc, :hookid, [:file, nil],
|
186
|
+
:options => OpenNebulaHelper::APPEND do
|
187
|
+
helper.perform_action(args[0], options, 'modified') do |obj|
|
188
|
+
if options[:append]
|
189
|
+
str = OpenNebulaHelper.append_template(args[0], obj, args[1])
|
190
|
+
else
|
191
|
+
str = OpenNebulaHelper.update_template(args[0], obj, args[1])
|
192
|
+
end
|
193
|
+
|
194
|
+
helper.set_client(options)
|
195
|
+
obj = helper.retrieve_resource(obj.id)
|
196
|
+
|
197
|
+
obj.update(str, options[:append])
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
rename_desc = <<-EOT.unindent
|
202
|
+
Renames the Hook
|
203
|
+
EOT
|
204
|
+
|
205
|
+
command :rename, rename_desc, :hookid, :name do
|
206
|
+
helper.perform_action(args[0], options, 'renamed') do |o|
|
207
|
+
o.rename(args[1])
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
list_desc = <<-EOT.unindent
|
212
|
+
Lists Hooks in the pool
|
213
|
+
EOT
|
214
|
+
|
215
|
+
command :list, list_desc, [:filterflag, nil], :options => list_options do
|
216
|
+
helper.list_pool(options, false, args[0])
|
217
|
+
end
|
218
|
+
|
219
|
+
show_desc = <<-EOT.unindent
|
220
|
+
Shows information for the given Hook. An execution ID can be given to
|
221
|
+
obtain detailed information of a given hook execution
|
222
|
+
EOT
|
223
|
+
|
224
|
+
command :show, show_desc, :hookid,
|
225
|
+
:options => [OpenNebulaHelper::XML, OpenNebulaHelper::EXTENDED,
|
226
|
+
EXECUTION] do
|
227
|
+
helper.show_resource(args[0], options)
|
228
|
+
end
|
229
|
+
|
230
|
+
top_desc = <<-EOT.unindent
|
231
|
+
Lists Hooks continuously
|
232
|
+
EOT
|
233
|
+
|
234
|
+
command :top, top_desc, [:filterflag, nil], :options => list_options do
|
235
|
+
helper.list_pool(options, true, args[0])
|
236
|
+
end
|
237
|
+
|
238
|
+
lock_desc = <<-EOT.unindent
|
239
|
+
Locks a Hook with differents levels for lock any actions with this Hook,
|
240
|
+
show and monitoring never will be locked.
|
241
|
+
Valid states are: All.
|
242
|
+
Levels:
|
243
|
+
[Use]: locks Admin, Manage and Use actions.
|
244
|
+
[Manage]: locks Manage and Use actions.
|
245
|
+
[Admin]: locks only Admin actions.
|
246
|
+
EOT
|
247
|
+
|
248
|
+
command :lock, lock_desc, :hookid,
|
249
|
+
:options => [USE, MANAGE, ADMIN, ALL] do
|
250
|
+
helper.perform_action(args[0], options, 'Hook locked') do |t|
|
251
|
+
if !options[:use].nil?
|
252
|
+
level = 1
|
253
|
+
elsif !options[:manage].nil?
|
254
|
+
level = 2
|
255
|
+
elsif !options[:admin].nil?
|
256
|
+
level = 3
|
257
|
+
elsif !options[:all].nil?
|
258
|
+
level = 4
|
259
|
+
else
|
260
|
+
level = 1
|
261
|
+
end
|
262
|
+
t.lock(level)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
unlock_desc = <<-EOT.unindent
|
267
|
+
Unlocks a Hook for unlock any actions with this Hook.
|
268
|
+
Valid states are: All.
|
269
|
+
EOT
|
270
|
+
|
271
|
+
command :unlock, unlock_desc, :hookid do
|
272
|
+
helper.perform_action(args[0], options, 'Hook unlocked') do |t|
|
273
|
+
t.unlock
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
retry_desc = <<-EOT.unindent
|
278
|
+
Retry a previous hook execution.
|
279
|
+
EOT
|
280
|
+
|
281
|
+
command :retry, retry_desc, :hookid, :execid do
|
282
|
+
helper.perform_action(args[0], options, 'Retry executed') do |t|
|
283
|
+
t.retry args[1].to_i
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
log_desc = <<-EOT.unindent
|
288
|
+
Get logs about hook executions
|
289
|
+
|
290
|
+
Examples:
|
291
|
+
|
292
|
+
~ $ onehook log --since 09/19/19 # returns all logs since that date
|
293
|
+
~ $ onehook log --error # returns all failing execs logs
|
294
|
+
~ $ onehook log --hook-id 0 # returns all logs from hook 0
|
295
|
+
|
296
|
+
EOT
|
297
|
+
|
298
|
+
command :log, log_desc, :options => [LOG_OPTIONS, OpenNebulaHelper::XML] do
|
299
|
+
helper.hook_logs(options)
|
300
|
+
|
301
|
+
0
|
302
|
+
end
|
303
|
+
end
|