summaryrefslogtreecommitdiff
path: root/lib/oxidized/model
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r--lib/oxidized/model/aireos.rb1
-rw-r--r--lib/oxidized/model/aosw.rb2
-rw-r--r--lib/oxidized/model/gcombnps.rb2
-rw-r--r--lib/oxidized/model/model.rb3
-rw-r--r--lib/oxidized/model/openwrt.rb1
-rw-r--r--lib/oxidized/model/xos.rb1
6 files changed, 10 insertions, 0 deletions
diff --git a/lib/oxidized/model/aireos.rb b/lib/oxidized/model/aireos.rb
index 84bbb3f..e8e1f30 100644
--- a/lib/oxidized/model/aireos.rb
+++ b/lib/oxidized/model/aireos.rb
@@ -44,6 +44,7 @@ class Aireos < Oxidized::Model
cfg.each_line do |line|
next if line.match /^\s*$/
next if line.match /rogue (adhoc|client) (alert|Unknown) [\da-f]{2}:/
+
line = line[1..-1] if line[0] == "\r"
out << line.strip
end
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb
index fae0eff..65559b3 100644
--- a/lib/oxidized/model/aosw.rb
+++ b/lib/oxidized/model/aosw.rb
@@ -63,6 +63,7 @@ class AOSW < Oxidized::Model
cfg.each_line do |line|
next if line.match /^controller config \d+$/
next if line.match /^Building Configuration/
+
out << line.strip
end
out = out.join "\n"
@@ -106,6 +107,7 @@ class AOSW < Oxidized::Model
next if line.match /(Tachometers|Temperatures|Voltages)/
next if line.match /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/
next if line.match /[0-9]+\s+(RPMS?|m?V|C)/i
+
out << line.strip
end
out = comment out.join "\n"
diff --git a/lib/oxidized/model/gcombnps.rb b/lib/oxidized/model/gcombnps.rb
index 0aa4a11..21929e3 100644
--- a/lib/oxidized/model/gcombnps.rb
+++ b/lib/oxidized/model/gcombnps.rb
@@ -42,6 +42,7 @@ class GcomBNPS < Oxidized::Model
next if line.match /^ Bias Current\(mA\)/
next if line.match /^ RX Power\(dBM\)/
next if line.match /^ TX Power\(dBM\)/
+
out << line
end
@@ -57,6 +58,7 @@ class GcomBNPS < Oxidized::Model
cfg.each_line do |line|
next if line.match /^system run time :/
next if line.match /^switch temperature :/
+
out << line
end
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index 761e19e..8bded03 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -17,6 +17,7 @@ module Oxidized
def comment _comment = '# '
return @comment if @comment
+
@comment = block_given? ? yield : _comment
end
@@ -102,6 +103,7 @@ module Oxidized
Oxidized.logger.debug "lib/oxidized/model/model.rb Executing #{string}"
out = @input.cmd(string)
return false unless out
+
out = out.b unless Oxidized.config.input.utf8_encoded?
self.class.cmds[:all].each do |all_block|
out = instance_exec Oxidized::String.new(out), string, &all_block
@@ -155,6 +157,7 @@ module Oxidized
self.class.cmds[:cmd].each do |command, block|
out = cmd command, &block
return false unless out
+
outputs << out
end
procs[:pre].each do |pre_proc|
diff --git a/lib/oxidized/model/openwrt.rb b/lib/oxidized/model/openwrt.rb
index 7ba9e98..ce7cf76 100644
--- a/lib/oxidized/model/openwrt.rb
+++ b/lib/oxidized/model/openwrt.rb
@@ -62,6 +62,7 @@ class OpenWrt < Oxidized::Model
end
@mtdpartitions.scan(/(\w+):\s+\w+\s+\w+\s+"(.*)"/).each do |partition, name|
next unless vars(:openwrt_backup_partitions) && partitions_to_backup.include?(name)
+
Oxidized.logger.debug "Exporting partition - #{name}(#{partition})"
cfg << comment("#### Partition: #{name} /dev/#{partition} #####")
cfg << comment("Decode using 'echo -en <data> | gzip -dc > #{name}'")
diff --git a/lib/oxidized/model/xos.rb b/lib/oxidized/model/xos.rb
index a589d0b..e1ae37b 100644
--- a/lib/oxidized/model/xos.rb
+++ b/lib/oxidized/model/xos.rb
@@ -45,6 +45,7 @@ class XOS < Oxidized::Model
data = cmd 'disable clipaging session'
match = data.match /^disable clipaging session\n\*?[\w .-]+(:\d+)? # $/m
next if match
+
cmd 'disable clipaging'
end