Skip to content

Instantly share code, notes, and snippets.

View tbatchelli's full-sized avatar

Antoni Batchelli tbatchelli

View GitHub Profile
(ns classlojure-test.core
(:use [clojure.java.io :only [as-url]]
[ clojure.pprint :only [pprint]]
[dynapath.util :only [all-classpath-urls classpath-urls]])
(:import [java.net URL URLClassLoader]))
(def base-classloader
(or (.getClassLoader clojure.lang.RT)
(.getContextClassLoader (Thread/currentThread))))
; nREPL 0.1.7
user> (use 'classlojure-test.core :reload)
nil
user> (with-classloader vmfest-xpcom (require 'vmfest.virtualbox.version) (vmfest.virtualbox.version/vbox-binding) )
CompilerException java.lang.ClassNotFoundException: vmfest.virtualbox.version, compiling:(NO_SOURCE_PATH:1)
user> (with-classloader vmfest-xpcom (require 'vmfest.virtualbox.version) (vmfest.virtualbox.version/vbox-binding) )
CompilerException java.lang.ClassNotFoundException: vmfest.virtualbox.version, compiling:(NO_SOURCE_PATH:1)
user> (with-classloader vmfest-xpcom (require 'vmfest.virtualbox.version))
nil
user> (with-classloader vmfest-xpcom (require 'vmfest.virtualbox.version) (vmfest.virtualbox.version/vbox-binding) )
; nREPL 0.1.7
user> (use 'vmfest.manager :reload)
FileNotFoundException Could not locate vmfest/manager__init.class or vmfest/manager.clj on classpath: clojure.lang.RT.load (RT.java:432)
user> (use 'classlojure-test.core :reload)
nil
user> (with-classloader vmfest-ws (use 'vmfest.manager))
nil
user> (with-classloader vmfest-xpcom (use 'vmfest.manager) )
nil
user> (with-classloader vmfest-xpcom (vmfest.virtualbox.version/vbox-binding) )
; nREPL 0.1.7
user> (use 'classlojure-test.core :reload)
nil
user> (with-classloader vmfest-xpcom (use 'vmfest.manager :reload-all) )
nil
user> (with-classloader vmfest-ws (use 'vmfest.manager :reload-all) )
nil
user> (with-classloader vmfest-ws (vmfest.virtualbox.version/vbox-binding) )
:ws
user> (with-classloader vmfest-xpcom (vmfest.virtualbox.version/vbox-binding) )
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke (Method.java:601)
classlojure.core$invoke_in_STAR_.doInvoke (core.clj:61)
clojure.lang.RestFn.invoke (RestFn.java:494)
classlojure.core$eval_in_STAR_$print_read_eval__1489.invoke (core.clj:77)
classlojure.core$eval_in_STAR_.doInvoke (core.clj:81)
clojure.lang.RestFn.invoke (RestFn.java:425)
user> (print-cause-trace *e)
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke (Method.java:601)
classlojure.core$invoke_in_STAR_.doInvoke (core.clj:61)
clojure.lang.RestFn.invoke (RestFn.java:494)
classlojure.core$eval_in_STAR_$print_read_eval__1481.invoke (core.clj:77)
classlojure.core$eval_in_STAR_.doInvoke (core.clj:81)
(ns pallet.compute.vmfest
"The VMFest provider allows Pallet to use VirtualBox via VMFest.
Example Configuration
---------------------
An example service configuration in `~/.pallet/config.clj`
:vb {:provider \"vmfest\"
:default-local-interface \"vboxnet0\"
;; When using the XPCOM Bridge, we don't create a session with the
;; server, instead, we just instantiate a singleton of the VBM
(def ^VirtualBoxManager instance* (atom nil))
(defn ^VirtualBoxManager instance
"If the loaded vbox library is xpcom, it will create an instance of
the xpcom service if it doesn't exist already"
[]
(when (xpcom?)
(if-let [the-instance @instance*]
;; you should not try to load this namespace if no vboxj*.jar is in
;; the classpath.
(require 'vmfest.virtualbox.version)
(let [vbox-load-exception
(Exception.
(str "No VirtualBox library loaded. This namespace can only be "
"referred to *after* a vmfest provider is initialized"))]
(when (= :error (vmfest.virtualbox.version/vbox-binding))
(throw vbox-load-exception)))
2013-05-08 11:11:35,634 DEBUG p.s.execute 192.168.56.101 ==> { cat > /var/lib/pallet/home/git-user/.ssh/config.new <<EOFpallet
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> Host github.com
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> HostName github.com
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> StrictHostKeyChecking no
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> EOFpallet
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> } && \
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> # remote_file.clj:169
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> filediff= && \
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> # remote_file.clj:170
2013-05-08 11:11:35,635 DEBUG p.s.execute 192.168.56.101 ==> if [ -e /home/git-user/.ssh/config ] && [ -e /var/lib/pallet/home/git-user/.ssh/config ]; then