Class: PowerConnect

Inherits:
Oxidized::Model show all
Defined in:
lib/oxidized/model/powerconnect.rb

Instance Attribute Summary

Attributes inherited from Oxidized::Model

#input, #node

Instance Method Summary collapse

Methods inherited from Oxidized::Model

cfg, #cfg, cfgs, #cmd, cmd, cmds, comment, #comment, expect, #expect, expects, #expects, #get, inherited, #output, post, pre, procs, prompt, #prompt, #send

Methods included from Oxidized::Config::Vars

#vars

Instance Method Details

#clean(cfg) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/oxidized/model/powerconnect.rb', line 48

def clean cfg
  out = []
  skip_block = false
  cfg.each_line do |line|
    if line.match /Up\sTime|Temperature|Power Supplies/i
      # For 34xx, 54xx, 55xx, and 8024F we should skip this block (terminated by a blank line)
      skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^8024$/
    end
    # If we have lines to skip do this until we reach and empty line
    if skip_block
      skip_block = false if /\S/ !~ line
      next
    end
    out << line.strip
  end
  out = comment out.join "\n"
  out << "\n"
end