diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-23 13:48:50 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-23 13:50:14 -0700 |
commit | 17eb0140ee7e6bcef366a5601b8dd2db26dbb525 (patch) | |
tree | 37f08f36bba7d7c4a60bb3089f46f19fd408216e | |
parent | ce9a0b1c26140c2581d6706c3434f1b70820aecd (diff) | |
download | consfigurator-17eb0140ee7e6bcef366a5601b8dd2db26dbb525.tar.gz |
error if pass relative paths to FILE:HOST-{DATA,SECRET}-UPLOADED
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | doc/data.rst | 2 | ||||
-rw-r--r-- | src/property/file.lisp | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/doc/data.rst b/doc/data.rst index b0dd590..481ff94 100644 --- a/doc/data.rst +++ b/doc/data.rst @@ -22,7 +22,7 @@ other purposes. - ``(HOSTNAME . PATH)`` means the data that should be uploaded to ``PATH`` on ``HOSTNAME`` (and usually nowhere else, except in the case of, e.g., a - public key) + public key). ``PATH`` must be absolute, not relative. - ``("--lisp-system" . SYSTEM)`` means the data is Lisp code which, when loaded, defines the packages and symbols contained in the ASDF system diff --git a/src/property/file.lisp b/src/property/file.lisp index 01afea4..e201c94 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -128,7 +128,12 @@ replacing the contents of existing files, prefer FILE:HAS-CONTENT." (containing-directory-exists destination) (maybe-writefile-data destination iden1 iden2))) -(defprop host-data-uploaded :posix (destination) +(defprop host-data-uploaded :posix + (destination + ;; Require an absolute path because we don't know the remote home + ;; directory at hostattrs time, so can't resolve it ourselves. + &aux (destination (unix-namestring + (ensure-pathname destination :want-absolute t)))) (:hostattrs (require-data (get-hostname) destination)) (:apply @@ -143,7 +148,10 @@ replacing the contents of existing files, prefer FILE:HAS-CONTENT." (maybe-writefile-data destination iden1 iden2 :mode #o600))) (defproplist host-secret-uploaded :posix - (destination &aux (destination (unix-namestring destination))) + (destination + ;; Require an absolute path like with HOST-DATA-UPLOADED. + &aux (destination (unix-namestring + (ensure-pathname destination :want-absolute t)))) (secret-uploaded (get-hostname) destination destination)) (defproplist data-cache-purged :posix () |