On 10/13/10 - 03:08:47PM, [email protected] wrote: > From: Jan Provaznik <[email protected]> > > When user tries to build image and there is not provider or provider account, > more explicit message is raised. > --- > src/app/controllers/templates_controller.rb | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/src/app/controllers/templates_controller.rb > b/src/app/controllers/templates_controller.rb > index 8c8466a..04d979f 100644 > --- a/src/app/controllers/templates_controller.rb > +++ b/src/app/controllers/templates_controller.rb > @@ -142,6 +142,14 @@ class TemplatesController < ApplicationController > if i > image = Image.find_by_template_id(params[:image][:template_id], > :conditions => {:target => 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" > + end > + if provider.cloud_accounts.empty? > + raise "There is no provider account for '#{target}' provider" > + end > ReplicatedImage.create!( > :image_id => image.id, > :provider_id => Provider.find_by_cloud_type(target)
I'm of two minds about this. On the one hand, this is almost certainly throw-away code; once we get to handling multiple providers with multiple provider accounts, this whole thing will probably need to be re-written. So from that perspective we shouldn't spend too much time. On the other hand, for now, users don't get a lot of guidance on what to do here. So I would much prefer if this were to have links to the "Add Provider" and "Add Provider Account" pages, respectively. Given that this is what we are going to have to live with for a little while, it seems like we should at least give users a fighting chance of figuring out what to do. -- Chris Lalancette _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
