From: Jan Provaznik <[email protected]>
https://bugzilla.redhat.com/show_bug.cgi?id=641366
We explicitly check if there is a provider of selected type when building
template. This patch is temporary and code will be removed when we will support
multiple providers/builds.
---
src/app/controllers/templates_controller.rb | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb
b/src/app/controllers/templates_controller.rb
index 4e19df8..3c5dd86 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -128,6 +128,18 @@ class TemplatesController < ApplicationController
@tpl.upload_template unless @tpl.uploaded
targets.each do |target|
+ # FIXME: for beta release we check explicitly that provider and provider
+ # account exists
+ unless provider = Provider.find_by_cloud_type(target)
+ raise "There is no provider of '#{target}' type, you can add provider \
+on <a href=\"#{url_for :controller => 'provider'}\">the providers page.</a>"
+ end
+ if provider.cloud_accounts.empty?
+ raise "There is no provider account for '#{target}' provider, you can \
+add account on <a href=\"#{url_for :controller => 'provider', \
+:action => 'accounts', :id => provider.id}\">the provider accounts page</a>"
+ end
+
unless img = Image.build(@tpl, target)
flash[:error] ||= {}
flash[:error][:failures] ||= {}
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel