mod/ssh-keys-import: use $RmDir

This commit is contained in:
Christian Hesse 2025-02-07 16:12:51 +01:00
parent 6570a84904
commit 0fea300fea

View file

@ -19,6 +19,7 @@
:global GetRandom20CharAlNum;
:global LogPrint;
:global MkDir;
:global RmDir;
:global WaitForFile;
:if ([ :len $Key ] = 0 || [ :len $User ] = 0) do={
@ -58,10 +59,10 @@
/user/ssh-keys/import public-key-file=$FileName user=$User;
$LogPrint info $0 ("Imported ssh public key (" . $KeyVal->2 . ", " . $KeyVal->0 . ", " . \
"MD5:" . $FingerPrintMD5 . ") for user '" . $User . "'.");
/file/remove "tmpfs/ssh-keys-import";
$RmDir "tmpfs/ssh-keys-import";
} on-error={
$LogPrint warning $0 ("Failed importing key.");
/file/remove "tmpfs/ssh-keys-import";
$RmDir "tmpfs/ssh-keys-import";
:return false;
}
} on-error={