zabcon 0.0.3 → 0.0.4
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.
- data/libs/argument_processor.rb +17 -24
- data/libs/command_help.rb +8 -11
- data/libs/command_tree.rb +154 -71
- data/libs/zabcon_core.rb +75 -87
- data/libs/zabcon_globals.rb +2 -2
- data/zabcon.rb +2 -2
- metadata +4 -4
data/libs/argument_processor.rb
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
|
19
19
|
##########################################
|
20
20
|
# Subversion information
|
21
|
-
# $Id: argument_processor.rb
|
22
|
-
# $Revision:
|
21
|
+
# $Id: argument_processor.rb 266 2010-12-30 11:03:54Z richlv $
|
22
|
+
# $Revision: 266 $
|
23
23
|
##########################################
|
24
24
|
|
25
25
|
require 'libs/zdebug'
|
@@ -291,7 +291,7 @@ class ArgumentProcessor
|
|
291
291
|
|
292
292
|
debug(2,args,"Pre substitution")
|
293
293
|
args=unescape(substitute(split(args)).join)
|
294
|
-
debug(2,args,"Post
|
294
|
+
debug(2,args,"Post substitution")
|
295
295
|
|
296
296
|
return args
|
297
297
|
end
|
@@ -325,7 +325,7 @@ class ArgumentProcessor
|
|
325
325
|
end
|
326
326
|
|
327
327
|
# This is the default Parameter processor. This is passed to the Command Tree object when it is instantiated
|
328
|
-
# The default processor also checks the incoming parameters against
|
328
|
+
# The default processor also checks the incoming parameters against a list of valid arguments, and merges
|
329
329
|
# the user variables with the inbound arguments with the inbound arguments taking precedence, raises an
|
330
330
|
# exception if there is an error
|
331
331
|
def default_processor(help_func,valid_args,args,user_vars,*options)
|
@@ -528,21 +528,21 @@ class ArgumentProcessor
|
|
528
528
|
end
|
529
529
|
|
530
530
|
# Item types
|
531
|
-
# 0 Zabbix agent
|
532
|
-
# 1 SNMPv1 agent
|
533
|
-
# 2 Zabbix trapper
|
534
|
-
# 3 Simple check
|
535
|
-
# 4 SNMPv2 agent
|
536
|
-
# 5 Zabbix internal
|
537
|
-
# 6 SNMPv3 agent
|
531
|
+
# 0 Zabbix agent - Passive
|
532
|
+
# 1 SNMPv1 agent - SNMP
|
533
|
+
# 2 Zabbix trapper - Trapper
|
534
|
+
# 3 Simple check - Simple
|
535
|
+
# 4 SNMPv2 agent - SNMP2
|
536
|
+
# 5 Zabbix internal - Internal
|
537
|
+
# 6 SNMPv3 agent - SNMP3
|
538
538
|
# 7 Zabbix agent (active) - Active
|
539
|
-
# 8 Zabbix aggregate
|
540
|
-
# 10 External check
|
539
|
+
# 8 Zabbix aggregate - Aggregate
|
540
|
+
# 10 External check - External
|
541
541
|
# 11 Database monitor - Database
|
542
|
-
# 12 IPMI agent
|
543
|
-
# 13 SSH agent
|
544
|
-
# 14 TELNET agent
|
545
|
-
# 15 Calculated
|
542
|
+
# 12 IPMI agent - IPMI
|
543
|
+
# 13 SSH agent - SSH
|
544
|
+
# 14 TELNET agent - Telnet
|
545
|
+
# 15 Calculated - Calculated
|
546
546
|
|
547
547
|
#value types
|
548
548
|
# 0 Numeric (float)
|
@@ -759,10 +759,3 @@ if __FILE__ == $0
|
|
759
759
|
p arg='hosts=[{hostid=10017}] name="zzz"'
|
760
760
|
pp arg_processor.params_to_hash(arg)
|
761
761
|
end
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
data/libs/command_help.rb
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
|
19
19
|
##########################################
|
20
20
|
# Subversion information
|
21
|
-
# $Id: command_help.rb
|
22
|
-
# $Revision:
|
21
|
+
# $Id: command_help.rb 270 2011-01-04 06:13:31Z nelsonab $
|
22
|
+
# $Revision: 270 $
|
23
23
|
##########################################
|
24
24
|
|
25
25
|
require 'libs/zdebug'
|
@@ -76,29 +76,26 @@ class CommandHelp
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def help(command_tree,input)
|
79
|
+
input=input.gsub(/^\s*help\s*/,"") #strip out the help statement at the start
|
79
80
|
debug(6,command_tree.commands,"command_tree",350)
|
80
81
|
debug(6,input,"input")
|
81
82
|
|
82
83
|
items=input.split(" ")
|
83
|
-
if items.length==
|
84
|
-
debug(6)
|
85
|
-
|
84
|
+
if items.length==0
|
86
85
|
puts @doc.elements["//item[@command='help']"].text
|
87
86
|
else # more than "help" was typed by the user
|
88
|
-
items.delete("help")
|
89
87
|
help_cmd=items.join(" ").lstrip.chomp
|
90
88
|
|
91
|
-
if help_cmd=="commands"
|
89
|
+
if help_cmd.downcase=="commands"
|
92
90
|
puts @doc.elements["//item[@command='help_commands']"].text
|
93
91
|
else
|
94
92
|
debug(4,help_cmd,"Searching for help on")
|
95
93
|
|
96
94
|
cmd=command_tree.search(help_cmd)[0] #search returns an array
|
97
|
-
|
98
|
-
if !cmd.helpproc.nil?
|
99
|
-
cmd.helpproc.call(nil) #TODO: need to fix, see line 67 above
|
100
|
-
else
|
95
|
+
if cmd.nil? or cmd[:helpproc].nil?
|
101
96
|
puts "Unable to find help for \"#{help_cmd}\""
|
97
|
+
else
|
98
|
+
cmd[:helpproc].call(nil) #TODO: need to fix, see line 67 above
|
102
99
|
end
|
103
100
|
end
|
104
101
|
end
|
data/libs/command_tree.rb
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
|
19
19
|
##########################################
|
20
20
|
# Subversion information
|
21
|
-
# $Id: command_tree.rb
|
22
|
-
# $Revision:
|
21
|
+
# $Id: command_tree.rb 270 2011-01-04 06:13:31Z nelsonab $
|
22
|
+
# $Revision: 270 $
|
23
23
|
##########################################
|
24
24
|
|
25
25
|
require 'libs/zdebug'
|
@@ -32,7 +32,7 @@ class Parser
|
|
32
32
|
attr_reader :commands
|
33
33
|
|
34
34
|
def initialize(default_argument_processor)
|
35
|
-
@commands=
|
35
|
+
@commands=NewCommandTree.new
|
36
36
|
@default_argument_processor=default_argument_processor
|
37
37
|
end
|
38
38
|
|
@@ -53,13 +53,11 @@ class Parser
|
|
53
53
|
|
54
54
|
str=strip_comments(str)
|
55
55
|
|
56
|
-
nodes = [""]+str.split
|
57
56
|
|
58
|
-
cmd_node=@commands.search(nodes) # a side effect of the function is that it also manipulates nodes
|
57
|
+
# cmd_node=@commands.search(nodes) # a side effect of the function is that it also manipulates nodes
|
58
|
+
cmd_node=@commands.get_command(str)
|
59
59
|
debug(7,cmd_node,"search result")
|
60
|
-
|
61
|
-
|
62
|
-
return cmd_node,args
|
60
|
+
return cmd_node[:command],cmd_node[:parameters]
|
63
61
|
|
64
62
|
end
|
65
63
|
|
@@ -80,17 +78,20 @@ class Parser
|
|
80
78
|
debug(7,str,"Parsing")
|
81
79
|
# options=
|
82
80
|
debug(7,user_vars,"User Variables")
|
83
|
-
cmd_node,args=search(str)
|
84
81
|
|
85
|
-
|
82
|
+
result=@commands.get_command(str)
|
83
|
+
|
84
|
+
cmd=result[:command]
|
85
|
+
|
86
|
+
if cmd.nil? or cmd[:commandproc].nil? then
|
86
87
|
raise ParseError.new("Parse error, incomplete/unknown command: #{str}",:retry=>true)
|
87
88
|
else
|
88
89
|
# The call here to the argument process requires one argument as it's a lambda block which is setup when the
|
89
90
|
# command node is created
|
90
|
-
debug(6,
|
91
|
-
args=
|
91
|
+
debug(6,result[:parameters],"calling argument processor")
|
92
|
+
args=cmd[:argument_processor].call(result[:parameters],user_vars)
|
92
93
|
debug(6,args,"received from argument processor")
|
93
|
-
retval = args.nil? ? nil : {:proc=>
|
94
|
+
retval = args.nil? ? nil : {:proc=>cmd[:commandproc], :helpproc=>cmd[:helpproc], :options=>cmd[:options]}.merge(args)
|
94
95
|
return retval
|
95
96
|
end
|
96
97
|
end
|
@@ -119,19 +120,142 @@ class Parser
|
|
119
120
|
end
|
120
121
|
end
|
121
122
|
|
122
|
-
def insert(insert_path,
|
123
|
-
debug(10,{"insert_path"=>insert_path, "
|
124
|
-
insert_path_arr=[""]+insert_path.split # we must pre-load our array with a blank node at the front
|
123
|
+
def insert(insert_path,commandproc,arguments=[],helpproc=nil,argument_processor=nil,*options)
|
124
|
+
debug(10,{"insert_path"=>insert_path, "commandproc"=>commandproc, "arguments"=> arguments, "helpproc"=>helpproc, "argument_processor"=>argument_processor, "options"=>options})
|
125
|
+
# insert_path_arr=[""]+insert_path.split # we must pre-load our array with a blank node at the front
|
125
126
|
# p insert_path_arr
|
126
127
|
|
127
128
|
# If the parameter "argument_processor" is nil use the default argument processor
|
128
129
|
arg_processor = argument_processor.nil? ? @default_argument_processor : argument_processor
|
129
|
-
@commands.insert(
|
130
|
+
@commands.insert(insert_path,commandproc,arguments,helpproc,arg_processor,options)
|
130
131
|
end
|
131
132
|
|
132
133
|
end
|
133
134
|
|
135
|
+
#{"add"=>{:node=>proc, "host"=>{:node=>proc,"group"=>{:node=>proc}}},"delete"=>...}
|
136
|
+
|
137
|
+
class NewCommandTree
|
138
|
+
include ZDebug
|
139
|
+
|
140
|
+
def initialize
|
141
|
+
@tree = {}
|
142
|
+
end
|
143
|
+
|
144
|
+
def insert(insert_path,commandproc,arguments,helpproc,argument_processor,options)
|
145
|
+
tree_node=@tree
|
146
|
+
path_length=insert_path.length-1
|
147
|
+
insert_path.each_index do |index|
|
148
|
+
if tree_node[insert_path[index]].nil?
|
149
|
+
if index<path_length
|
150
|
+
tree_node[insert_path[index]]={}
|
151
|
+
tree_node=tree_node[insert_path[index]]
|
152
|
+
else
|
153
|
+
local_arg_processor=lambda do |params,user_vars|
|
154
|
+
if argument_processor.nil?
|
155
|
+
nil
|
156
|
+
else
|
157
|
+
argument_processor.call(helpproc,arguments,params,user_vars,options) # We pass the list of valid arguments to
|
158
|
+
end
|
159
|
+
end
|
160
|
+
if options.nil?
|
161
|
+
local_options=nil
|
162
|
+
else
|
163
|
+
local_options = Hash[*options.collect { |v|
|
164
|
+
[v, true]
|
165
|
+
}.flatten]
|
166
|
+
end
|
167
|
+
tree_node[insert_path[index]]={:node=>
|
168
|
+
{:commandproc=>commandproc, :arguments=>arguments, :helpproc=>helpproc,
|
169
|
+
:argument_processor=>local_arg_processor,:options=>local_options}}
|
170
|
+
end
|
171
|
+
else
|
172
|
+
tree_node=tree_node[insert_path[index]]
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
#get_command(String)
|
178
|
+
#returns a Hash with two items: :command and :parameters
|
179
|
+
#:command is a hash denoting all of the components of a the command when it was inserted
|
180
|
+
#:parameters is the remainder of the String passed in.
|
181
|
+
#
|
182
|
+
#example:
|
183
|
+
# get_command("get host show=all")
|
184
|
+
# {:command=>{hash created from insert}, :parameters=>"show=all"}
|
185
|
+
#
|
186
|
+
# get_command("get host test test2")
|
187
|
+
# {:command=>{hash created from insert}, :parameters=>"test test2"
|
188
|
+
def get_command(str)
|
189
|
+
str_array=str.downcase.split #ensure all comparisons are done in lower case
|
190
|
+
str_items=str_array.length
|
191
|
+
|
192
|
+
cur_node=@tree
|
193
|
+
count=0
|
194
|
+
|
195
|
+
str_array.collect do |item|
|
196
|
+
break if cur_node[item].nil?
|
197
|
+
count+=1
|
198
|
+
|
199
|
+
cur_node=cur_node[item]
|
200
|
+
end
|
201
|
+
|
202
|
+
cmd= cur_node.nil? ? nil : cur_node[:node]
|
203
|
+
|
204
|
+
#remove preceding items found so we can return the remainder
|
205
|
+
#as the parameters
|
206
|
+
count.times do |i|
|
207
|
+
str=str.gsub(/^#{str_array[i]}/,"")
|
208
|
+
str=str.gsub(/^\s*/,"")
|
209
|
+
end
|
210
|
+
|
211
|
+
{:command=>cmd,:parameters=>str}
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
def search(search_path)
|
216
|
+
debug(10,search_path,"search_path")
|
217
|
+
return retval if results.empty? # no more children to search, return retval which may be self or nil, see logic above
|
218
|
+
debug(10)
|
219
|
+
|
220
|
+
return results[0].search(search_path)
|
221
|
+
debug(10,"Not digging deeper")
|
222
|
+
|
223
|
+
return self if search_path[0]==@command
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
def insert(insert_path,command,commandproc,arguments,helpproc,argument_processor,options)
|
228
|
+
do_insert(insert_path,command,commandproc,arguments,helpproc,argument_processor,options,0)
|
229
|
+
end
|
134
230
|
|
231
|
+
# Insert path is the path to insert the item into the tree
|
232
|
+
# Insert path is passed in as an array of names which associate with pre-existing nodes
|
233
|
+
# The function will recursively insert the command and will remove the top of the input path stack at each level until it
|
234
|
+
# finds the appropraite level. If the appropriate level is never found an exception is raised.
|
235
|
+
def do_insert(insert_path,command,commandproc,arguments,helpproc,argument_processor,options,depth)
|
236
|
+
debug(11,{"insert_path"=>insert_path, "command"=>command, "commandproc"=>commandproc, "arguments"=> arguments,
|
237
|
+
"helpproc"=>helpproc, "verify_func"=>argument_processor, "depth"=>depth})
|
238
|
+
debug(11,@command,"self.command")
|
239
|
+
# debug(11,@children.map {|child| child.command},"children")
|
240
|
+
|
241
|
+
if insert_path[0]==@command then
|
242
|
+
debug(11,"Found node")
|
243
|
+
if insert_path.length==1 then
|
244
|
+
debug(11,command,"inserting")
|
245
|
+
@children << CommandTree.new(command,commandproc,depth+1,arguments,helpproc,argument_processor,options)
|
246
|
+
else
|
247
|
+
debug(11,"Not found walking tree")
|
248
|
+
insert_path.shift
|
249
|
+
if !@children.empty? then
|
250
|
+
@children.each { |node| node.do_insert(insert_path,command,commandproc,arguments,helpproc,argument_processor,options,depth+1)}
|
251
|
+
else
|
252
|
+
raise(Command_Tree_Exception,"Unable to find insert point in Command Tree")
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
=begin
|
135
259
|
class CommandTree
|
136
260
|
|
137
261
|
include ZDebug
|
@@ -191,72 +315,31 @@ class CommandTree
|
|
191
315
|
# or the immediate children nodes. It does not search the tree beyond one level.
|
192
316
|
# The loggedin argument is used to differentiate searching for commands which require a valid
|
193
317
|
# login or not. If loggedin is false it will return commands which do not require a valid login.
|
194
|
-
|
195
|
-
debug(10,search_path,"search_path")
|
196
|
-
debug(10,self,"self",300)
|
318
|
+
debug(10,self,"self",300)
|
197
319
|
|
198
|
-
|
199
|
-
|
320
|
+
return nil if search_path.nil?
|
321
|
+
return nil if search_path.empty?
|
200
322
|
|
201
|
-
|
323
|
+
retval=nil
|
202
324
|
|
203
|
-
|
325
|
+
retval=self if search_path[0]==@command
|
204
326
|
|
205
327
|
|
206
|
-
|
207
|
-
|
328
|
+
search_path.shift
|
329
|
+
debug(10,search_path, "shifted search path")
|
208
330
|
|
209
|
-
|
331
|
+
return retval if search_path.length==0
|
210
332
|
|
211
333
|
# p search_path
|
212
334
|
# p @children.map {|child| child.command}
|
213
|
-
|
214
|
-
|
215
|
-
results=@children.map {|child| child.command==search_path[0] ? child : nil }
|
216
|
-
results.compact!
|
217
|
-
debug(10,results,"Children search results",200)
|
218
|
-
return retval if results.empty? # no more children to search, return retval which may be self or nil, see logic above
|
219
|
-
debug(10)
|
220
|
-
|
221
|
-
return results[0].search(search_path)
|
222
|
-
debug(10,"Not digging deeper")
|
223
|
-
|
224
|
-
return self if search_path[0]==@command
|
225
|
-
|
226
|
-
end
|
335
|
+
debug(10,@children.map{|child| child.command},"Current children")
|
227
336
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
# Insert path is the path to insert the item into the tree
|
233
|
-
# Insert path is passed in as an array of names which associate with pre-existing nodes
|
234
|
-
# The function will recursively insert the command and will remove the top of the input path stack at each level until it
|
235
|
-
# finds the appropraite level. If the appropriate level is never found an exception is raised.
|
236
|
-
def do_insert(insert_path,command,commandproc,arguments,helpproc,argument_processor,options,depth)
|
237
|
-
debug(11,{"insert_path"=>insert_path, "command"=>command, "commandproc"=>commandproc, "arguments"=> arguments,
|
238
|
-
"helpproc"=>helpproc, "verify_func"=>argument_processor, "depth"=>depth})
|
239
|
-
debug(11,@command,"self.command")
|
240
|
-
# debug(11,@children.map {|child| child.command},"children")
|
241
|
-
|
242
|
-
if insert_path[0]==@command then
|
243
|
-
debug(11,"Found node")
|
244
|
-
if insert_path.length==1 then
|
245
|
-
debug(11,command,"inserting")
|
246
|
-
@children << CommandTree.new(command,commandproc,depth+1,arguments,helpproc,argument_processor,options)
|
247
|
-
else
|
248
|
-
debug(11,"Not found walking tree")
|
249
|
-
insert_path.shift
|
250
|
-
if !@children.empty? then
|
251
|
-
@children.each { |node| node.do_insert(insert_path,command,commandproc,arguments,helpproc,argument_processor,options,depth+1)}
|
252
|
-
else
|
253
|
-
raise(Command_Tree_Exception,"Unable to find insert point in Command Tree")
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
end
|
337
|
+
results=@children.map {|child| child.command==search_path[0] ? child : nil }
|
338
|
+
results.compact!
|
339
|
+
debug(10,results,"Children search results",200)
|
258
340
|
|
259
341
|
end
|
342
|
+
=end
|
260
343
|
|
261
344
|
|
262
345
|
if __FILE__ == $0
|
data/libs/zabcon_core.rb
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
##########################################
|
22
22
|
# Subversion information
|
23
23
|
# $Id: $
|
24
|
-
# $Revision:
|
24
|
+
# $Revision: 270 $
|
25
25
|
##########################################
|
26
26
|
|
27
27
|
require 'parseconfig'
|
@@ -109,104 +109,92 @@ class ZabconCore
|
|
109
109
|
# parameters for insert: insert_path, command, commandproc, arguments=[], helpproc=nil, verify_func=nil, options
|
110
110
|
|
111
111
|
# These commands do not require a valid login
|
112
|
-
@commands.insert "
|
113
|
-
@commands.insert "
|
114
|
-
@commands.insert "
|
115
|
-
|
116
|
-
@commands.insert "
|
117
|
-
@commands.insert "
|
118
|
-
@commands.insert "
|
119
|
-
@commands.insert "
|
120
|
-
@commands.insert "",
|
121
|
-
@commands.insert "",
|
122
|
-
@commands.insert "",
|
123
|
-
@commands.insert "
|
124
|
-
@commands.insert "set",
|
125
|
-
@commands.insert "set",
|
126
|
-
@commands.insert "
|
127
|
-
@commands.insert "
|
128
|
-
@commands.insert "
|
129
|
-
|
130
|
-
@commands.insert "show", "env", self.method(:show_env), no_args, no_help, @arg_processor.method(:array_processor), :suppress_printer
|
131
|
-
@commands.insert "unset", "var", self.method(:unset_var), no_args, no_help, @arg_processor.method(:array_processor), :suppress_printer
|
112
|
+
@commands.insert ["quit"], :exit
|
113
|
+
@commands.insert ["exit"], :exit
|
114
|
+
@commands.insert ["help"], :help,no_args,no_help,@arg_processor.help, :suppress_printer
|
115
|
+
|
116
|
+
@commands.insert ["hisotry"], self.method(:do_history),no_args,no_help,no_verify,:suppress_printer
|
117
|
+
@commands.insert ["info"], self.method(:do_info),no_args,no_help,no_verify,:suppress_printer
|
118
|
+
@commands.insert ["load"], no_cmd,no_args,no_help,no_verify,:suppress_printer
|
119
|
+
@commands.insert ["login"], self.method(:do_login),nil,nil,@arg_processor.method(:login), :suppress_printer
|
120
|
+
@commands.insert ["load","config"], @env.method(:load_config),no_args,no_help,no_verify,:suppress_printer
|
121
|
+
@commands.insert ["set","debug"], self.method(:set_debug),no_args,no_help,no_verify,:suppress_printer
|
122
|
+
@commands.insert ["set","lines"], self.method(:set_lines),no_args,no_help,no_verify,:suppress_printer
|
123
|
+
@commands.insert ["set","pause"], self.method(:set_pause),no_args,no_help,no_verify,:suppress_printer
|
124
|
+
@commands.insert ["set","var"], self.method(:set_var), no_args, no_help, @arg_processor.method(:simple_processor),:suppress_printer
|
125
|
+
@commands.insert ["set","env"], self.method(:set_env), no_args, no_help, @arg_processor.method(:simple_processor), :suppress_printer
|
126
|
+
@commands.insert ["show","var"], self.method(:show_var), no_args, no_help, @arg_processor.method(:array_processor), :suppress_printer
|
127
|
+
@commands.insert ["show","env"], self.method(:show_env), no_args, no_help, @arg_processor.method(:array_processor), :suppress_printer
|
128
|
+
@commands.insert ["unset","var"], self.method(:unset_var), no_args, no_help, @arg_processor.method(:array_processor), :suppress_printer
|
129
|
+
|
132
130
|
|
133
131
|
if loggedin then
|
134
132
|
debug(5,"Inserting commands which require login")
|
135
133
|
# This command tree is for a valid login
|
136
|
-
@commands.insert "",
|
137
|
-
@commands.insert "",
|
138
|
-
|
139
|
-
@commands.insert "",
|
140
|
-
@commands.insert "",
|
141
|
-
@commands.insert "",
|
142
|
-
|
143
|
-
@commands.insert "add",
|
144
|
-
@commands.insert "add
|
145
|
-
@commands.insert "add",
|
146
|
-
@commands.insert "add
|
147
|
-
@commands.insert "add",
|
148
|
-
@commands.insert "add",
|
149
|
-
@commands.insert "add
|
150
|
-
@commands.insert "add",
|
151
|
-
|
152
|
-
@commands.insert "
|
153
|
-
@commands.insert "
|
154
|
-
@commands.insert "
|
155
|
-
|
156
|
-
@commands.insert "get",
|
157
|
-
@commands.insert "get", "host", @server.method(:gethost), no_args, no_help, @arg_processor.default_get
|
158
|
-
@commands.insert "get host", "group", @server.method(:gethostgroup), no_args, no_help, @arg_processor.default_get
|
159
|
-
@commands.insert "get host group", "id", @server.method(:gethostgroupid), no_args, no_help, @arg_processor.method(:get_group_id)
|
160
|
-
@commands.insert "get", "item", @server.method(:getitem),
|
134
|
+
@commands.insert ["get"], no_cmd, no_args, @cmd_help.method(:get)
|
135
|
+
@commands.insert ["import"], self.method(:do_import),no_args,no_help,no_verify
|
136
|
+
|
137
|
+
@commands.insert ["add","app"], @server.method(:addapp),no_args,no_help,no_verify
|
138
|
+
@commands.insert ["add","app","id"], @server.method(:getappid),no_args,no_help,no_verify
|
139
|
+
@commands.insert ["add","host"], @server.method(:addhost), no_args, @cmd_help.method(:add_host), @arg_processor.method(:add_host), :server => @server
|
140
|
+
@commands.insert ["add","host","group"], @server.method(:addhostgroup),no_args,no_help,no_verify
|
141
|
+
@commands.insert ["add","item"], @server.method(:additem), no_args, @cmd_help.method(:add_item), @arg_processor.method(:add_item)
|
142
|
+
@commands.insert ["add","link"], @server.method(:addlink),no_args,no_help,no_verify
|
143
|
+
@commands.insert ["add","link","trigger"], @server.method(:addlinktrigger),no_args,no_help,no_verify
|
144
|
+
@commands.insert ["add","sysmap"], @server.method(:addsysmap),no_args,no_help,no_verify
|
145
|
+
@commands.insert ["add","sysmap","element"], @server.method(:addelementtosysmap),no_args,no_help,no_verify
|
146
|
+
@commands.insert ["add","trigger"], @server.method(:addtrigger),no_args,no_help,no_verify
|
147
|
+
@commands.insert ["add","user"], @server.method(:adduser), no_args, @cmd_help.method(:add_user), @arg_processor.method(:add_user)
|
148
|
+
@commands.insert ["add","user","media"], @server.method(:addusermedia),no_args,@cmd_help.method(:add_user_media),no_verify
|
149
|
+
|
150
|
+
@commands.insert ["get","app"], @server.method(:getapp), no_args, no_help, @arg_processor.default_get
|
151
|
+
@commands.insert ["get","host"], @server.method(:gethost), no_args, no_help, @arg_processor.default_get
|
152
|
+
@commands.insert ["get","host","group"], @server.method(:gethostgroup), no_args, no_help, @arg_processor.default_get
|
153
|
+
@commands.insert ["get","host","group","id"], @server.method(:gethostgroupid), no_args, no_help, @arg_processor.method(:get_group_id)
|
154
|
+
@commands.insert ["get","item"], @server.method(:getitem),
|
161
155
|
['itemids','hostids','groupids', 'triggerids','applicationids','status','templated_items','editable','count','pattern','limit','order', 'show'],
|
162
156
|
@cmd_help.method(:get_item), @arg_processor.default_get
|
163
|
-
@commands.insert "get",
|
164
|
-
@commands.insert "get",
|
165
|
-
@commands.insert "get",
|
157
|
+
@commands.insert ["get","seid"], @server.method(:getseid), no_args, no_help, @arg_processor.default_get
|
158
|
+
@commands.insert ["get","trigger"], @server.method(:gettrigger), no_args, no_help, @arg_processor.default_get
|
159
|
+
@commands.insert ["get","user"], @server.method(:getuser),['show'], @cmd_help.method(:get_user), @arg_processor.method(:get_user)
|
166
160
|
|
167
|
-
@commands.insert "delete",
|
168
|
-
@commands.insert "delete",
|
169
|
-
@commands.insert "delete",
|
161
|
+
@commands.insert ["delete","user"], @server.method(:deleteuser), ['id'], @cmd_help.method(:delete_user), @arg_processor.method(:delete_user)
|
162
|
+
@commands.insert ["delete","host"], @server.method(:deletehost), no_args, @cmd_help.method(:delete_host), @arg_processor.method(:delete_host)
|
163
|
+
@commands.insert ["delete","item"], @server.method(:deleteitem), ['itemid'], @cmd_help.method(:delete_item), @arg_processor.default
|
170
164
|
|
171
|
-
@commands.insert "raw",
|
172
|
-
@commands.insert "raw",
|
165
|
+
@commands.insert ["raw","api"], @server.method(:raw_api), no_args, @cmd_help.method(:raw_api), @arg_processor.method(:raw_api)
|
166
|
+
@commands.insert ["raw","json"], @server.method(:raw_json), no_args, @cmd_help.method(:raw_json), @arg_processor.method(:raw_processor)
|
173
167
|
|
174
|
-
@commands.insert "update",
|
168
|
+
@commands.insert ["update","user"], @server.method(:updateuser), no_args, no_help, no_verify
|
175
169
|
else
|
176
170
|
debug(5,"Inserting commands which do not require login")
|
177
171
|
# This command tree is for no login
|
178
|
-
@commands.insert "",
|
179
|
-
@commands.insert "",
|
180
|
-
@commands.insert "",
|
181
|
-
@commands.insert "",
|
182
|
-
@commands.insert "",
|
183
|
-
|
184
|
-
@commands.insert "add",
|
185
|
-
@commands.insert "add
|
186
|
-
@commands.insert "add",
|
187
|
-
@commands.insert "add
|
188
|
-
@commands.insert "add",
|
189
|
-
@commands.insert "add",
|
190
|
-
|
191
|
-
@commands.insert "
|
192
|
-
@commands.insert "
|
193
|
-
@commands.insert "
|
194
|
-
@commands.insert "
|
195
|
-
@commands.insert "
|
196
|
-
|
197
|
-
@commands.insert "get",
|
198
|
-
@commands.insert "get",
|
199
|
-
|
200
|
-
@commands.insert "
|
201
|
-
@commands.insert "
|
202
|
-
|
203
|
-
@commands.insert "
|
204
|
-
@commands.insert "get", "user", login_required,no_args, @cmd_help.method(:get_user)
|
205
|
-
|
206
|
-
@commands.insert "delete", "user", login_required, no_args, @cmd_help.method(:delete_user)
|
207
|
-
@commands.insert "delete", "host", login_required, no_args, @cmd_help.method(:delete_host)
|
208
|
-
|
209
|
-
@commands.insert "update", "user", login_required, no_args, no_help
|
172
|
+
@commands.insert ["add","app"], login_required,no_args,no_help
|
173
|
+
@commands.insert ["add","app","id"], login_required,no_args,no_help
|
174
|
+
@commands.insert ["add","host"], login_required, no_args, @cmd_help.method(:add_host)
|
175
|
+
@commands.insert ["add","host","group"], login_required,no_args,no_help
|
176
|
+
@commands.insert ["add","item"], login_required, no_args, no_help
|
177
|
+
@commands.insert ["add","link"], login_required,no_args,no_help
|
178
|
+
@commands.insert ["add","link","trigger"], login_required,no_args,no_help
|
179
|
+
@commands.insert ["add","sysmap"], login_required,no_args,no_help
|
180
|
+
@commands.insert ["add","sysmap","element"], login_required,no_args,no_help
|
181
|
+
@commands.insert ["add","trigger"], login_required,no_args,no_help
|
182
|
+
@commands.insert ["add","user"], login_required, no_args, @cmd_help.method(:add_user)
|
183
|
+
@commands.insert ["add","user","media"], login_required,no_args,no_help
|
184
|
+
|
185
|
+
@commands.insert ["get","app"], login_required, no_args, no_help
|
186
|
+
@commands.insert ["get","host"], login_required, no_args, no_help
|
187
|
+
@commands.insert ["get","host","group"], login_required, no_args, no_help
|
188
|
+
@commands.insert ["get","host","group","id"], login_required, no_args, no_help
|
189
|
+
@commands.insert ["get","item"], login_required, no_args, no_help
|
190
|
+
@commands.insert ["get","seid"], login_required, no_args, no_help
|
191
|
+
@commands.insert ["get","trigger"], login_required, no_args, no_help
|
192
|
+
@commands.insert ["get","user"], login_required,no_args, @cmd_help.method(:get_user)
|
193
|
+
|
194
|
+
@commands.insert ["delete","user"], login_required, no_args, @cmd_help.method(:delete_user)
|
195
|
+
@commands.insert ["delete","host"], login_required, no_args, @cmd_help.method(:delete_host)
|
196
|
+
|
197
|
+
@commands.insert ["update","user"], login_required, no_args, no_help
|
210
198
|
end
|
211
199
|
end
|
212
200
|
|
data/libs/zabcon_globals.rb
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
|
19
19
|
##########################################
|
20
20
|
# Subversion information
|
21
|
-
# $Id:
|
22
|
-
# $Revision:
|
21
|
+
# $Id: zabcon_globals.rb 264 2010-12-30 07:21:01Z nelsonab $
|
22
|
+
# $Revision: 264 $
|
23
23
|
##########################################
|
24
24
|
|
25
25
|
#------------------------------------------------------------------------------
|
data/zabcon.rb
CHANGED
@@ -20,8 +20,8 @@
|
|
20
20
|
|
21
21
|
##########################################
|
22
22
|
# Subversion information
|
23
|
-
# $Id: zabcon.rb
|
24
|
-
# $Revision:
|
23
|
+
# $Id: zabcon.rb 264 2010-12-30 07:21:01Z nelsonab $
|
24
|
+
# $Revision: 264 $
|
25
25
|
##########################################
|
26
26
|
|
27
27
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- A. Nelson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: .
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-06 00:00:00 -05:00
|
19
19
|
default_executable: zabcon
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|