Ack to all in this series

----- Original Message -----
From: [email protected]
To: [email protected]
Sent: Friday, December 10, 2010 12:04:34 PM GMT +00:00 GMT Britain, Ireland, 
Portugal
Subject: [deltacloud-devel] [PATCH aggregator 1/4] Added 'imported' to Template 
model

From: Jan Provaznik <[email protected]>

It's also disabled to build imported templates
---
 src/app/controllers/builds_controller.rb          |    4 ++++
 src/db/migrate/20100830150014_create_templates.rb |    1 +
 src/features/step_definitions/template_steps.rb   |    5 +++++
 src/features/template.feature                     |    8 ++++++++
 4 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/app/controllers/builds_controller.rb 
b/src/app/controllers/builds_controller.rb
index 4a1bdc2..6122eee 100644
--- a/src/app/controllers/builds_controller.rb
+++ b/src/app/controllers/builds_controller.rb
@@ -16,6 +16,10 @@ class BuildsController < ApplicationController
   def new
     raise "select template to build" unless id = params[:template_id]
     @tpl = Template.find(id)
+    if @tpl.imported
+      flash[:warning] = "Build imported template is not supported"
+      redirect_to templates_path
+    end
     @all_targets = Image.available_targets
   end
 
diff --git a/src/db/migrate/20100830150014_create_templates.rb 
b/src/db/migrate/20100830150014_create_templates.rb
index 4e6f89d..4bf569d 100644
--- a/src/db/migrate/20100830150014_create_templates.rb
+++ b/src/db/migrate/20100830150014_create_templates.rb
@@ -11,6 +11,7 @@ class CreateTemplates < ActiveRecord::Migration
       t.text    :summary
       t.boolean :complete, :default => false
       t.boolean :uploaded, :default => false
+      t.boolean :imported, :default => false
       t.integer :images_count
       t.timestamps
     end
diff --git a/src/features/step_definitions/template_steps.rb 
b/src/features/step_definitions/template_steps.rb
index 9d82f3a..24dea3b 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -88,3 +88,8 @@ end
 Given /^there is ec2 build for this template$/ do
   Image.build(@template, 'ec2')
 end
+
+Given /^there is an imported template$/ do
+  @template = Factory.build :template, :name => name, :imported => true
+  @template.save!
+end
diff --git a/src/features/template.feature b/src/features/template.feature
index e36ee72..d53b2af 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -115,3 +115,11 @@ Feature: Manage Templates
     Then I should be on the template builds page
     And I should see "mock1"
     And I should see "An attempted build of this template for the target 'ec2' 
already exists"
+
+  Scenario: Build imported template
+    Given there is an imported template
+    And I am on the templates page
+    When I choose this template
+    And I press "Build"
+    Then I should be on the templates page
+    And I should see "Build imported template is not supported"
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to