Skip to content

Commit

Permalink
Fix parens in sample and default project resources
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoduncan committed Feb 17, 2013
1 parent 935140a commit 9b2ab74
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/pallet/default-project-pallet.clj
Expand Up @@ -3,7 +3,7 @@
;;; By default, the pallet.api and pallet.crate namespaces are already referred.
;;; The pallet.crate.automated-admin-user/automated-admin-user us also referred.

;;; (require '[your-ns :refer [your-group])
;;; (require '[your-ns :refer [your-group]])

(defproject {{project-name}}
:provider {:vmfest
Expand Down
2 changes: 1 addition & 1 deletion sample-project-pallet.clj
Expand Up @@ -4,7 +4,7 @@
;;; already referred. The
;;; pallet.crate.automated-admin-user/automated-admin-user us also referred.

;;; (require '[your-ns :refer [your-group])
;;; (require '[your-ns :refer [your-group]])

(defproject my-project
;; Provider specific configuration
Expand Down
22 changes: 21 additions & 1 deletion src/pallet/compute.clj
Expand Up @@ -13,6 +13,10 @@
(implementation/supported-providers))

;;; Compute Service instantiation
(def ^:private
missing-provider-re
"No method in multimethod 'service' for dispatch value: :vmfest")

(defn compute-service
"Instantiate a compute service. The provider name should be a recognised
jclouds provider, or \"node-list\". The other arguments are keyword value
Expand All @@ -26,7 +30,23 @@
& {:keys [identity credential extensions node-list endpoint environment sub-services]
:as options}]
(implementation/load-providers)
(implementation/service provider-name options))
(try
(implementation/service provider-name options)
(catch IllegalArgumentException e
(if-let [[_ provider] (re-find missing-provider-re (.getMessage e))]
(let [cause (cond
(= provider ":vmfest")
"Possible missing dependency on pallet-vmfest."
(find-ns 'pallet.compute.jclouds)
"Possible missing dependency on a jclouds provider."
:else
"Possible missing dependency")]
(throw (ex-info
(str "No pallet provider found for " provider
". " cause)
{:provider provider
:cause cause})))
(throw e)))))

;;; Actions

Expand Down

0 comments on commit 9b2ab74

Please sign in to comment.