Skip to content

Instantly share code, notes, and snippets.

@calebphillips
Forked from hhutch/pallet.snippets.clj
Created April 4, 2013 19:40
Show Gist options
  • Save calebphillips/5313495 to your computer and use it in GitHub Desktop.
Save calebphillips/5313495 to your computer and use it in GitHub Desktop.
(defn nodes-in-group
"Build a list of nodes in a given security-group"
[security-group]
(filter #(= (% 0) security-group)
(map #(vector (pallet.compute/group-name %)
(pallet.compute/primary-ip %)
(pallet.compute/id %)
(pallet.compute.jclouds/node-locations %) )
(pallet.compute/nodes srvc))))
(defn process-phase-output
"Grab the output of a single phase"
[compute-service server-group phase-to-run]
(let [phase-output-data (core/converge server-group :compute compute-service :phase phase-to-run)
operated-on-node-key (-> phase-output-data :results keys first)
phase-results-key (first (filter #(re-find #"^phase\d+" (name %)) (-> phase-output-data :results opnode keys)))
command-output-string (-> phase-output-data :results operated-on-node-key phase-results-key first :out) ]
( .... do something with command-output-string .... ) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment