lib/oxidized/model/powerconnect.rb in oxidized-0.21.0 vs lib/oxidized/model/powerconnect.rb in oxidized-0.22.0
- old
+ new
@@ -1,30 +1,29 @@
class PowerConnect < Oxidized::Model
-
prompt /^([\w\s.@-]+[#>]\s?)$/ # allow spaces in hostname..dell does not limit it.. #
- comment '! '
+ comment '! '
expect /^\s*--More--\s+.*$/ do |data, re|
- send ' '
- data.sub re, ''
+ send ' '
+ data.sub re, ''
end
cmd :all do |cfg|
cfg.each_line.to_a[1..-3].join
end
cmd :secret do |cfg|
- cfg.gsub! /^username (\S+) password \S+ (.*)/, 'username \1 password <hidden> \2'
+ cfg.gsub! /^(username \S+ password (?:encrypted )?)\S+(.*)/, '\1<hidden>\2'
cfg
end
cmd 'show version' do |cfg|
if (@stackable.nil?)
@stackable = true if cfg.match /(U|u)nit\s/
end
- cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
+ cfg = cfg.split("\n").reject { |line| line[/Up\sTime/] }
comment cfg.join("\n") + "\n"
end
cmd 'show system' do |cfg|
@model = $1 if cfg.match /Power[C|c]onnect (\d{4})[P|F]?/
@@ -50,11 +49,10 @@
post_login "terminal datadump"
post_login "terminal length 0"
pre_logout "logout"
pre_logout "exit"
-
end
def clean cfg
out = []
skip_blocks = 0
@@ -70,11 +68,10 @@
skip_blocks -= 1 if /\S/ !~ line
next
end
out << line.strip
end
- out = out.select { |line| not line[/Up\sTime/] }
+ out = out.reject { |line| line[/Up\sTime/] }
out = comment out.join "\n"
out << "\n"
end
-
end