Skip to content

Commit

Permalink
Remove "<timestamp> by RouterOS" comment lines from ROS v7
Browse files Browse the repository at this point in the history
Fixes #3021

Signed-off-by: Brian Candler <[email protected]>
  • Loading branch information
candlerb committed Jan 23, 2024
1 parent 62ec6d3 commit bfee011
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/oxidized/model/routeros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class RouterOS < Oxidized::Model
cfg.gsub! "# poe-out status: short_circuit\r\n", '' # Remove intermittent POE short_circuit comment
cfg.gsub! "# Firmware upgraded successfully, please reboot for changes to take effect!\r\n", '' # Remove transient firmware upgrade comment
cfg.gsub! /# \S+ not ready\r\n/, '' # Remove intermittent $interface not ready comment
cfg = cfg.split("\n").reject { |line| line[/^#\s\w{3}\/\d{2}\/\d{4}\s\d{2}:\d{2}:\d{2}.*$/] || line[/^#\s\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.*$/] } # Remove date time and 'by RouterOS' comment
cfg = cfg.split("\n")
cfg.reject! { |line| line[/^#\s\w{3}\/\d{2}\/\d{4}.*$/] } # Remove date time and 'by RouterOS' comment (v6)
cfg.reject! { |line| line[/^#\s\d{4}\-\d{2}\-\d{2}.*$/] } # Remove date time and 'by RouterOS' comment (v7)

Check warning on line 50 in lib/oxidized/model/routeros.rb

View workflow job for this annotation

GitHub Actions / test (3.0)

[rubocop] reported by reviewdog 🐶 Redundant escape inside regexp literal Raw Output: lib/oxidized/model/routeros.rb:50:43: C: Style/RedundantRegexpEscape: Redundant escape inside regexp literal

Check warning on line 50 in lib/oxidized/model/routeros.rb

View workflow job for this annotation

GitHub Actions / test (3.0)

[rubocop] reported by reviewdog 🐶 Redundant escape inside regexp literal Raw Output: lib/oxidized/model/routeros.rb:50:50: C: Style/RedundantRegexpEscape: Redundant escape inside regexp literal

Check warning on line 50 in lib/oxidized/model/routeros.rb

View workflow job for this annotation

GitHub Actions / test (3.1)

[rubocop] reported by reviewdog 🐶 Redundant escape inside regexp literal Raw Output: lib/oxidized/model/routeros.rb:50:43: C: Style/RedundantRegexpEscape: Redundant escape inside regexp literal

Check warning on line 50 in lib/oxidized/model/routeros.rb

View workflow job for this annotation

GitHub Actions / test (3.1)

[rubocop] reported by reviewdog 🐶 Redundant escape inside regexp literal Raw Output: lib/oxidized/model/routeros.rb:50:50: C: Style/RedundantRegexpEscape: Redundant escape inside regexp literal

Check warning on line 50 in lib/oxidized/model/routeros.rb

View workflow job for this annotation

GitHub Actions / test (3.2)

[rubocop] reported by reviewdog 🐶 Redundant escape inside regexp literal Raw Output: lib/oxidized/model/routeros.rb:50:43: C: Style/RedundantRegexpEscape: Redundant escape inside regexp literal

Check warning on line 50 in lib/oxidized/model/routeros.rb

View workflow job for this annotation

GitHub Actions / test (3.2)

[rubocop] reported by reviewdog 🐶 Redundant escape inside regexp literal Raw Output: lib/oxidized/model/routeros.rb:50:50: C: Style/RedundantRegexpEscape: Redundant escape inside regexp literal
cfg.join("\n") + "\n"
end
end
Expand Down

0 comments on commit bfee011

Please sign in to comment.