Sha256: a487650c50edc6a8f471bc76069a13fb25c4fd2f7329d372628f0bd32e199dd6
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
class RouterOS < Oxidized::Model prompt /\[\w+@\S+(\s+\S+)*\]\s?>\s?$/ comment "# " cmd :all do |cfg| cfg.gsub! /\x1B\[([0-9]{1,3}(;[0-9]{1,3})*)?[m|K]/, '' # strip ANSI colours if screenscrape cfg = cfg.cut_both cfg.gsub! /^\r+(.+)/, '\1' cfg.gsub! /([^\r]*)\r+$/, '\1' end cfg end cmd '/system routerboard print' do |cfg| comment cfg end cmd '/system package update print' do |cfg| comment cfg end cmd '/system history print' do |cfg| comment cfg end post do run_cmd = vars(:remove_secret) ? '/export hide-sensitive' : '/export' cmd run_cmd do |cfg| cfg.gsub! /\\\r?\n\s+/, '' # strip new line cfg.gsub! /# inactive time\r\n/, '' # Remove time based system comment cfg.gsub! /# received packet from \S+ bad format\r\n/, '' # Remove intermittent VRRP/CARP collision comment cfg = cfg.split("\n").reject { |line| line[/^#\s\w{3}\/\d{2}\/\d{4}.*$/] } cfg.join("\n") + "\n" end end cfg :telnet do username /^Login:/ password /^Password:/ end cfg :telnet, :ssh do pre_logout 'quit' end cfg :ssh do exec true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.27.0 | lib/oxidized/model/routeros.rb |