 (ns celestial.puppet-standalone
   "A standalone puppet provisioner"
   (:use 
-    clojure.pprint
     [clj-yaml.core :as yaml]
     [clojure.java.io :only (file)]
     [clojure.core.strint :only (<<)]

(defmethod pconstruct :puppet-std 
  [{:keys [run-opts] :as type :or {run-opts {}}} {:keys [machine env] :as spec}]
  (let [remote {:host (machine :ip) :user (or (machine :user) "root")}]
    (Standalone. remote
      (-> (get-in type [:puppet-std env])
        (update-in [:args] (fn [a] (concat a (run-opts :args))))
        (merge (select-keys run-opts [:classes]))
        (assoc :hostname (machine :hostname))
        ))))

    [celestial.model :only (pconstruct)]
    [taoensso.timbre :only (debug info error warn trace)]
    [supernal.core :only (ns- lifecycle copy run execute env)]
    [clojure.string :only (join)])
  (:require 
    [slingshot.slingshot :refer [throw+]]))

(defn copy-module [remote {:keys [src name]}]
  {:pre [(remote :host) src name]}
