 
 (defn get-template
     [metadata]
-    (slurp (if metadata "data/template.xml" "data/template_with_metadata.xml")))
+    (slurp (if metadata "data/template_with_metadata.xml" "data/template.xml")))
 
 (defn create-job
     [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch metadata]
-    (log-operation job-name git-repo branch "create")
+    (log-operation job-name git-repo branch "create" metadata)
     (let [template (get-template metadata)
           config   (update-template template git-repo branch metadata)
           url      (str (update-jenkins-url jenkins-url jenkins-auth) "createItem?name=" (.replaceAll job-name " " "%20"))]
+          (spit "x.xml" config)
           (println "URL to use: " url)
           (try
               (->> (send-configuration-xml-to-jenkins url config)


(defn update-job
    [jenkins-url jenkins-auth include-jenkins-reply? job-name git-repo branch metadata]
    (log-operation job-name git-repo branch "update")
    (let [template (get-template metadata)
          config   (update-template template git-repo branch metadata)
          url      (str (job-name->url (update-jenkins-url jenkins-url jenkins-auth) job-name) "/config.xml")]

    (job-related-command jenkins-url jenkins-auth include-jenkins-reply? job-name "doDelete"))

(defn log-operation
    [job-name git-repo branch operation metadata]
    (println "***" operation "***")
    (println "job-name" job-name)
    (println "git-repo" git-repo)
    (println "branch"   branch)
    (println "metadata" metadata))

(defn send-configuration-xml-to-jenkins
    [url config]
