 (ns circle.backend.action.load-balancer
   (:import com.amazonaws.AmazonClientException)
   (:require [circle.backend.nodes :as nodes])
+  (:require [clj-http.client :as http])
+  (:use [clojure.tools.logging :only (infof)])
   (:use [circle.backend.action :only (defaction abort!)])
   (:use [circle.util.except :only (throw-if-not)])
   (:use [circle.backend.build :only (build-log)])

                    (not= (-> tag :value) current-rev))))
     (map #(-> % :resourceId)))))

(defaction shutdown-remove-old-revisions []
  {:name "remove old revisions"}
  (fn [build]

        (println "shutdown-remove-old:" old-instances)
        (when (seq old-instances)
          (lb/remove-instances lb-name old-instances)
          (doall (map graceful-shutdown old-instances)))
        (when (seq terminated-instances)
          (lb/remove-instances lb-name terminated-instances))
        {:success true})
