blob: cd379b7b51ec5fe2cd92ee039809c54a369eb7d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
class FortiOS < Oxidized::Model
comment '# '
prompt /^([-\w\.\~]+(\s[\(\w\-\.\)]+)?\~?\s?[#>$]\s?)$/
expect /^--More--\s$/ do |data, re|
send ' '
data.sub re, ''
end
cmd :all do |cfg, cmdstring|
new_cfg = comment "COMMAND: #{cmdstring}\n"
new_cfg << cfg.each_line.to_a[1..-2].map { |line| line.gsub(/(conf_file_ver=)(.*)/, '\1<stripped>\3') }.join
end
cmd 'get system status' do |cfg|
@vdom_enabled = cfg.include? 'Virtual domain configuration: enable'
cfg.gsub!(/(System time: )(.*)/, '\1<stripped>\3')
comment cfg
end
post do
cfg = []
cfg << cmd('config global') if @vdom_enabled
cfg << cmd('get hardware status') do |cfg|
comment cfg
end
cfg << cmd('diagnose autoupdate version') do |cfg|
comment cfg
end
cfg << cmd('end') if @vdom_enabled
cfg << cmd('show')
cfg.join "\n"
end
cfg :telnet do
username /login:/
password /^Password:/
end
cfg :telnet, :ssh do
pre_logout "exit\n"
end
end
|