Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RouterOS V7 new time based system comment #3103

Closed
AndriyChernov opened this issue Mar 11, 2024 · 1 comment
Closed

RouterOS V7 new time based system comment #3103

AndriyChernov opened this issue Mar 11, 2024 · 1 comment

Comments

@AndriyChernov
Copy link

AndriyChernov commented Mar 11, 2024

In RouterOS v7 there is a new time based system comment.

When exporting the configuration, an additional line is automatically added.

/export

# 2024-03-11 19:15:14 by RouterOS 7.14.1

I had to edit the routeros.rb file to avoid unnecessary configuration loading.

    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.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.gsub! /# (....-..-..) (..:..:..) |by RouterOS|/, '' # # Remove date and time of export
      cfg = cfg.split("\n").reject { |line| line[/^#\s\w{3}\/\d{2}\/\d{4}.*$/] }
      cfg.join("\n") + "\n"
    end

After adding the line “cfg.gsub! /# (....-..-..) (..:..:..) |by RouterOS|/, '' # Remove date and time of export” the configuration is no longer loaded unnecessarily.

@AndriyChernov
Copy link
Author

Found issue in routeros.rb

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant