Created
July 20, 2011 14:15
-
-
Save hhutch/1095036 to your computer and use it in GitHub Desktop.
Pallet snippets that are useful
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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