   (:use 
     [taoensso.timbre :only (debug info error warn)]
     clojure.core.strint
-    [com.narkisr.celestial.core]
+    com.narkisr.celestial.core
     [com.narkisr.proxmox.remote :only (prox-post prox-delete prox-get)]
     [slingshot.slingshot :only  [throw+ try+]]
     )

(defn validate [spec]
  (schema/report-errors (schema/validate ct-schema spec)))

(defn task-status [upid]
  (prox-get (str "/nodes/proxmox/tasks/" upid "/status")))

(defn wait-for [upid]
  (while (= "running" (:status (task-status upid)))
    (Thread/sleep 200)
    (debug "Waiting for task" upid "to end")) )

(defn check-task
  "Checking that a proxmox task has succeeded"
  [upid]
  (wait-for upid)  
  (let [{:keys [exitstatus] :as res} (task-status upid)]
    (when (not= exitstatus "OK")
      (throw+ (assoc res :type ::task-failed)))))


  Openvz
  (unmount [this]
    (use-ns)
    (debug "unmounting" (:vmid spec))
    (try+
      (safe 
        (prox-post (str "/nodes/" node "/openvz/" (:vmid spec) "/status/umount")))
