summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/model/routeros.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb
index 31650c7..f391fb9 100644
--- a/lib/oxidized/model/routeros.rb
+++ b/lib/oxidized/model/routeros.rb
@@ -14,11 +14,14 @@ class RouterOS < Oxidized::Model
comment cfg
end
- cmd '/export' do |cfg|
- cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
- cfg.gsub! /\\\r\n\s+/, '' # strip new line
- cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
- cfg.join("\n") + "\n"
+ post do
+ run_cmd = vars(:remove_secret) ? '/export hide-sensitive' : '/export'
+ cmd run_cmd do |cfg|
+ cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
+ cfg.gsub! /\\\r\n\s+/, '' # strip new line
+ cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
+ cfg.join("\n") + "\n"
+ end
end
cfg :telnet do