                             (inis-to-map)
                             (configure-logging!))
 
-        catalogs        (load-sample-data (:catalogs options))
+        catalogs        (if (:catalogs options) (load-sample-data (:catalogs options)))
+        reports         (if (:reports options) (load-sample-data (:reports options)))
 
         nhosts          (:numhosts options)
         hostnames       (set (map #(str "host-" %) (range (Integer/parseInt nhosts))))

    hosts catalog changes in accordance to the users preference)

  * Submit the resulting catalog"
  [{:keys [host lastrun catalog puppetdb-host puppetdb-port run-interval rand-percentage] :as state} clock]
  (if (> (- clock lastrun) run-interval)
    (let [catalog (if (< (rand 100) rand-percentage)
                    (tweak-catalog catalog)
                    catalog)]
      ;; Submit the catalog in a separate thread, so as to not disturb
      ;; the world-loop and otherwise distort the space-time
      ;; continuum.
      (future
        (log/info (format "[%s] submitting catalog" host))
        (submit-catalog puppetdb-host puppetdb-port catalog))
      (assoc state :lastrun clock :catalog catalog))
    state))


    (when-not (= pl-http/status-ok (:status result))
      (log/error result))))

(defn submit-report
  "Send the given wire-format `report` (associated with `host`) to a
  command-processing endpoint located at `puppetdb-host`:`puppetdb-port`."
  [puppetdb-host puppetdb-port report]
  (let [result (command/submit-command-via-http! puppetdb-host puppetdb-port "store report" 1 report)]
    (when-not (= pl-http/status-ok (:status result))
      (log/error result))))

(defn maybe-tweak-catalog
  "Slightly tweak the given catalog, returning a new catalog, `rand-percentage`
  percent of the time."
  [rand-percentage catalog]
  (if (< (rand 100) rand-percentage)
    (catutils/add-random-resource-to-wire-catalog catalog)
    catalog))

(defn update-host
  "Send a new _clock tick_ to a host
