[PATCH conductor] Fixed group name displayed in template sw selection
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=664066
---
src/app/util/repository_manager.rb | 2 +-
.../templates/_metagroup_packages.haml | 2 +-
src/features/template.feature | 17 ++++++++++++++---
src/spec/fixtures/packagegroupcategories.json | 2 +-
src/spec/fixtures/packagegroups.json | 4 ++--
5 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/app/util/repository_manager.rb b/src/app/util/repository_manager.rb
index 8ada489..6440417 100644
--- a/src/app/util/repository_manager.rb
+++ b/src/app/util/repository_manager.rb
@@ -65,7 +65,7 @@ class RepositoryManager
group = grps.find{|g| g[:id] == gname}
next unless cat and cat[:groups].include?(gname) and group
next if res.find{|g| g[:name] == gname}
- res << {:name => gname, :packages => group[:packages].keys}
+ res << {:label => group[:name], :name => gname, :packages => group[:packages].keys}
end
res
end
diff --git a/src/app/views/image_factory/templates/_metagroup_packages.haml b/src/app/views/image_factory/templates/_metagroup_packages.haml
index 3e83d34..82c2697 100644
--- a/src/app/views/image_factory/templates/_metagroup_packages.haml
+++ b/src/app/views/image_factory/templates/_metagroup_packages.haml
@@ -9,7 +9,7 @@
- selected = false
%h5
= check_box_tag 'selected_groups[]', group[:id], selected, {:disabled => selected, :id => "group_#{group[:id]}", :class => "softwaregroups #{selected ? 'selected' : ''}"}
- = label_tag "group_#{group[:id]}", group[:name]
+ = label_tag "group_#{group[:id]}", group[:label]
%ul
- group[:packages].each do |pkg|
%li
diff --git a/src/features/template.feature b/src/features/template.feature
index 4fe8e9a..922d59f 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -21,6 +21,17 @@ Feature: Manage Templates
And I should see "Template saved"
And I should see "mocktemplate"
+ Scenario: Add a package to a new template
+ Given I am on the new image factory template page
+ When I press "Add Software"
+ When I press "admin-tools"
+ Then I should see "System Tools"
+ And I should see "libdeltacloud"
+ When I check "libdeltacloud"
+ And I press "Add Selected"
+ Then I should see "New Template"
+ And I should see "libdeltacloud"
+
Scenario: Add a searched package to a new template
Given I am on the new image factory template page
When I press "Add Software"
@@ -41,7 +52,7 @@ Feature: Manage Templates
And I press "Add Software"
Then I should see "Managed Content Selection"
When I press "Collections"
- And I check "group_conductor"
+ And I check "group_system-tools"
And I press "Add Selected"
Then I should see "Managed Content to Bundle"
And the "tpl[name]" field by name should contain "mocktemplate"
@@ -61,7 +72,7 @@ Feature: Manage Templates
And I press "Add Software"
Then I should see "Managed Content Selection"
When I press "Collections"
- And I check "group_conductor"
+ And I check "group_system-tools"
And I press "Add Selected"
Then I should see "Managed Content to Bundle"
And the page should contain "#package_libdeltacloud" selector
@@ -103,7 +114,7 @@ Feature: Manage Templates
# test that we see a metagroup
Then I should see an input "admin-tools"
# test that we see a collection (collections are loaded by default)
- And I should see an input "conductor"
+ And I should see an input "system-tools"
Scenario: See upload status
Given there is a "mock1" template
diff --git a/src/spec/fixtures/packagegroupcategories.json b/src/spec/fixtures/packagegroupcategories.json
index 5b0a05e..ce6809f 100644
--- a/src/spec/fixtures/packagegroupcategories.json
+++ b/src/spec/fixtures/packagegroupcategories.json
@@ -4,7 +4,7 @@
"id" : "base-system",
"immutable" : true,
"name" : "Base System",
- "packagegroupids" : [ "deltacloud" ],
+ "packagegroupids" : [ "system-tools" ],
"repo_defined" : true,
"translated_description" : { },
"translated_name" : { }
diff --git a/src/spec/fixtures/packagegroups.json b/src/spec/fixtures/packagegroups.json
index a556ca9..963ae8a 100644
--- a/src/spec/fixtures/packagegroups.json
+++ b/src/spec/fixtures/packagegroups.json
@@ -1,4 +1,4 @@
-{ "conductor" : { "_id" : "conductor",
+{ "system-tools" : { "_id" : "conductor",
"conditional_package_names" : { },
"default" : true,
"default_package_names" : [ "libdeltacloud",
@@ -10,7 +10,7 @@
"immutable" : true,
"langonly" : null,
"mandatory_package_names" : [ ],
- "name" : "Aeolus Conductor",
+ "name" : "System Tools",
"optional_package_names" : [ ],
"repo_defined" : true,
"translated_description" : { },
--
1.7.4
12 years, 9 months
[PATCH conductor 1/2] BZ 674557 - After deletion of default pool, User creation fails
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=674557
Added a check to prevent deletion of pools named "default_pool".
This is a temporary measure until user create process has the
ability to designate pools.
---
src/app/controllers/resources/pools_controller.rb | 9 ++++++++-
src/features/pool.feature | 6 ++++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/resources/pools_controller.rb b/src/app/controllers/resources/pools_controller.rb
index b2bc8f9..3a927f1 100644
--- a/src/app/controllers/resources/pools_controller.rb
+++ b/src/app/controllers/resources/pools_controller.rb
@@ -74,7 +74,14 @@ class Resources::PoolsController < ApplicationController
def multi_destroy
Pool.find(params[:pools_selected]).each do |pool|
- pool.destroy if check_privilege(Privilege::MODIFY, pool)
+ # FIXME: remove this check when pools can be assigned to new users
+ # default_pool cannot be deleted because metadata object has it tied
+ # to id of 1 and deleting it prevents new users from being created
+ if pool.name == "default_pool"
+ flash[:notice] = "The default pool cannot be deleted"
+ else
+ pool.destroy if check_privilege(Privilege::MODIFY, pool)
+ end
end
redirect_to resources_pools_url
end
diff --git a/src/features/pool.feature b/src/features/pool.feature
index 1eced2a..e019df0 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -54,3 +54,9 @@ Feature: Manage Pools
And I should be on the resources pools page
And I should not see "Redhat Voyager Pool"
And I should not see "Amazon Startrek Pool"
+
+ Scenario: Cannot delete default_pool
+ Given I am on the pools page
+ When I check "default_pool" pool
+ And I press "Destroy"
+ Then I should see "The default pool cannot be deleted"
\ No newline at end of file
--
1.7.4
12 years, 9 months
[PATCH conductor 1/2] New Event model
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Replaces InstanceEvent model by more general polymorphic model. For now only instances are associated with events.
---
src/app/models/event.rb | 41 +++++++++++++++++++++++++++++++
src/app/models/instance.rb | 1 +
src/app/models/instance_event.rb | 41 -------------------------------
src/db/migrate/20110201132528_events.rb | 26 +++++++++++++++++++
src/dbomatic/dbomatic | 6 +---
5 files changed, 70 insertions(+), 45 deletions(-)
create mode 100644 src/app/models/event.rb
delete mode 100644 src/app/models/instance_event.rb
create mode 100644 src/db/migrate/20110201132528_events.rb
diff --git a/src/app/models/event.rb b/src/app/models/event.rb
new file mode 100644
index 0000000..06b3936
--- /dev/null
+++ b/src/app/models/event.rb
@@ -0,0 +1,41 @@
+# == Schema Information
+# Schema version: 20110207110131
+#
+# Table name: instance_events
+#
+# id :integer not null, primary key
+# instance_id :integer not null
+# event_type :string(255) not null
+# event_time :datetime
+# status :string(255)
+# message :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
+# Copyright (C) 2010 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+class Event < ActiveRecord::Base
+ belongs_to :source, :polymorphic => true
+
+ validates_presence_of :source_id
+ validates_presence_of :source_type
+end
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index a0efc2c..8a29cc7 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -88,6 +88,7 @@ class Instance < ActiveRecord::Base
has_many :permissions, :as => :permission_object, :dependent => :destroy,
:include => [:role],
:order => "permissions.id ASC"
+ has_many :events, :as => :source, :dependent => :destroy
validates_presence_of :pool_id
validates_presence_of :hardware_profile_id
diff --git a/src/app/models/instance_event.rb b/src/app/models/instance_event.rb
deleted file mode 100644
index df8e821..0000000
--- a/src/app/models/instance_event.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# == Schema Information
-# Schema version: 20110207110131
-#
-# Table name: instance_events
-#
-# id :integer not null, primary key
-# instance_id :integer not null
-# event_type :string(255) not null
-# event_time :datetime
-# status :string(255)
-# message :string(255)
-# created_at :datetime
-# updated_at :datetime
-#
-
-# Copyright (C) 2010 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
-class InstanceEvent < ActiveRecord::Base
- belongs_to :instance
-
- validates_presence_of :instance_id
- validates_presence_of :event_type
-end
diff --git a/src/db/migrate/20110201132528_events.rb b/src/db/migrate/20110201132528_events.rb
new file mode 100644
index 0000000..8af7137
--- /dev/null
+++ b/src/db/migrate/20110201132528_events.rb
@@ -0,0 +1,26 @@
+class Events < ActiveRecord::Migration
+ def self.up
+ drop_table :instance_events
+ create_table :events do |t|
+ t.integer :source_id, :null => false
+ t.string :source_type, :null => false
+ t.datetime :event_time
+ t.string :status_code
+ t.string :summary
+ t.string :description
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :events
+ create_table :instance_events do |t|
+ t.integer :instance_id, :null => false
+ t.string :event_type, :null => false
+ t.datetime :event_time
+ t.string :status
+ t.string :message
+ t.timestamps
+ end
+ end
+end
diff --git a/src/dbomatic/dbomatic b/src/dbomatic/dbomatic
index a1177a8..63b3301 100755
--- a/src/dbomatic/dbomatic
+++ b/src/dbomatic/dbomatic
@@ -165,10 +165,8 @@ class CondorEventLog < Nokogiri::XML::SAX::Document
begin
inst.save!
-
- InstanceEvent.create! :instance => inst,
- :event_type => inst.state,
- :event_time => @event_time
+ inst.events.create!(:status_code => inst.state,
+ :event_time => @event_time)
rescue => e
@logger.error "#{e.backtrace.shift}: #{e.message}"
e.backtrace.each do |step|
--
1.7.4
12 years, 9 months
[PATCH aeolus] Fixed bug in HWP Matching
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
This patch fixes a bug in the HardwareProfile matching, where HardwareProfiles were not matched when the specified front ent property value was less than a back end properties range start value
---
src/app/models/hardware_profile.rb | 3 +--
src/spec/models/hardware_profile_spec.rb | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index 75a501b..9cfc770 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -191,8 +191,7 @@ class HardwareProfile < ActiveRecord::Base
when "fixed"
match = BigDecimal.new(back_end_property.value.to_s) >= BigDecimal.new(front_end_property.value.to_s) ? true : false
when "range"
- match = BigDecimal.new(back_end_property.range_last.to_s) >= BigDecimal.new(front_end_property.value.to_s) &&
- BigDecimal.new(back_end_property.range_first.to_s) <= BigDecimal.new(front_end_property.value.to_s) ? true : false
+ match = BigDecimal.new(back_end_property.range_last.to_s) >= BigDecimal.new(front_end_property.value.to_s) ? true : false
when "enum"
create_array_from_property(back_end_property).each do |value|
if BigDecimal.new(value) >= BigDecimal.new(front_end_property.value.to_s)
diff --git a/src/spec/models/hardware_profile_spec.rb b/src/spec/models/hardware_profile_spec.rb
index 6a92b9c..7a971a3 100644
--- a/src/spec/models/hardware_profile_spec.rb
+++ b/src/spec/models/hardware_profile_spec.rb
@@ -137,7 +137,7 @@ describe HardwareProfile do
back_end_cpu_match = Factory(:hwpp_range, :name => 'cpu', :unit => 'count', :value => '4', :range_first => '1', :range_last => '8')
back_end_architecture_match = Factory(:hwpp_fixed, :name => 'architecture', :unit => 'label', :value => 'x86_64')
- back_end_memory_fail = Factory(:hwpp_range, :name => 'memory', :unit => 'MB', :value => '4048', :range_first => '4048', :range_last => '8192')
+ back_end_memory_fail = Factory(:hwpp_range, :name => 'memory', :unit => 'MB', :value => '1024', :range_first => '512', :range_last => '1024')
back_end_storage_fail = create_hwpp_enum(['1000', '1500', '2000'], {:name => 'storage', :unit => 'GB', :value => '1500'})
back_end_cpu_fail = Factory(:hwpp_range, :name => 'cpu', :unit => 'count', :value => '4', :range_first => '4', :range_last => '8')
back_end_architecture_fail = Factory(:hwpp_fixed, :name => 'architecture', :unit => 'label', :value => 'x86_64')
@@ -164,15 +164,15 @@ describe HardwareProfile do
it "should correctly match front end hardware profile properties with back end hardware profile properties" do
front_end_memory = Factory(:hwpp_fixed, :name => 'memory', :unit => 'MB', :value => '2048')
front_end_storage = Factory(:hwpp_fixed, :name => 'storage', :unit => 'GB', :value => '850')
- front_end_cpu = Factory(:hwpp_fixed, :name => 'cpu', :unit => 'count', :value => '2')
+ front_end_cpu = Factory(:hwpp_fixed, :name => 'cpu', :unit => 'count', :value => '3')
back_end_memory_match = Factory(:hwpp_range, :name => 'memory', :unit => 'MB', :value => '4048', :range_first => '1024', :range_last => '4048')
back_end_storage_match = create_hwpp_enum(['850', '1500', '2000'], {:name => 'storage', :unit => 'GB', :value => '1500'})
back_end_cpu_match = Factory(:hwpp_range, :name => 'cpu', :unit => 'count', :value => '4', :range_first => '1', :range_last => '8')
- back_end_memory_fail = Factory(:hwpp_range, :name => 'memory', :unit => 'MB', :value => '4048', :range_first => '4048', :range_last => '8192')
+ back_end_memory_fail = Factory(:hwpp_range, :name => 'memory', :unit => 'MB', :value => '512', :range_first => '512', :range_last => '1024')
back_end_storage_fail = create_hwpp_enum(['250', '500', '750'], {:name => 'storage', :unit => 'GB', :value => '500'})
- back_end_cpu_fail = Factory(:hwpp_range, :name => 'cpu', :unit => 'count', :value => '4', :range_first => '4', :range_last => '8')
+ back_end_cpu_fail = Factory(:hwpp_range, :name => 'cpu', :unit => 'count', :value => '4', :range_first => '1', :range_last => '2')
HardwareProfile.match_hardware_profile_property(front_end_memory, back_end_memory_match).should == true
HardwareProfile.match_hardware_profile_property(front_end_storage, back_end_storage_match).should == true
--
1.7.4
12 years, 9 months
[PATCH aeolus] Fixed bug in HWP Matching
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/models/hardware_profile.rb | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index 75a501b..9cfc770 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -191,8 +191,7 @@ class HardwareProfile < ActiveRecord::Base
when "fixed"
match = BigDecimal.new(back_end_property.value.to_s) >= BigDecimal.new(front_end_property.value.to_s) ? true : false
when "range"
- match = BigDecimal.new(back_end_property.range_last.to_s) >= BigDecimal.new(front_end_property.value.to_s) &&
- BigDecimal.new(back_end_property.range_first.to_s) <= BigDecimal.new(front_end_property.value.to_s) ? true : false
+ match = BigDecimal.new(back_end_property.range_last.to_s) >= BigDecimal.new(front_end_property.value.to_s) ? true : false
when "enum"
create_array_from_property(back_end_property).each do |value|
if BigDecimal.new(value) >= BigDecimal.new(front_end_property.value.to_s)
--
1.7.4
12 years, 9 months
[PATCH conductor] Task 433 and 434, template build ui changes
by Richard Su
Renamed "Images" tab to "Builds"
Table columns now matches cloud-engine-templates-details-images.png mockup.
Table shows builds that have been completed and uploaded, and additional
providers that a completed build can be uploaded to. The additional provider's
provider type would have to match the build's target.
Note the Arch column may be redundant because the Architecture is specified
per template and not per build.
Added an additional column to select providers to upload an existing image.
The hook to upload the image will need to be done at a future sprint when the
new image factory is ready.
It also contains a new form element to initiate a build. The select drop down
will only show targets that haven't been built. Try creating a mock provider
and you should see it appear in the select.
---
.../controllers/image_factory/builds_controller.rb | 9 ++++-
.../image_factory/templates_controller.rb | 42 ++++++++++++++++---
src/app/models/image.rb | 4 +-
src/app/views/image_factory/templates/_builds.haml | 42 ++++++++++++++++++++
src/app/views/image_factory/templates/_images.haml | 20 ---------
src/config/routes.rb | 2 +-
src/features/step_definitions/template_steps.rb | 6 ++-
src/features/support/paths.rb | 2 +-
src/features/template.feature | 13 ++++++
src/spec/factories/provider.rb | 8 ++++
10 files changed, 115 insertions(+), 33 deletions(-)
create mode 100644 src/app/views/image_factory/templates/_builds.haml
delete mode 100644 src/app/views/image_factory/templates/_images.haml
diff --git a/src/app/controllers/image_factory/builds_controller.rb b/src/app/controllers/image_factory/builds_controller.rb
index ac0a3e2..6d335df 100644
--- a/src/app/controllers/image_factory/builds_controller.rb
+++ b/src/app/controllers/image_factory/builds_controller.rb
@@ -38,12 +38,19 @@ class ImageFactory::BuildsController < ApplicationController
end
flash[:warning] = 'Warning: ' + warnings.join unless warnings.empty?
if errors.empty?
- redirect_to image_factory_template_path(@tpl, :details_tab => 'images')
+ redirect_to image_factory_template_path(@tpl, :details_tab => 'builds')
else
flash_error('Error while trying to build image', errors)
render :action => 'new'
end
end
+
+ def upload_or_delete
+ @tpl = Template.find(params[:template_id])
+ # FIXME: add logic to upload image
+ # or delete image depending on which button was used
+ redirect_to image_factory_template_path(@tpl, :details_tab => 'builds')
+ end
def edit
# FIXME: is @tpl defined here? do we need check_permission here?
diff --git a/src/app/controllers/image_factory/templates_controller.rb b/src/app/controllers/image_factory/templates_controller.rb
index 5f905fa..096a9c5 100644
--- a/src/app/controllers/image_factory/templates_controller.rb
+++ b/src/app/controllers/image_factory/templates_controller.rb
@@ -25,9 +25,9 @@ class ImageFactory::TemplatesController < ApplicationController
@tpl = Template.find(params[:id])
require_privilege(Privilege::VIEW, @tpl)
@url_params = params.clone
- @tab_captions = ['Properties', 'Images']
+ @tab_captions = ['Properties', 'Builds']
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
- load_images(@tpl) if @details_tab == 'images'
+ load_images(@tpl) if @details_tab == 'builds'
respond_to do |format|
format.js do
if @url_params.delete :details_pane
@@ -196,12 +196,41 @@ class ImageFactory::TemplatesController < ApplicationController
def load_images(tpl)
@images_header = [
- {:name => 'NAME', :sort_attr => 'templates.name'},
- {:name => 'OS', :sort_attr => 'templates.platform'},
- {:name => 'VERSION', :sort_attr => 'templates.platform_version'},
+ {:name => '', :sort_attr => 'select'},
{:name => 'ARCH', :sort_attr => 'templates.architecture'},
+ {:name => 'PROVIDER', :sort_attr => 'provider'},
{:name => 'STATUS', :sort_attr => 'status'},
- ]
+ {:name => 'UPLOADED?', :sort_attr => 'images.uploaded'},
+ ]
+ @imaged_provider_types = {}
+ @targets_not_built = {}
+ @target_build_status = {}
+
+ Provider.all.each do |p|
+ @targets_not_built[p.provider_type.id] = p.provider_type.name
+ end
+
+ tpl.images.each do |img|
+ @target_build_status[img.provider_type.name] = img.status
+ @targets_not_built.delete(img.provider_type_id)
+ img.provider_images.each do |pimg|
+ @imaged_provider_types[pimg.provider_id] = img.provider_type.id
+ end
+ end
+ @targets_not_built = @targets_not_built.invert
+
+ @providers_to_delete = {}
+ @providers_not_uploaded = Provider.find_all_by_provider_type_id((a)imaged_provider_types.values.uniq)
+ @providers_not_uploaded.each do |provider|
+ if @imaged_provider_types.has_key?(provider.id)
+ @providers_to_delete[provider] = provider
+ end
+ end
+
+ @providers_to_delete.keys.each do |p|
+ @providers_not_uploaded.delete(p)
+ end
+
@images = tpl.images
end
@@ -283,4 +312,3 @@ class ImageFactory::TemplatesController < ApplicationController
end
end
-
diff --git a/src/app/models/image.rb b/src/app/models/image.rb
index cfa15e4..dad94f3 100644
--- a/src/app/models/image.rb
+++ b/src/app/models/image.rb
@@ -83,7 +83,7 @@ class Image < ActiveRecord::Base
unless provider = Provider.find_by_target_with_account(target.id)
raise "There is no provider for '#{target.name}' type with valid account."
end
-
+
img = nil
Image.transaction do
img = Image.create!(
@@ -94,7 +94,7 @@ class Image < ActiveRecord::Base
)
ProviderImage.create!(
:image_id => img.id,
- :provider_id => provider
+ :provider_id => provider.id
)
end
return img
diff --git a/src/app/views/image_factory/templates/_builds.haml b/src/app/views/image_factory/templates/_builds.haml
new file mode 100644
index 0000000..f1a98c8
--- /dev/null
+++ b/src/app/views/image_factory/templates/_builds.haml
@@ -0,0 +1,42 @@
+Builds for
+= @tpl.platform
+= @tpl.platform_version
+, template "#{(a)tpl.name}"
+
+- form_tag(image_factory_builds_path, { :action => 'create', :method => :post }) do
+ = hidden_field_tag :template_id, @tpl.id
+ New Build for
+ = select( "targets", "", options_for_select(@targets_not_built))
+ = submit_tag "Go", :name => "build"
+
+- form_tag(upload_or_delete_image_factory_builds_path, { :action => "destroy", :method => :post }) do
+ = hidden_field_tag :template_id, @tpl.id
+ /= restful_submit_tag "Cancel Job", :name => "job_details", :disabled => true, :class => "icon"
+ /= restful_submit_tag "Show Job Details", :name => "job_details", :disabled => true, :class => "icon"
+ /= restful_submit_tag "Show Job Log", :name => "job_log", :disabled => true, :class => "icon"
+ /= restful_submit_tag "Clear Job History", :name => "job_history", :disabled => true, :class => "icon"
+ = submit_tag "Upload", :name => "upload"
+ = submit_tag "Delete", :name => "delete"
+
+ %table
+ = sortable_table_header(@images_header)
+ %tbody
+ - if @images.empty?
+ %tr
+ %td{:colspan => 5} No Builds
+ - else
+ - @images.each do |img|
+ - img.provider_images.each do |pimg|
+ %tr
+ %td= check_box_tag 'selected[]', pimg.provider_id, @url_params[:select] == 'all', :id => "selected_#{pimg.provider_id}"
+ %td= img.template.architecture
+ %td= pimg.provider.nil? ? '' : pimg.provider.name
+ %td= img.status
+ %td= pimg.uploaded? ? 'yes' : 'no'
+ - @providers_not_uploaded.each do |provider|
+ %tr
+ %td= check_box_tag 'selected[]', provider.id, @url_params[:select] == 'all', :id => "selected_#{provider.id}"
+ %td= @tpl.architecture
+ %td= provider.name
+ %td= @target_build_status[provider.provider_type]
+ %td no
\ No newline at end of file
diff --git a/src/app/views/image_factory/templates/_images.haml b/src/app/views/image_factory/templates/_images.haml
deleted file mode 100644
index 3fb1046..0000000
--- a/src/app/views/image_factory/templates/_images.haml
+++ /dev/null
@@ -1,20 +0,0 @@
-- form_tag :action => "" do
- /= restful_submit_tag "Cancel Job", :name => "job_details", :disabled => true, :class => "icon"
- /= restful_submit_tag "Show Job Details", :name => "job_details", :disabled => true, :class => "icon"
- /= restful_submit_tag "Show Job Log", :name => "job_log", :disabled => true, :class => "icon"
- /= restful_submit_tag "Clear Job History", :name => "job_history", :disabled => true, :class => "icon"
-
- %table
- = sortable_table_header(@images_header)
- %tbody
- - if @images.empty?
- %tr
- %td{:colspan => 5} No Images
- - else
- - @images.each do |img|
- %tr
- %td= img.template.name
- %td= img.template.platform
- %td= img.template.platform_version
- %td= img.template.architecture
- %td= img.status
diff --git a/src/config/routes.rb b/src/config/routes.rb
index c936726..b64713f 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -45,7 +45,7 @@ ActionController::Routing::Routes.draw do |map|
r.resources :assemblies
r.resources :deployables, :collection => { :multi_destroy => :delete }
r.resources :templates, :collection => {:collections => :get, :add_selected => :get, :metagroup_packages => :get, :remove_package => :get, :multi_destroy => :delete}
- r.resources :builds
+ r.resources :builds, :collection => { :upload_or_delete => :delete }
end
map.namespace 'admin' do |r|
diff --git a/src/features/step_definitions/template_steps.rb b/src/features/step_definitions/template_steps.rb
index 3491eb4..69a6928 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -91,7 +91,6 @@ end
When /^I choose this template$/ do
click_link((a)template.name)
end
-
Given /^there is Amazon AWS provider account$/ do
account = Factory.build(:ec2_provider_account)
account.save!
@@ -101,6 +100,11 @@ Given /^there is Amazon AWS build for this template$/ do
Image.build(@template, ProviderType.find_by_codename("ec2"))
end
+Given /^there is Amazon AWS provider with no builds$/ do
+ provider = Factory.build(:ec2_provider_no_builds)
+ provider.save!
+end
+
Given /^there is an imported template$/ do
@template = Factory.build :template, :name => name, :imported => true
@template.save!
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index c123cba..5af9b34 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -81,7 +81,7 @@ module NavigationHelpers
url_for new_build_path
when /the template builds page/
- url_for image_factory_template_path(@template, :details_tab => 'images')
+ url_for image_factory_template_path(@template, :details_tab => 'builds')
when /the templates page/
templates_path
diff --git a/src/features/template.feature b/src/features/template.feature
index 336b194..4fe8e9a 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -105,6 +105,19 @@ Feature: Manage Templates
# test that we see a collection (collections are loaded by default)
And I should see an input "conductor"
+ Scenario: See upload status
+ Given there is a "mock1" template
+ And there is Amazon AWS provider account
+ And there is Amazon AWS build for this template
+ And there is Amazon AWS provider with no builds
+ And I am on the image factory templates page
+ When I choose this template
+ And I follow "Builds"
+ Then I should see the following:
+ | ARCH | PROVIDERS | STATUS | UPLOADED? |
+ | x86_64 | amazon-ec2 | queued | no |
+ | x86_64 | amazon-ec2-no-builds | queued | no |
+
Scenario: Build template
Given there is a "mock1" template
And there is Amazon AWS provider account
diff --git a/src/spec/factories/provider.rb b/src/spec/factories/provider.rb
index 03f8773..34f3011 100644
--- a/src/spec/factories/provider.rb
+++ b/src/spec/factories/provider.rb
@@ -25,3 +25,11 @@ Factory.define :ec2_provider, :parent => :provider do |p|
p.hardware_profiles { |hp| [hp.association(:ec2_hwp1)] }
p.after_create { |p| p.realms << Factory(:realm4, :provider => p) }
end
+
+Factory.define :ec2_provider_no_builds, :parent => :provider do |p|
+ p.name 'amazon-ec2-no-builds'
+ p.provider_type { ProviderType.find_by_codename("ec2") }
+ p.url 'http://localhost:3002/api'
+ p.hardware_profiles { |hp| [hp.association(:ec2_hwp1)] }
+ p.after_create { |p| p.realms << Factory(:realm4, :provider => p) }
+end
--
1.7.4
12 years, 9 months
[PATCH aeolus docs] Updated post install doc for new HardwareProfiles
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
aeolusproject.org/content/conductor-use.mdown | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/aeolusproject.org/content/conductor-use.mdown b/aeolusproject.org/content/conductor-use.mdown
index d2d207e..6b2c45c 100644
--- a/aeolusproject.org/content/conductor-use.mdown
+++ b/aeolusproject.org/content/conductor-use.mdown
@@ -74,9 +74,19 @@ default value of 'unlimited'.
(Note that if you test the account settings before clicking 'Add' you'll need to re-select your x.509 cert files.)
+#### Create a Hardware Profile ####
+
+The next thing you need to do is to create a Hardware Profile. A Hardware Profile allows you to specify the minimum resource requirements for Memory, CPU and storage, and also what type of archtecture the your cloud instance should be.
+
+In order to create a hardware profile choose "Admin" from the main menu, then choose the subheading "Hardware Profiles". The first time you navigate to this page *no Hardware Profiles will be shown in the list. To create one click on the "New Hardware Profile" Button. This will take you to a form where you can fill in your minimum requirements for Memory, CPU, Storage and the type of architecture. Since we only support building of 64bit images (explained in the next section: "Create a Template"), be sure to to select "x86_64" for your architecture.
+
+Before you save your Hardware Profile you first need to check that there are some matching Hardware Profiles offered by your provider. To check to see if the provider you added in this example Amazon EC2, offers a Hardware Profile that satifies your given requirements, click on the "Check Matches" button. If a match was successful it will be shown in the lower window labelled "Matching Provider Hardware Profiles".
+
+Once you have a match you are ready to save. Be sure you give a name to your Hardware Profile by filling in the "Name" input box then click on the "Save" button. Your Hardware Profile will then be saved and you will be redirected back the "Hardware Profiles" page, where you can view and edit your Hardware Profile at a later date.
+
#### Create a Template ####
-Now that your pool contains a cloud provider, you need to create an image to
+Now that your pool contains a cloud provider and you have setup some Hardware Profiles, you need to create an image to
run an instance in your cloud. Please note that image building is currently
supported only on 64-bit versions of Fedora 13, the platform we use for
development and testing.
--
1.7.4
12 years, 9 months