mirror of https://github.com/apache/jclouds.git
Issue 457: redirected old clj syntax to new
This commit is contained in:
parent
4a52218565
commit
70f765be59
|
@ -82,6 +82,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
:only [wall-hack-field]
|
:only [wall-hack-field]
|
||||||
:rename {wall-hack-field get-field}])))
|
:rename {wall-hack-field get-field}])))
|
||||||
|
|
||||||
|
(defmacro deprecate-fwd [old-name new-name] `(defn ~old-name {:deprecated "beta-9"} [& args#] (apply ~new-name args#)))
|
||||||
|
|
||||||
(defn compute-service
|
(defn compute-service
|
||||||
"Create a logged in context."
|
"Create a logged in context."
|
||||||
([#^String provider #^String provider-identity #^String provider-credential
|
([#^String provider #^String provider-identity #^String provider-credential
|
||||||
|
@ -150,6 +152,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
([#^String group #^ComputeService compute]
|
([#^String group #^ComputeService compute]
|
||||||
(filter #(= (.getTag %) group) (nodes-with-details compute))))
|
(filter #(= (.getTag %) group) (nodes-with-details compute))))
|
||||||
|
|
||||||
|
(deprecate-fwd nodes-with-tag nodes-in-group)
|
||||||
|
|
||||||
(defn images
|
(defn images
|
||||||
"Retrieve the available images for the compute context."
|
"Retrieve the available images for the compute context."
|
||||||
([] (images *compute*))
|
([] (images *compute*))
|
||||||
|
@ -209,6 +213,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
(seq
|
(seq
|
||||||
(.createNodesInGroup compute group count template))))
|
(.createNodesInGroup compute group count template))))
|
||||||
|
|
||||||
|
(deprecate-fwd run-nodes create-nodes)
|
||||||
|
|
||||||
(defn create-node
|
(defn create-node
|
||||||
"Create a node using the default or specified template.
|
"Create a node using the default or specified template.
|
||||||
|
|
||||||
|
@ -232,6 +238,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
([group template compute]
|
([group template compute]
|
||||||
(first (create-nodes group 1 template compute))))
|
(first (create-nodes group 1 template compute))))
|
||||||
|
|
||||||
|
(deprecate-fwd run-node create-node)
|
||||||
|
|
||||||
(defn #^NodeMetadata node-details
|
(defn #^NodeMetadata node-details
|
||||||
"Retrieve the node metadata, given its id."
|
"Retrieve the node metadata, given its id."
|
||||||
([id] (node-details id *compute*))
|
([id] (node-details id *compute*))
|
||||||
|
@ -244,6 +252,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
([#^String group #^ComputeService compute]
|
([#^String group #^ComputeService compute]
|
||||||
(.suspendNodesMatching compute (NodePredicates/inGroup group))))
|
(.suspendNodesMatching compute (NodePredicates/inGroup group))))
|
||||||
|
|
||||||
|
(deprecate-fwd suspend-nodes-with-tag suspend-nodes-in-group)
|
||||||
|
|
||||||
(defn suspend-node
|
(defn suspend-node
|
||||||
"Suspend a node, given its id."
|
"Suspend a node, given its id."
|
||||||
([id] (suspend-node id *compute*))
|
([id] (suspend-node id *compute*))
|
||||||
|
@ -256,6 +266,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
([#^String group #^ComputeService compute]
|
([#^String group #^ComputeService compute]
|
||||||
(.resumeNodesMatching compute (NodePredicates/inGroup group))))
|
(.resumeNodesMatching compute (NodePredicates/inGroup group))))
|
||||||
|
|
||||||
|
(deprecate-fwd resume-nodes-with-tag resume-nodes-in-group)
|
||||||
|
|
||||||
(defn resume-node
|
(defn resume-node
|
||||||
"Resume a node, given its id."
|
"Resume a node, given its id."
|
||||||
([id] (resume-node id *compute*))
|
([id] (resume-node id *compute*))
|
||||||
|
@ -268,6 +280,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
([#^String group #^ComputeService compute]
|
([#^String group #^ComputeService compute]
|
||||||
(.rebootNodesMatching compute (NodePredicates/inGroup group))))
|
(.rebootNodesMatching compute (NodePredicates/inGroup group))))
|
||||||
|
|
||||||
|
(deprecate-fwd reboot-nodes-with-tag reboot-nodes-in-group)
|
||||||
|
|
||||||
(defn reboot-node
|
(defn reboot-node
|
||||||
"Reboot a node, given its id."
|
"Reboot a node, given its id."
|
||||||
([id] (reboot-node id *compute*))
|
([id] (reboot-node id *compute*))
|
||||||
|
@ -280,6 +294,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
([#^String group #^ComputeService compute]
|
([#^String group #^ComputeService compute]
|
||||||
(.destroyNodesMatching compute (NodePredicates/inGroup group))))
|
(.destroyNodesMatching compute (NodePredicates/inGroup group))))
|
||||||
|
|
||||||
|
(deprecate-fwd destroy-nodes-with-tag destroy-nodes-in-group)
|
||||||
|
|
||||||
(defn destroy-node
|
(defn destroy-node
|
||||||
"Destroy a node, given its id."
|
"Destroy a node, given its id."
|
||||||
([id] (destroy-node id *compute*))
|
([id] (destroy-node id *compute*))
|
||||||
|
@ -335,6 +351,8 @@ See http://code.google.com/p/jclouds for details."
|
||||||
[#^NodeMetadata node]
|
[#^NodeMetadata node]
|
||||||
(.getGroup node))
|
(.getGroup node))
|
||||||
|
|
||||||
|
(deprecate-fwd tag group)
|
||||||
|
|
||||||
(defn hostname
|
(defn hostname
|
||||||
"Returns the compute node's name"
|
"Returns the compute node's name"
|
||||||
[#^ComputeMetadata node]
|
[#^ComputeMetadata node]
|
||||||
|
|
|
@ -53,6 +53,44 @@ list, Alan Dipert and MeikelBrandmeyer."
|
||||||
(is (compute-service? (as-compute-service *compute*)))
|
(is (compute-service? (as-compute-service *compute*)))
|
||||||
(is (compute-service? (as-compute-service (compute-context *compute*)))))
|
(is (compute-service? (as-compute-service (compute-context *compute*)))))
|
||||||
|
|
||||||
|
(deftest nodes-test
|
||||||
|
(is (empty? (nodes)))
|
||||||
|
(is (create-node "fred" (build-template
|
||||||
|
*compute* {} )))
|
||||||
|
(is (= 1 (count (nodes))))
|
||||||
|
(is (= 1 (count (nodes-in-group "fred"))))
|
||||||
|
(suspend-nodes-in-group "fred")
|
||||||
|
(is (suspended? (first (nodes-in-group "fred"))))
|
||||||
|
(resume-nodes-in-group "fred")
|
||||||
|
(is (running? (first (nodes-in-group "fred"))))
|
||||||
|
(reboot-nodes-in-group "fred")
|
||||||
|
(is (running? (first (nodes-in-group "fred"))))
|
||||||
|
(is (create-nodes "fred" 2 (build-template
|
||||||
|
*compute* {} )))
|
||||||
|
(is (= 3 (count (nodes-in-group "fred"))))
|
||||||
|
(is (= "fred" (group (first (nodes)))))
|
||||||
|
(destroy-nodes-in-group "fred")
|
||||||
|
(is (terminated? (first (nodes-in-group "fred")))))
|
||||||
|
|
||||||
|
(deftest nodes-test-deprecated
|
||||||
|
(is (empty? (nodes)))
|
||||||
|
(is (run-node "deprecated" (build-template
|
||||||
|
*compute* {} )))
|
||||||
|
(is (= 1 (count (nodes))))
|
||||||
|
(is (= 1 (count (nodes-with-tag "deprecated"))))
|
||||||
|
(suspend-nodes-with-tag "deprecated")
|
||||||
|
(is (suspended? (first (nodes-with-tag "deprecated"))))
|
||||||
|
(resume-nodes-with-tag "deprecated")
|
||||||
|
(is (running? (first (nodes-with-tag "deprecated"))))
|
||||||
|
(reboot-nodes-with-tag "deprecated")
|
||||||
|
(is (running? (first (nodes-with-tag "deprecated"))))
|
||||||
|
(is (run-nodes "deprecated" 2 (build-template
|
||||||
|
*compute* {} )))
|
||||||
|
(is (= 3 (count (nodes-with-tag "deprecated"))))
|
||||||
|
(is (= "deprecated" (tag (first (nodes)))))
|
||||||
|
(destroy-nodes-with-tag "deprecated")
|
||||||
|
(is (terminated? (first (nodes-with-tag "deprecated")))))
|
||||||
|
|
||||||
(deftest build-template-test
|
(deftest build-template-test
|
||||||
(let [service (compute-service "stub" "user" "password")]
|
(let [service (compute-service "stub" "user" "password")]
|
||||||
(testing "nullary"
|
(testing "nullary"
|
||||||
|
|
Loading…
Reference in New Issue