diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-14 16:32:29 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-14 16:32:29 -0700 |
commit | 31d7bcfce6eae388ed97691d1cba5b1e663c8488 (patch) | |
tree | a0e4cc4510c253f840be09ce625602f66bd38316 | |
parent | 9535e5c0ea36da775a4c3b998fab77c5564abbb3 (diff) | |
download | consfigurator-31d7bcfce6eae388ed97691d1cba5b1e663c8488.tar.gz |
FILE:DATA-UPLOADED, FILE:SECRET-UPLOADED: ensure directory exists
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | src/property/file.lisp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/property/file.lisp b/src/property/file.lisp index 9575499..ff2aa3f 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -87,8 +87,10 @@ CONTENT can be a list of lines or a single string." (declare (ignore destination)) (require-data iden1 iden2)) (:apply - (with-change-if-changes-file-content (destination) - (writefile destination (get-data-stream iden1 iden2))))) + (let ((destination (ensure-pathname destination :namestring :unix))) + (directory-exists (pathname-directory-pathname destination)) + (with-change-if-changes-file-content (destination) + (writefile destination (get-data-stream iden1 iden2)))))) (defprop host-data-uploaded :posix (destination) (:hostattrs @@ -101,8 +103,10 @@ CONTENT can be a list of lines or a single string." (declare (ignore destination)) (require-data iden1 iden2)) (:apply - (with-change-if-changes-file-content (destination) - (writefile destination (get-data-stream iden1 iden2) :mode #o600)))) + (let ((destination (ensure-pathname destination :namestring :unix))) + (directory-exists (pathname-directory-pathname destination)) + (with-change-if-changes-file-content (destination) + (writefile destination (get-data-stream iden1 iden2) :mode #o600))))) (defprop host-secret-uploaded :posix (destination) (:hostattrs |