mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-21 01:15:42 +02:00
mod/ssh-keys-import: $SSHKeysImportFile: simplify looping lines
This commit is contained in:
parent
084c246ef0
commit
9c945b1a32
1 changed files with 4 additions and 5 deletions
|
@ -88,12 +88,11 @@
|
|||
$LogPrint warning $0 ("File '" . $FileName . "' does not exist.");
|
||||
:return false;
|
||||
}
|
||||
:local Keys ([ /file/get $FileName contents ] . "\n");
|
||||
:local Keys [ :tolf [ /file/get $FileName contents ] ];
|
||||
|
||||
:do {
|
||||
:foreach Line in=[ :deserialize $Keys delimiter="\n" from=dsv options=dsv.plain ] do={
|
||||
:set Line ($Line->0);
|
||||
:local Continue false;
|
||||
:local Line [ :pick $Keys 0 [ :find $Keys "\n" ] ];
|
||||
:set Keys [ :pick $Keys ([ :find $Keys "\n" ] + 1) [ :len $Keys ] ];
|
||||
:local KeyVal [ :toarray [ $CharacterReplace $Line " " "," ] ];
|
||||
:if ($KeyVal->0 = "ssh-ed25519" || $KeyVal->0 = "ssh-rsa") do={
|
||||
:do {
|
||||
|
@ -110,5 +109,5 @@
|
|||
:if ($Continue = false && [ :len ($KeyVal->0) ] > 0) do={
|
||||
$LogPrint warning $0 ("SSH key of type '" . $KeyVal->0 . "' is not supported.");
|
||||
}
|
||||
} while=([ :len $Keys ] > 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue