-
Notifications
You must be signed in to change notification settings - Fork 45
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
Mikrotik 'export terse' Preferred #25
Comments
How about another device type?
|
@haussli Another device type will be necessary with RouterOS v7 actually, as in RouterOS v7 you need to export show-sensitive so that it doesn't hide the sensitive parts of the config. Unfortunately in RouterOS v6, running export show-sensitive will error out as it isn't a valid option. I just mention that here because if you did add export-terse in this way you might need four different device types - one for routeros6, one for routeros6-terse, one for routeros7 and one for routeros7-terse. |
Can one mix the options? such as: export terse show-sensitive |
I expect this would work for both v6 and v7 in one device type: |
Yes, export terse show-sensitive is possible of course. If your v6 and v7 in one device type tries export show-sensitive first and then runs export only if the export show-sensitive fails, yes it should work for both v6 and v7 in one device type. |
Yes. If someone could confirm for me that it works, i'll commit that and add the terse type. TiA |
@haussli we're running a mixed 6/7 environment so I tried the code in the routeros67 branch and it did not work for me. I ended up with 2 copies of the config for my 7.0 routers. In addition to adding a new device type, I just changed the module like so: --- /usr/share/perl5/vendor_perl/rancid/routeros.pm.org 2022-12-02 09:28:27.000000000 -0500
+++ /usr/share/perl5/vendor_perl/rancid/routeros.pm 2023-01-12 18:25:29.434461051 -0500
@@ -59,6 +59,8 @@
use rancid 3.13;
+our $Export;
+
@ISA = qw(Exporter rancid main);
#XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
@@ -207,9 +209,12 @@
if (/$prompt/) { $found_end=1; $clean_run=1; return 0};
next if(/^(\s*|\s*$cmd\s*)$/);
next if(/^#/);
+ return(1) if /(expected end of command )/;
return(1) if /(bad command name )/;
s/^\s+//g;
+ return(0) if ($routeros::Export);
+
# RouterOS splits long lines with backslashes - this re-joins them
if (/\\\n$/) {
s/\s*\\\n$//;
@@ -232,6 +237,7 @@
$buffer = "";
}
}
+ $routeros::Export = 1;
}
1; Happy to help troubleshoot further as we're trying to move config backups to rancid instead of scripted FTP dumps. (See also #53 – is the same problem possibly causing the code to bail out before setting the $Export variable?) |
In bin/mtrancid, line 279, the command 'export terse' produces output that makes for cleaner diffs.
'export' produces multi-line commands where as 'export terse' produces every complete command as a single line.
It would be great if 'export terse' could be the default.
The text was updated successfully, but these errors were encountered: