aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/notification-email.rsc6
-rw-r--r--mod/ssh-keys-import.rsc4
2 files changed, 6 insertions, 4 deletions
diff --git a/mod/notification-email.rsc b/mod/notification-email.rsc
index 5293766..ad9762a 100644
--- a/mod/notification-email.rsc
+++ b/mod/notification-email.rsc
@@ -40,9 +40,11 @@
:global EitherOr;
:global EMailGenerateFrom;
+ :global FileExists;
:global IsDNSResolving;
:global IsTimeSync;
:global LogPrint;
+ :global RmFile;
:local AllDone true;
:local QueueLen [ :len $EmailQueue ];
@@ -93,7 +95,7 @@
:onerror Err {
:local Attach ({});
:foreach File in=[ :toarray [ $EitherOr ($Message->"attach") "" ] ] do={
- :if ([ :len [ /file/find where name=$File ] ] = 1) do={
+ :if ([ $FileExists $File ] = true) do={
:set Attach ($Attach, $File);
} else={
$LogPrint warning $0 ("File '" . $File . "' does not exist, can not attach.");
@@ -110,7 +112,7 @@
:set Wait false;
:if (($Message->"remove-attach") = true) do={
:foreach File in=$Attach do={
- /file/remove $File;
+ $RmFile $File;
}
}
}
diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc
index 9467525..7bdc95d 100644
--- a/mod/ssh-keys-import.rsc
+++ b/mod/ssh-keys-import.rsc
@@ -75,6 +75,7 @@
:local User [ :tostr $2 ];
:global EitherOr;
+ :global FileExists;
:global LogPrint;
:global ParseKeyValueStore;
:global SSHKeysImport;
@@ -84,8 +85,7 @@
:return false;
}
- :local File [ /file/find where name=$FileName ];
- :if ([ :len $File ] = 0) do={
+ :if ([ $FileExists $FileName ] = true) do={
$LogPrint warning $0 ("File '" . $FileName . "' does not exist.");
:return false;
}