6.16 import stops when there is a duplicate entry

A duplicate entry in the import will cause RouterOS to stop and not process further down the list (v6.16)

ie (dshield.rsc below)
/ip firewall address-list
add list=DShield address=122.226.73.131/32 timeout=2h
add list=DShield address=85.13.160.11/32 timeout=2h
add list=DShield address=50.23.113.146/32 timeout=2h
add list=DShield address=50.23.113.146/32 timeout=2h
add list=DShield address=122.225.109.212/32 timeout=2h
add list=DShield address=176.31.251.200/32 timeout=2h
add list=DShield address=218.2.0.137/32 timeout=2h
add list=DShield address=122.226.73.131/32 timeout=2h

It will import 50.23.113.146 and stop processing the import. Bug in RouterOS?
Using /import file-name=dshield.rsc; to import list

You cannot add the same entry twice, console throws an error and quits.

How can we not quite the ‘script’? Linux doesn’t quit a script. Windows doesn’t quite a CMD/BAT file. They both continue to execute the commands. The duplicate entry isn’t an error it should just be an informational warning that the entry already exists so RouterOS should be continue execution of the script.

It IS an error

[admin@MikroTik] /ip firewall address-list> add list=test address=1.1.1.1
[admin@MikroTik] /ip firewall address-list> add list=test address=1.1.1.1
failure: already have such entry

We should have the ability to import with continue on failure toggle. And adding a duplicate ‘address list’ entry should be a warning not an error

Strongly agree

this is just silly

such a time waster to have to edit all duplicate interface names out of a config file to do a clone backup

also strongly agree , at least it will be nice to know which is the duplicate item.

edit: could do that with verbose=yes

Thank you!
Was also thinking the same - add an option (or make it default) to continue executing/importing the config after an error.

If you pay attention to what line of the config it stopped on, you can continue the import with “import from-line=”, just increment the line number that it stopped on by 1.

But something like “continue import on error” would be a nice feature. +1

+1
this option will be helpful when importing large blacklist from different sources and urgently need it

I have yet to see a way to get the error message from an imported script returned to the script doing the import. And simply skipping the one line that failed wouldn’t be a good idea, if you have { } cases in the imported script and it fail inside one, you wouldn’t want it to attempt to start in the middle of it.

Something along the lines of an option that makes the import function simulate the behavior of copy-pasting into the CLI.
Possibly dump the whole CLI output (and input) into a specified text file.

+100
this option will be very helpful when importing large blacklist from different sources and urgently need it

bump

+1

My recommendation is to build a script that clears all the items you don’t need prior to running then adds everything it requires back.

IE: Clear all IP addresses at the start then just add the ones you need.

Something like this can be achieved by using a non-interactive initiation of the script (running as an .auto.rsc)
OR
“system reset, on reset run .. ”
OR
:global cmdfinish
:execute {command that will potentially fail goes here; :set cmdfinish “true”;}
loop around a bit waiting for a “true” value otherwise log that the command failed and continue on..

This is a very simple overview so if there’s more interest I can supply some better explanations and examples.

Could you prepare the script that way

do { /ip firewall address-list add address=111.251.111.129 list=blackmail timeout=3h } on-error={}

instead of

/ip firewall address-list add address=111.251.111.129 list=blackmail timeout=3h

I have no 6.16 so it is only my guess that such solution works.

works like a charm, as a side effect log is not spammed by address list entry messages :slight_smile:
Thank you very much!