    submission.  Also submit a report for the host (if present). This is
    similar to timed-update-host, but always sends the update (doesn't run/skip
    based on the clock)"
-  [{:keys [host lastrun catalog report factset puppetdb-host puppetdb-port run-interval rand-percentage] :as state}]
-  (let [base-url {:protocol "http" :host puppetdb-host :port puppetdb-port :prefix "/pdb/query"}
-        catalog (some-> catalog (maybe-tweak-catalog rand-percentage))
+  [{:keys [host lastrun catalog report factset base-url run-interval rand-percentage] :as state}]
+  (let [catalog (some-> catalog (maybe-tweak-catalog rand-percentage))
         report (some-> report update-report-run-fields)
         factset (some-> factset (update-factset rand-percentage))]
     (when catalog (client/submit-catalog base-url 6 (json/generate-string catalog)))

      (Thread/sleep 10)
      (recur curr-time))))

(defn associate-catalog-with-host
  "Takes the given `catalog` and transforms it to appear related to
  `hostname`"
  [hostname catalog]
  (assoc catalog
    "certname" hostname
    "resources" (map #(update-in % ["tags"] conj hostname) (get catalog "resources"))))

(defn associate-report-with-host
  "Takes the given `report` and transforms it to appear related to
  `hostname`"
  [hostname report]
  (assoc report "certname" hostname))

(defn associate-factset-with-host
  "Takes the given `factset` and transforms it to appear related to
   `hostname`"
  [hostname factset]
  (assoc factset "certname" hostname))

(def supported-cli-options
  [["-c" "--config CONFIG" "Path to config or conf.d directory (required)"]
   ["-F" "--facts FACTS" "Path to a directory containing sample JSON facts (files must end with .json)"]

   computing the same hash again (causing constraint errors in the DB)"
  [report]
  (assoc report
         "configuration_version" (ks/uuid)
         "start_time" (time/now)
         "end_time" (time/now)
         "producer_timestamp" (time/now)))

(defn randomize-map-leaf
  "Randomizes a fact leaf based on a percentage provided with `rp`."
  [rp leaf]
  (if (< (rand 100) rp)
    (cond
     (string? leaf) (random-string (inc (rand-int 100)))
     (integer? leaf) (rand-int 100000)
     (float? leaf) (* (rand) (rand-int 100000))
     (ks/boolean? leaf) (random-bool))
    leaf))

