From 25b41e264bf7993245fd468af464f95eabbff4d9 Mon Sep 17 00:00:00 2001 From: Anton Aksola Date: Mon, 7 Apr 2014 14:52:07 +0300 Subject: add support for non-vdom-enabled environments --- lib/oxidized/model/fortios.rb | 23 ++++++++++++++--------- 1 file 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:/ -- cgit v1.2.1