summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
authorNash Kaminski <Nash.Kaminski@gs.com>2018-05-01 11:57:16 -0500
committerNash Kaminski <Nash.Kaminski@gs.com>2018-05-07 13:50:44 -0500
commit42d7ca19b5615e0ef9e4f1290e6bfeebce760a01 (patch)
tree3ee90b72675fb97aedc6cc43231290390688a9e3 /lib/oxidized
parentb61a6aeef7baccd24f260f13b6618f14a8bd37ae (diff)
Convert NX-OS configs to have consistent line endings and comment them properly. Fix typo in launcher script.
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/model/nxos.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/oxidized/model/nxos.rb b/lib/oxidized/model/nxos.rb
index d1449dd..ec1f807 100644
--- a/lib/oxidized/model/nxos.rb
+++ b/lib/oxidized/model/nxos.rb
@@ -2,6 +2,11 @@ class NXOS < Oxidized::Model
prompt /^(\r?[\w.@_()-]+[#]\s?)$/
comment '! '
+ def filter cfg
+ cfg.gsub! /\r\n?/, "\n"
+ cfg.gsub! prompt, ''
+ end
+
cmd :secret do |cfg|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) (priv) (\S+)/, '\\1 <configuration removed> '
@@ -11,16 +16,21 @@ class NXOS < Oxidized::Model
end
cmd 'show version' do |cfg|
+ cfg = filter cfg
cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) }
comment cfg.join ""
end
cmd 'show inventory' do |cfg|
+ cfg = filter cfg
comment cfg
end
cmd 'show running-config' do |cfg|
+ cfg = filter cfg
+ cfg.gsub! /^(show run.*)$/, '! \1'
cfg.gsub! /^!Time:[^\n]*\n/, ''
+ cfg.gsub! /^[\w.@_()-]+[#].*$/, ''
cfg
end