summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Aksola <anton.aksola@nebula.fi>2014-04-07 14:52:07 +0300
committerAnton Aksola <anton.aksola@nebula.fi>2014-04-07 14:52:07 +0300
commit25b41e264bf7993245fd468af464f95eabbff4d9 (patch)
treeef0fb9a66e049e1c0b2a2a53b94411766c2ae565
parent381b09dcd67af66e2f257cdc80dea84ce9582252 (diff)
add support for non-vdom-enabled environments
-rw-r--r--lib/oxidized/model/fortios.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb
index 5e865be..4a46877 100644
--- a/lib/oxidized/model/fortios.rb
+++ b/lib/oxidized/model/fortios.rb
@@ -10,22 +10,27 @@ class FortiOS < Oxidized::Model
end
cmd 'get system status' do |cfg|
+ @vdom_enabled = cfg.include? 'Virtual domain configuration: enable'
comment cfg
end
- cmd 'config global'
+ post do
+ cfg = []
+ cfg << cmd('config global') if @vdom_enabled
- cmd 'get hardware status' do |cfg|
- comment cfg
- end
+ cfg << cmd('get hardware status') do |cfg|
+ comment cfg
+ end
- cmd 'diagnose autoupdate version' do |cfg|
- comment cfg
- end
+ cfg << cmd('diagnose autoupdate version') do |cfg|
+ comment cfg
+ end
- cmd 'end'
+ cfg << cmd('end') if @vdom_enabled
- cmd 'show'
+ cfg << cmd('show')
+ cfg.join "\n"
+ end
cfg :telnet do
username /^Username:/