Skip to content

Instantly share code, notes, and snippets.

clj-html
"Elapsed time: 13.81 msecs"
"Elapsed time: 12.244 msecs"
"Elapsed time: 18.233 msecs"
hiccup
"Elapsed time: 5.397 msecs"
"Elapsed time: 3.905 msecs"
"Elapsed time: 3.058 msecs"
hiccup (type-hint)
"Elapsed time: 4.597 msecs"
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.lang.AssertionError: Assert failed: (instance? IMedium medium)
[Thrown class java.lang.RuntimeException]
Restarts:
0: [QUIT] Quit to the SLIME top level
1: [CAUSE1] Invoke debugger on cause java.util.concurrent.ExecutionException: java.lang.AssertionError: Assert failed: (instance? IMedium medium) [Thrown class java.util.concurrent.ExecutionException]
2: [CAUSE2] Invoke debugger on cause java.lang.AssertionError: Assert failed: (instance? IMedium medium) [Thrown class java.util.concurrent.ExecutionException]
3: [CAUSE3] Invoke debugger on cause Assert failed: (instance? IMedium medium) [Thrown class java.lang.AssertionError]
Backtrace:
java.lang.String cannot be cast to clojure.lang.IFn
[Thrown class java.lang.ClassCastException]
Restarts:
0: [QUIT] Quit to the SLIME top level
1: [ABORT] ABORT to SLIME level 0
Backtrace:
0: pallet.compute.vmfest$image_from_template.invoke(vmfest.clj:245)
1: pallet.compute.vmfest.VmfestService.run_nodes(vmfest.clj:301)
(defn mount-shared-folder
"Mount a shared folder in vmware."
[request]
(-> request
(directory/directory "/Users/David" :owner "david")
(exec-script/exec-script
(defvar uid @(id "-u" "david"))
(defvar gid @(id "-g" "david"))
(if (!= 0 @(mountpoint -q "/Users/David"))
(sudo mount "-t" vboxsf "-o"
(def server-system (core/node-spec :image {:os-family :ubuntu
:os-version "10.10"}))
(def server-config
(core/server-spec
:phases {:bootstrap (phase/phase-fn (crates/bootstrap))
:configure (phase/phase-fn
(crates/java)
(crates/iptables)
(crates/couchdb)
context.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff")).payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).calculateMD5().build()
;; 1
(build-blob blobstore :metadata {"Adrian" "powderpuff"} :payload TEST_STRING :content-type MediaType/TEXT_PLAIN :md5 true)
;; 2
(build-blob blobstore :metadata {"Adrian" "powderpuff"}
:payload (blob-payload TEST_STRING :content-type MediaType/TEXT_PLAIN :md5 true))
;; Instead of sign-blob-request
(defn sign-get
"Get a signed http GET request for manipulating a blob in another
application, Ex. curl."
[container-name name ^Blobstore blobstore]
(.signGetBlob (.. blobstore getContext getSigner) container-name name))
(defn sign-put
"Get a signed http PUT request for manipulating a blob in another
application, Ex. curl. A Blob with at least the name and content-length
ERROR in (large-container-list-test) (:-1)
expected: (= total-blobs (count-blobs *blobstore* container-name))
actual: java.lang.reflect.UndeclaredThrowableException: null
at org.jclouds.blobstore.config.$Proxy30.countBlobs (:-1)
org.jclouds.blobstore2$count_blobs.invoke (blobstore2.clj:256)
org.jclouds.blobstore2_test/fn (blobstore2_test.clj:91)
clojure.test$test_var$fn__6131.invoke (test.clj:688)
clojure.test$test_var.invoke (test.clj:688)
clojure.test$test_all_vars$fn__6135$fn__6142.invoke (test.clj:704)
org.jclouds.blobstore2_test$clean_stub_fixture$fn__705.invoke (blobstore2_test.clj:34)
@davidsantiago
davidsantiago / gist:926154
Created April 18, 2011 20:55
SSH Port forwarding in Pallet!
(defmacro with-ssh-tunnel->
"Execute the body with an ssh-tunnel available for the ports given in the
tunnels map. tunnels should be a map from local ports (integers) to either
1) An integer remote port. Remote host is assumed to be 'localhost'.
2) A vector of remote host and remote port. eg, [\"yahoo.com\" 80].
Automatically closes the connection (and port forwards) on completion."
[request tunnels & body]
`(clj-ssh/with-ssh-agent [(execute/default-agent)]
(let [user# (:user ~request)
node-address# (compute/node-address (:target-node ~request))
{:phases {:configure #<nodes$fn__12253 com.battletheory.deploy.nodes$fn__12253@197e2a6>,
:deploy #<nodes$fn__12258 com.battletheory.deploy.nodes$fn__12258@a123fb>,
:bootstrap #<nodes$fn__12251 com.battletheory.deploy.nodes$fn__12251@1417095>,
:setup-db #<nodes$fn__12256 com.battletheory.deploy.nodes$fn__12256@1466dd3>},
:group-name :server,
:image {:os-family :ubuntu, :os-version "10.10"}}