Satisfy style checker
[candle] / src / main / aws / aws.lisp
index 1d3745b27cd59886ad20722d5332710c0ca5b3ad..ad224af7439ad7b56ba4ba2a0e17f0cc79fc6935 100644 (file)
@@ -26,6 +26,7 @@
    (values-list retn))))
 
 (defun start-shutdown-thread ()
+ (log:info "Starting AWS shutdown thread")
  (sb-thread:make-thread
   (lambda ()
    (loop
     (sleep 30)))
   :name "AWS Shutdown Thread"))
 
+(defmethod candle:shutdown-system ((job-system (eql :aws)))
+ (log:info "Shutting down AWS box for exit")
+ ; If there's a job going, we need to wait for it to finish
+ (sb-thread:with-mutex (*aws-mutex*))
+ (stop-aws-box))
+
 (defun aws-command (cmd &rest args)
  (with-output-to-string (out)
- (sb-ext:run-program
-  *aws-exec*
-  (append
-   (list "ec2" cmd)
-   args)
-  :output out
-  :error *error-output*)))
 (sb-ext:run-program
+   *aws-exec*
+   (append
+    (list "ec2" cmd)
+    args)
+   :output out
+   :error *error-output*)))
 
 (defun describe-property (property)
  (read-from-string
  (let*
   ((out nil)
    (code nil))
-   (setf out
-    (with-output-to-string (out-str)
-     (setf code
-      (sb-ext:process-exit-code
-       (sb-ext:run-program
-        *ssh-exec*
-        (list
-         "-o"
-         "StrictHostKeyChecking=no"
-         "-o"
-         "UserKnownHostsFile=/dev/null"
-         "-i"
-         *aws-keyfile*
-         (describe-property "PublicIpAddress")
-         (format nil "cd ~A ; ~A run" *remote-work-dir* *remote-candle-location*))
-        :output out-str
-        :error out-str
-        :wait t)))))
-   (values (zerop code) out)))
+  (setf out
+   (with-output-to-string (out-str)
+    (setf code
+     (sb-ext:process-exit-code
+      (sb-ext:run-program
+       *ssh-exec*
+       (list
+        "-o"
+        "StrictHostKeyChecking=no"
+        "-o"
+        "UserKnownHostsFile=/dev/null"
+        "-i"
+        *aws-keyfile*
+        (describe-property "PublicIpAddress")
+        (format nil "cd ~A ; ~A run" *remote-work-dir* *remote-candle-location*))
+       :output out-str
+       :error out-str
+       :wait t)))))
+  (values (zerop code) out)))