Commit 124ef8aa5ef933971a83a92c2105f1b4d21842a5

Thomas de Grivel 2020-04-18T15:22:35

declare :before and :after as virtual properties

diff --git a/core/spec.lisp b/core/spec.lisp
index 6d9106a..b2266c0 100644
--- a/core/spec.lisp
+++ b/core/spec.lisp
@@ -122,14 +122,33 @@ First value lists properties out of specification in the following format :
 Second value lists properties in line with spec. Format is
   (PROPERTY-NAME VALUE)"))
 
-(defmethod resource-diff ((res resource))
-  (let ((specified-properties (specified-properties res))
-        diff)
+(defvar *virtual-properties*
+  '(:after
+    :before)
+  "Special properties that will not be synchronized.")
+
+(declaim (type list *virtual-properties*))
+
+(defun diffable-properties (specified-properties)
+  (let ((properties))
     (loop
        (when (endp specified-properties)
-         (return))
+         (return (nreverse properties)))
        (let* ((property (pop specified-properties))
-              (specified (pop specified-properties))
+              (specified (pop specified-properties)))
+         (unless (find property *virtual-properties* :test #'eq)
+           (push property properties)
+           (push specified properties))))))
+
+(defmethod resource-diff ((res resource))
+  (let* ((specified-properties (specified-properties res))
+         (properties (diffable-properties specified-properties))
+         diff)
+    (loop
+       (when (endp properties)
+         (return))
+       (let* ((property (pop properties))
+              (specified (pop properties))
               (probed (get-probed res property))
               (desc (describe-probed-property-value res property probed)))
          (unless (match-specified-value res property specified desc (host-os *host*))