From: Jan Provaznik jprovazn@redhat.com
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)
On 10/13/10 - 03:08:47PM, jprovazn@redhat.com wrote:
From: Jan Provaznik jprovazn@redhat.com
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.
On 10/14/2010 09:24 PM, Chris Lalancette wrote:
On 10/13/10 - 03:08:47PM, jprovazn@redhat.com wrote:
From: Jan Provaznikjprovazn@redhat.com
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.
Hi, this patch (with links to provider/provider account) is part of "teplate-related fixes" patchset.
Jan
deltacloud-devel@lists.fedorahosted.org