From: Jan Provaznik <jprovazn(a)redhat.com>
Disabled build for imported images
---
src/app/views/image_factory/templates/_builds.haml | 29 +++++++++----------
src/features/template.feature | 6 ++--
src/spec/controllers/builds_controller_spec.rb | 2 +-
3 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/src/app/views/image_factory/templates/_builds.haml
b/src/app/views/image_factory/templates/_builds.haml
index 00620e1..65cbc5a 100644
--- a/src/app/views/image_factory/templates/_builds.haml
+++ b/src/app/views/image_factory/templates/_builds.haml
@@ -3,17 +3,15 @@ Builds for
= @tpl.platform_version
, template "#{(a)tpl.name}"
-- if @targets_not_built.count > 0 then
- - form_tag(image_factory_builds_path, { :action => 'create', :method =>
:post }) do
- = hidden_field_tag :template_id, @tpl.id
- New Build for
- = select_tag 'target', options_for_select(@targets_not_built)
- = submit_tag "Go", :name => "build"
-
-- form_tag do
+- form_tag image_factory_builds_path do
= hidden_field_tag :template_id, @tpl.id
- /= restful_submit_tag "Upload", 'upload',
upload_image_factory_builds_path, 'POST'
- /= restful_submit_tag "Delete", 'delete',
delete_image_factory_builds_path, 'DELETE'
+ - if @targets_not_built.count > 0 then
+ - if @tpl.imported
+ Build imported template is not supported
+ - else
+ New Build for
+ = select_tag 'target', options_for_select(@targets_not_built)
+ = submit_tag "Go", :name => "build"
%ul
- if @images.empty?
@@ -27,8 +25,9 @@ Builds for
- img.provider_images.each do |pimg|
%li
= "#{pimg.provider.name}: #{pimg.status}"
- - img.not_uploaded_providers.each do |provider|
- %li
- = "#{provider.name}: "
- not uploaded
- = link_to 'upload', upload_image_factory_builds_path(:template_id
=> @tpl.id, :image_id => img.id, :provider_id => provider.id), {:class =>
'button'}
+ - unless @tpl.imported
+ - img.not_uploaded_providers.each do |provider|
+ %li
+ = "#{provider.name}: "
+ not uploaded
+ = link_to 'upload',
upload_image_factory_builds_path(:template_id => @tpl.id, :image_id => img.id,
:provider_id => provider.id), {:class => 'button'}
diff --git a/src/features/template.feature b/src/features/template.feature
index 4ed55b5..3ffea33 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -152,11 +152,11 @@ Feature: Manage Templates
Scenario: Build imported template
Given there is an imported template
+ And there is Amazon AWS provider account
And I am on the image factory templates page
When I choose this template
- And I follow "Build"
- Then I should be on the image factory templates page
- And I should see "Build imported template is not supported"
+ And I follow "Builds"
+ Then I should see "Build imported template is not supported"
Scenario: Search for templates
Given there are these templates:
diff --git a/src/spec/controllers/builds_controller_spec.rb
b/src/spec/controllers/builds_controller_spec.rb
index 0024592..a3d7f4d 100644
--- a/src/spec/controllers/builds_controller_spec.rb
+++ b/src/spec/controllers/builds_controller_spec.rb
@@ -50,7 +50,7 @@ describe ImageFactory::BuildsController do
it "should create a new Image" do
lambda do
- post :create, :template_id => @template.id, :targets =>
[ProviderType.find_by_codename("mock").id]
+ post :create, :template_id => @template.id, :target =>
ProviderType.find_by_codename("mock").id
end.should change(Image, :count).by(1)
end
end
--
1.7.4