diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-29 14:59:42 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-30 10:03:03 -0700 |
commit | dc396f800b11fc9aa4bae07df268ad51a2740d8b (patch) | |
tree | 47d292422b9b65e23ebda86732903a3fa5b1efc3 /src/property.lisp | |
parent | fb89c160bad4fff16e54812b60ddc74f3c957fef (diff) | |
download | consfigurator-dc396f800b11fc9aa4bae07df268ad51a2740d8b.tar.gz |
hostattrs accessors: call PREPROCESS-HOST in some situations
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property.lisp')
-rw-r--r-- | src/property.lisp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/property.lisp b/src/property.lisp index 2abb5e9..c3a6a5d 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -457,7 +457,19 @@ install an apt package but the host is FreeBSD.") "Retrieve the list of static informational attributes of type KEY. Called by property :HOSTATTRS, :APPLY and :UNAPPLY subroutines." - (getf (slot-value host 'hostattrs) k)) + ;; Ensure the host is preprocessed so the desired hostattrs are actually + ;; there, assuming we're not already preprocessing it. Avoid calling + ;; PREPROCESS-HOST on PREPROCESSED-HOST values to avoid pointless copying. + ;; + ;; This is just to improve readability for some property definitions and + ;; avoid confusing situations where hostattrs appear to be missing (for + ;; example, if the hostname is not set until HOSTNAME:IS); properties which + ;; will look up multiple hostattrs by supplying a value for HOST should call + ;; PREPROCESS-HOST on that value themselves. + (let ((host (if (and (subtypep (class-of host) 'unpreprocessed-host) + (not (eql host *preprocessing-host*))) + (preprocess-host host) host))) + (getf (slot-value host 'hostattrs) k))) (defun get-hostattrs-car (k &optional (host *host*)) (car (get-hostattrs k host))) |