aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-07 16:35:45 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-07 16:36:54 -0700
commitd8cf69998f80292f51ac02e7fa98e442224690d3 (patch)
tree5cf259727694c2440d2f6b5654857a929b41ffdf
parentf9ea4b884158e5734990e963f63a68c33b63057e (diff)
downloadconsfigurator-d8cf69998f80292f51ac02e7fa98e442224690d3.tar.gz
add FILE:DIRECTORY-DOES-NOT-EXIST, FILE:DATA-CACHE-PURGED
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/package.lisp3
-rw-r--r--src/property/disk.lisp1
-rw-r--r--src/property/file.lisp17
3 files changed, 21 insertions, 0 deletions
diff --git a/src/package.lisp b/src/package.lisp
index 677868f..4af1b15 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -250,6 +250,7 @@
#:get-remote-cached-prerequisite-data
#:get-local-cached-prerequisite-data
#:get-highest-local-cached-prerequisite-data
+ #:get-remote-data-cache-dir
#:try-register-data-source
#:register-data-source
@@ -281,10 +282,12 @@
#:lacks-lines
#:has-mode
#:does-not-exist
+ #:directory-does-not-exist
#:data-uploaded
#:host-data-uploaded
#:secret-uploaded
#:host-secret-uploaded
+ #:data-cache-purged
#:contains-conf-equals
#:contains-conf-space
#:contains-conf-tab
diff --git a/src/property/disk.lisp b/src/property/disk.lisp
index bcbe89f..a97392c 100644
--- a/src/property/disk.lisp
+++ b/src/property/disk.lisp
@@ -823,6 +823,7 @@ the LVM physical volumes corresponding to those volume groups."
(defproplist caches-cleaned :posix ()
"Clean all caches we know how to clean in preparation for image creation."
(:desc "Caches cleaned")
+ (file:data-cache-purged)
(os:typecase
(debianlike (apt:cache-cleaned))))
diff --git a/src/property/file.lisp b/src/property/file.lisp
index 70d2679..4ee33e6 100644
--- a/src/property/file.lisp
+++ b/src/property/file.lisp
@@ -76,6 +76,18 @@ CONTENT can be a list of lines or a single string."
(:check (not (apply #'remote-exists-p paths)))
(:apply (mrun "rm" "-f" paths)))
+(defprop directory-does-not-exist :posix (&rest directories)
+ "Recursively ensure that DIRECTORIES do not exist."
+ (:desc (if (cdr directories)
+ #?"@{directories} do not exist"
+ #?"${(car directories)} does not exist"))
+ (:check (not (apply #'remote-exists-p directories)))
+ (:apply
+ (if (test (format nil "~{( -e ~A -a ! -d ~:*~A )~^ -o ~}" directories))
+ (failed-change "At least one of ~S exists and is not a directory."
+ directories)
+ (apply #'delete-remote-trees directories))))
+
(defprop data-uploaded :posix (iden1 iden2 destination)
(:hostattrs
(declare (ignore destination))
@@ -105,6 +117,11 @@ CONTENT can be a list of lines or a single string."
(:apply
(secret-uploaded (get-hostname) destination destination)))
+(defproplist data-cache-purged :posix ()
+ "Ensure that any prerequisite data cached in the remote home directory is removed."
+ (:desc "Consfigurator data cache cleaned")
+ (directory-does-not-exist (get-remote-data-cache-dir)))
+
(defprop regex-replaced-lines :posix (file regex replace)
"Like s/REGEX/REPLACE/ on the lines of FILE.
Uses CL-PPCRE:REGEX-REPLACE, which see for the syntax of REPLACE."