Created
April 29, 2011 00:41
-
-
Save davidsantiago/947641 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| So, I have this file PROJECT_ROOT/dev-resources/config/nginx/battletheory.conf, and it is a template intended for use with pallet.template. In the past (when it wasn't a template), I have successfully done | |
| (remote-file/remote-file "/etc/nginx/sites-enabled/battletheory.conf" | |
| :local-file "dev-resources/config/nginx/battletheory.conf") | |
| Now I need battletheory.conf to be a template, so I am trying | |
| (remote-file/remote-file "/etc/nginx/sites-enabled/battletheory.conf" | |
| :local-file "dev-resources/config/nginx/battletheory.conf") | |
| This gives a no-likey: | |
| ... yadda yadda ... | |
| Caused by: java.lang.NullPointerException | |
| at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:263) | |
| at pallet.utils$load_resource_url.invoke(utils.clj:54) | |
| at pallet.template$interpolate_template.invoke(template.clj:68) | |
| at pallet.action.remote_file$fn__5644$fn__5646$fn__5672.invoke(remote_file.clj:189) | |
| at pallet.action.remote_file$fn__5644$fn__5646.doInvoke(remote_file.clj:185) | |
| at clojure.lang.RestFn.applyTo(RestFn.java:143) | |
| at clojure.core$apply.invoke(core.clj:542) | |
| at pallet.action_plan$apply_action$fn__3190.invoke(action_plan.clj:283) | |
| at pallet.action_plan$eval3244$fn__3245$fn__3246$fn__3247.invoke(action_plan.clj:345) | |
| at clojure.core$map$fn__3695.invoke(core.clj:2096) | |
| at clojure.lang.LazySeq.sval(LazySeq.java:42) | |
| ... 39 more | |
| So I have been looking at the source for pallet.template and pallet.utils. | |
| David-Santiagos-Computer:servlet David$ cake repl | |
| user=> (use 'pallet.template) | |
| nil | |
| user=> (find-template "dev-resources/config/nginx/battletheory.conf" {:server "blah"}) | |
| nil | |
| user=> (def cand-templs #'pallet.template/candidate-templates) | |
| #'user/cand-templs | |
| user=> (cand-templs "dev-resources/config/nginx/battletheory.conf" "stage" {}) | |
| ("dev-resources/config/nginx/battletheory_stage.conf" "resources/dev-resources/config/nginx/battletheory_stage.conf" "dev-resources/config/nginx/battletheory_unknown.conf" "resources/dev-resources/config/nginx/battletheory_unknown.conf" "dev-resources/config/nginx/battletheory_unknown.conf" "resources/dev-resources/config/nginx/battletheory_unknown.conf" "dev-resources/config/nginx/battletheory.conf" "resources/dev-resources/config/nginx/battletheory.conf") | |
| user=> (some get-resource (cand-templs "dev-resources/config/nginx/battletheory.conf" "stage" {}) ) | |
| nil | |
| So, note that when I call cand-templs with the path to the file, it does generate the file itself as one of the possibilities (the penultimate). However, the following line, which is more or less the exact thing pallet.template/find-template does, fails to load the file. Indeed, | |
| user=> (get-resource "dev-resources/config/nginx/battletheory.conf") | |
| nil | |
| user=> (get-resource "/dev-resources/config/nginx/battletheory.conf") | |
| nil | |
| user=> (slurp "dev-resources/config/nginx/battletheory.conf") | |
| ...the contents of the file... | |
| So I guess my questions are, 1) is this desirable behavior? 2) What the heck do I do to make pallet.template work? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment