aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-01 14:14:13 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-01 14:47:27 -0700
commitbe2b15288d2d979345c3893c1fadd7650684fea5 (patch)
treec0a6ab77840979fd1a9901cefdf1c120a2faad29
parent3b642381dc1f69f41b36611bd794bf8f5a61e7be (diff)
downloadconsfigurator-be2b15288d2d979345c3893c1fadd7650684fea5.tar.gz
define three destructive operations on hosts & propspecs earlier
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/host.lisp25
-rw-r--r--src/propspec.lisp25
2 files changed, 25 insertions, 25 deletions
diff --git a/src/host.lisp b/src/host.lisp
index f948ec8..7f0db94 100644
--- a/src/host.lisp
+++ b/src/host.lisp
@@ -40,6 +40,31 @@ be applied to the host.")))
:props ,(slot-value host 'propspec)))
host)
+(defmethod %eval-propspec-hostattrs ((host host) (propspec propspec))
+ "Modify HOST in-place according to :HOSTATTRS subroutines."
+ (loop with *host* = host
+ for form in (propspec-props propspec)
+ for propapp = (compile-propapp form)
+ do (propappattrs propapp)))
+
+;; return values of the following two functions share structure, and thus are
+;; not safe to use except on host objects that were just made, or that are
+;; going straight into %CONSFIGURE
+
+(defmethod %union-propspec-into-host ((host host) (propspec propspec))
+ (prog1
+ (setq host (make-instance 'host
+ :attrs (hostattrs host)
+ :props (append-propspecs (host-propspec host)
+ propspec)))
+ (%eval-propspec-hostattrs host propspec)))
+
+(defmethod %replace-propspec-into-host ((host host) (propspec propspec))
+ (prog1
+ (setq host (make-instance 'host
+ :attrs (hostattrs host) :props propspec))
+ (%eval-propspec-hostattrs host propspec)))
+
(defmacro defhost (hostname (&key deploy) &body properties)
"Define a host with hostname HOSTNAME and properties PROPERTIES.
HOSTNAME can be a string or a symbol. In either case, the host will get a
diff --git a/src/propspec.lisp b/src/propspec.lisp
index 45f4f18..628c1e0 100644
--- a/src/propspec.lisp
+++ b/src/propspec.lisp
@@ -182,31 +182,6 @@ an atomic property application."
for propapp = (compile-propapp form)
do (propappapply propapp)))
-(defmethod %eval-propspec-hostattrs ((host host) (propspec propspec))
- "Modify HOST in-place according to :HOSTATTRS subroutines."
- (loop with *host* = host
- for form in (propspec-props propspec)
- for propapp = (compile-propapp form)
- do (propappattrs propapp)))
-
-;; return values of the following two functions share structure, and thus are
-;; not safe to use except on host objects that were just made, or that are
-;; going straight into %CONSFIGURE
-
-(defmethod %union-propspec-into-host ((host host) (propspec propspec))
- (prog1
- (setq host (make-instance 'host
- :attrs (hostattrs host)
- :props (append-propspecs (host-propspec host)
- propspec)))
- (%eval-propspec-hostattrs host propspec)))
-
-(defmethod %replace-propspec-into-host ((host host) (propspec propspec))
- (prog1
- (setq host (make-instance 'host
- :attrs (hostattrs host) :props propspec))
- (%eval-propspec-hostattrs host propspec)))
-
(defmethod propspec->type ((propspec propspec))
"Return :lisp if any types of the properties to be applied by PROPSPEC is
:lisp, else return :posix."