You'll need to re-generate your data model after applying this patch.
Signed-off-by: Scott Seago sseago@redhat.com --- src/app/controllers/application_controller.rb | 2 +- src/app/controllers/cloud_accounts_controller.rb | 8 +- src/app/controllers/instance_controller.rb | 22 ++-- src/app/controllers/permissions_controller.rb | 4 +- src/app/controllers/pool_controller.rb | 117 +++++++++++++++++++ src/app/controllers/portal_pool_controller.rb | 117 ------------------- src/app/helpers/portal_pool_helper.rb | 23 ---- src/app/models/cloud_account.rb | 2 +- src/app/models/hardware_profile.rb | 12 +- src/app/models/image.rb | 14 +- src/app/models/instance.rb | 8 +- src/app/models/permission.rb | 2 +- src/app/models/pool.rb | 120 ++++++++++++++++++++ src/app/models/pool_account.rb | 4 +- src/app/models/portal_pool.rb | 120 -------------------- src/app/models/privilege.rb | 2 +- src/app/models/provider.rb | 4 +- src/app/models/quota.rb | 2 +- src/app/models/user.rb | 2 +- src/app/services/registration_service.rb | 4 +- src/app/views/instance/new.html.erb | 2 +- src/app/views/layouts/_main_nav.html.erb | 8 +- src/app/views/layouts/_navigation_tabs.rhtml | 2 +- src/app/views/pool/accounts.html.erb | 31 +++++ src/app/views/pool/accounts_for_pool.html.erb | 36 ++++++ src/app/views/pool/delete.html.erb | 2 + src/app/views/pool/hardware_profiles.html.erb | 1 + src/app/views/pool/images.html.erb | 20 ++++ src/app/views/pool/index.html.erb | 8 ++ src/app/views/pool/new.html.erb | 15 +++ src/app/views/pool/realms.html.erb | 1 + src/app/views/pool/show.html.erb | 43 +++++++ src/app/views/portal_pool/accounts.html.erb | 31 ----- .../views/portal_pool/accounts_for_pool.html.erb | 36 ------ src/app/views/portal_pool/delete.html.erb | 2 - .../views/portal_pool/hardware_profiles.html.erb | 1 - src/app/views/portal_pool/images.html.erb | 20 ---- src/app/views/portal_pool/index.html.erb | 8 -- src/app/views/portal_pool/new.html.erb | 15 --- src/app/views/portal_pool/realms.html.erb | 1 - src/app/views/portal_pool/show.html.erb | 43 ------- src/app/views/provider/new_account.html.erb | 2 +- src/app/views/provider/show.html.erb | 6 +- src/db/migrate/20090803141507_create_pools.rb | 39 +++++++ .../migrate/20090803141507_create_portal_pools.rb | 39 ------- .../20090804135630_create_hardware_profiles.rb | 2 +- src/db/migrate/20090804140143_create_images.rb | 2 +- src/db/migrate/20090804142049_create_instances.rb | 2 +- src/db/migrate/20091008153058_create_roles.rb | 8 +- .../migrate/20091215182906_create_pool_accounts.rb | 2 +- src/public/stylesheets/dcloud.css | 8 +- .../hardware_profiles_controller_spec.rb | 1 + src/spec/controllers/pool_controller_spec.rb | 61 ++++++++++ .../controllers/portal_pool_controller_spec.rb | 61 ---------- src/spec/controllers/provider_controller_spec.rb | 1 + src/spec/controllers/users_controller_spec.rb | 4 +- src/spec/factories/pool.rb | 9 ++ src/spec/factories/portal_pool.rb | 9 -- src/spec/fixtures/roles.yml | 8 +- src/spec/models/registration_service_spec.rb | 4 +- src/test/fixtures/instances.yml | 2 +- src/test/fixtures/permissions.yml | 2 +- src/test/fixtures/pool_accounts.yml | 2 +- src/test/fixtures/pools.yml | 6 + src/test/fixtures/portal_pools.yml | 6 - src/test/fixtures/roles.yml | 8 +- src/test/unit/pool_test.rb | 8 ++ src/test/unit/portal_pool_test.rb | 8 -- 68 files changed, 602 insertions(+), 623 deletions(-) create mode 100644 src/app/controllers/pool_controller.rb delete mode 100644 src/app/controllers/portal_pool_controller.rb delete mode 100644 src/app/helpers/portal_pool_helper.rb create mode 100644 src/app/models/pool.rb delete mode 100644 src/app/models/portal_pool.rb create mode 100644 src/app/views/pool/accounts.html.erb create mode 100644 src/app/views/pool/accounts_for_pool.html.erb create mode 100644 src/app/views/pool/delete.html.erb create mode 100644 src/app/views/pool/hardware_profiles.html.erb create mode 100644 src/app/views/pool/images.html.erb create mode 100644 src/app/views/pool/index.html.erb create mode 100644 src/app/views/pool/new.html.erb create mode 100644 src/app/views/pool/realms.html.erb create mode 100644 src/app/views/pool/show.html.erb delete mode 100644 src/app/views/portal_pool/accounts.html.erb delete mode 100644 src/app/views/portal_pool/accounts_for_pool.html.erb delete mode 100644 src/app/views/portal_pool/delete.html.erb delete mode 100644 src/app/views/portal_pool/hardware_profiles.html.erb delete mode 100644 src/app/views/portal_pool/images.html.erb delete mode 100644 src/app/views/portal_pool/index.html.erb delete mode 100644 src/app/views/portal_pool/new.html.erb delete mode 100644 src/app/views/portal_pool/realms.html.erb delete mode 100644 src/app/views/portal_pool/show.html.erb create mode 100644 src/db/migrate/20090803141507_create_pools.rb delete mode 100644 src/db/migrate/20090803141507_create_portal_pools.rb create mode 100644 src/spec/controllers/pool_controller_spec.rb delete mode 100644 src/spec/controllers/portal_pool_controller_spec.rb create mode 100644 src/spec/factories/pool.rb delete mode 100644 src/spec/factories/portal_pool.rb create mode 100644 src/test/fixtures/pools.yml delete mode 100644 src/test/fixtures/portal_pools.yml create mode 100644 src/test/unit/pool_test.rb delete mode 100644 src/test/unit/portal_pool_test.rb
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb index a71f53d..9ce3388 100644 --- a/src/app/controllers/application_controller.rb +++ b/src/app/controllers/application_controller.rb @@ -50,7 +50,7 @@ class ApplicationController < ActionController::Base def get_nav_items if !current_user.nil? @providers = Provider.list_for_user(@current_user, Privilege::PROVIDER_VIEW) - @pools = PortalPool.list_for_user(@current_user, Privilege::POOL_VIEW) + @pools = Pool.list_for_user(@current_user, Privilege::POOL_VIEW) end end
diff --git a/src/app/controllers/cloud_accounts_controller.rb b/src/app/controllers/cloud_accounts_controller.rb index c20eb66..26c1a63 100644 --- a/src/app/controllers/cloud_accounts_controller.rb +++ b/src/app/controllers/cloud_accounts_controller.rb @@ -32,7 +32,7 @@ class CloudAccountsController < ApplicationController end
def new_from_pool - @pool = PortalPool.find(params[:pool_id]) + @pool = Pool.find(params[:pool_id]) require_privilege(Privilege::ACCOUNT_ADD,@pool) @cloud_account = CloudAccount.new @providers = Provider.all @@ -48,9 +48,9 @@ class CloudAccountsController < ApplicationController end
def create_from_pool - @pool = PortalPool.find(params[:pool][:id]) + @pool = Pool.find(params[:pool][:id]) require_privilege(Privilege::ACCOUNT_ADD,@pool) - PortalPool.transaction do + Pool.transaction do @cloud_account = CloudAccount.new(params[:cloud_account]) @provider = Provider.find(params[:provider][:id]) @cloud_account.provider = @provider @@ -63,7 +63,7 @@ class CloudAccountsController < ApplicationController :permission_object => @cloud_account) perm.save! end - redirect_to :controller => "portal_pool", :action => 'show', :id => @pool.id + redirect_to :controller => "pool", :action => 'show', :id => @pool.id end
diff --git a/src/app/controllers/instance_controller.rb b/src/app/controllers/instance_controller.rb index ffe388c..0008c06 100644 --- a/src/app/controllers/instance_controller.rb +++ b/src/app/controllers/instance_controller.rb @@ -27,19 +27,19 @@ class InstanceController < ApplicationController def index end
- # Right now this is essentially a duplicate of PortalPoolController#show, + # Right now this is essentially a duplicate of PoolController#show, # but really it should be a single instance should we decide to have a page # for that. Redirect on create was all that brought you here anyway, so # should be unused for the moment. def show - @instances = Instance.find(:all, :conditions => {:portal_pool_id => params[:id]}) - @pool = PortalPool.find(params[:id]) + @instances = Instance.find(:all, :conditions => {:pool_id => params[:id]}) + @pool = Pool.find(params[:id]) require_privilege(Privilege::INSTANCE_VIEW,@pool) end
def new - @instance = Instance.new({:portal_pool_id => params[:id]}) - @pool = PortalPool.find(params[:id]) + @instance = Instance.new({:pool_id => params[:id]}) + @pool = Pool.find(params[:id]) require_privilege(Privilege::INSTANCE_MODIFY,@pool) end
@@ -47,7 +47,7 @@ class InstanceController < ApplicationController @instance = Instance.new(params[:instance]) @instance.state = Instance::STATE_NEW require_privilege(Privilege::INSTANCE_MODIFY, - PortalPool.find(@instance.portal_pool_id)) + Pool.find(@instance.pool_id)) #FIXME: This should probably be in a transaction if @instance.save
@@ -58,13 +58,13 @@ class InstanceController < ApplicationController task_impl = Taskomatic.new(@task,logger) task_impl.instance_create flash[:notice] = "Instance added." - redirect_to :controller => "portal_pool", :action => 'show', :id => @instance.portal_pool_id + redirect_to :controller => "pool", :action => 'show', :id => @instance.pool_id else - @pool = @instance.portal_pool + @pool = @instance.pool render :action => 'new' end else - @pool = PortalPool.find(@instance.portal_pool_id) + @pool = Pool.find(@instance.pool_id) render :action => 'new' end end @@ -73,7 +73,7 @@ class InstanceController < ApplicationController action = params[:instance_action] action_args = params[:action_data] @instance = Instance.find(params[:id]) - require_privilege(Privilege::INSTANCE_CONTROL,@instance.portal_pool) + require_privilege(Privilege::INSTANCE_CONTROL,@instance.pool) unless @instance.valid_action?(action) raise ActionError.new("#{action} is an invalid action.") end @@ -88,7 +88,7 @@ class InstanceController < ApplicationController
alert = "#{@instance.name}: #{action} was successfully queued." flash[:notice] = alert - redirect_to :controller => "portal_pool", :action => 'show', :id => @instance.portal_pool_id + redirect_to :controller => "pool", :action => 'show', :id => @instance.pool_id end
def delete diff --git a/src/app/controllers/permissions_controller.rb b/src/app/controllers/permissions_controller.rb index cca8061..9d9b2a9 100644 --- a/src/app/controllers/permissions_controller.rb +++ b/src/app/controllers/permissions_controller.rb @@ -67,8 +67,8 @@ class PermissionsController < ApplicationController if !params[:permission_object_type].nil? @permission_object = params[:permission_object_type].constantize.find(params[:permission_object_id]) - elsif !params[:portal_pool_id].nil? - @permission_object = PortalPool.find params[:portal_pool_id] + elsif !params[:pool_id].nil? + @permission_object = Pool.find params[:pool_id] elsif !params[:provider_id].nil? @permission_object = Provider.find params[:provider_id] elsif !params[:cloud_account_id].nil? diff --git a/src/app/controllers/pool_controller.rb b/src/app/controllers/pool_controller.rb new file mode 100644 index 0000000..1fabc2f --- /dev/null +++ b/src/app/controllers/pool_controller.rb @@ -0,0 +1,117 @@ +# +# Copyright (C) 2009 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. + +require 'util/taskomatic' + +class PoolController < ApplicationController + before_filter :require_user + + def index + render :action => 'new' + end + + def show + #FIXME: clean this up, many error cases here + @pool = Pool.find(params[:id]) + require_privilege(Privilege::INSTANCE_VIEW,@pool) + # pass nil into Taskomatic as we're not working off a task here + Taskomatic.new(nil,logger).pool_refresh(@pool) + @pool.reload + @instances = @pool.instances + end + + def hardware_profiles + @pool = Pool.find(params[:id]) + @hardware_profiles = @pool.hardware_profiles + require_privilege(Privilege::POOL_VIEW, @pool) + end + + def accounts + @pool = Pool.find(params[:id]) + require_privilege(Privilege::ACCOUNT_VIEW,@pool) + end + + def realms + @pool = Pool.find(params[:id]) + @realm_names = @pool.realms + require_privilege(Privilege::POOL_VIEW,@pool) + end + + def new + require_privilege(Privilege::POOL_MODIFY) + @pool = Pool.new + @account = CloudAccount.new + end + + def create + require_privilege(Privilege::POOL_MODIFY) + + #FIXME: owner is set to current user for self-service account creation, + # but in the more general case we need a way for the admin to pick + # a user + params[:pool][:owner_id] = @current_user.id + + #FIXME: This should probably be in a transaction + @pool = Pool.new(params[:pool]) + perm = Permission.new(:user => @pool.owner, + :role => Role.find_by_name("Instance Creator and User"), + :permission_object => @pool) + perm.save! + # FIXME: do we need any more handling around save failures? What if perm + # creation fails? + flash[:notice] = "Pool added." + redirect_to :action => 'show', :id => @pool.id + end + + def delete + end + + + def images + @pool = Pool.find(params[:pool]) + require_privilege(Privilege::POOL_VIEW, @pool) + end + + def accounts_for_pool + @pool = Pool.find(params[:pool_id]) + require_privilege(Privilege::ACCOUNT_VIEW,@pool) + @cloud_accounts = [] + all_accounts = CloudAccount.list_for_user(@current_user, Privilege::ACCOUNT_ADD) + all_accounts.each {|account| + @cloud_accounts << account unless @pool.cloud_accounts.map{|x| x.id}.include?(account.id) + } + end + + def add_account + @pool = Pool.find(params[:pool]) + @cloud_account = CloudAccount.find(params[:cloud_account]) + require_privilege(Privilege::ACCOUNT_ADD,@pool) + require_privilege(Privilege::ACCOUNT_ADD,@cloud_account) + Pool.transaction do + @pool.cloud_accounts << @cloud_account unless @pool.cloud_accounts.map{|x| x.id}.include?(@cloud_account.id) + @pool.save! + @pool.populate_realms_and_images([@cloud_account]) + end + redirect_to :action => 'show', :id => @pool.id + end + + +end diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb deleted file mode 100644 index 69208fa..0000000 --- a/src/app/controllers/portal_pool_controller.rb +++ /dev/null @@ -1,117 +0,0 @@ -# -# Copyright (C) 2009 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. - -require 'util/taskomatic' - -class PortalPoolController < ApplicationController - before_filter :require_user - - def index - render :action => 'new' - end - - def show - #FIXME: clean this up, many error cases here - @pool = PortalPool.find(params[:id]) - require_privilege(Privilege::INSTANCE_VIEW,@pool) - # pass nil into Taskomatic as we're not working off a task here - Taskomatic.new(nil,logger).pool_refresh(@pool) - @pool.reload - @instances = @pool.instances - end - - def hardware_profiles - @pool = PortalPool.find(params[:id]) - @hardware_profiles = @pool.hardware_profiles - require_privilege(Privilege::POOL_VIEW, @pool) - end - - def accounts - @pool = PortalPool.find(params[:id]) - require_privilege(Privilege::ACCOUNT_VIEW,@pool) - end - - def realms - @pool = PortalPool.find(params[:id]) - @realm_names = @pool.realms - require_privilege(Privilege::POOL_VIEW,@pool) - end - - def new - require_privilege(Privilege::POOL_MODIFY) - @portal_pool = PortalPool.new - @account = CloudAccount.new - end - - def create - require_privilege(Privilege::POOL_MODIFY) - - #FIXME: owner is set to current user for self-service account creation, - # but in the more general case we need a way for the admin to pick - # a user - params[:portal_pool][:owner_id] = @current_user.id - - #FIXME: This should probably be in a transaction - @portal_pool = PortalPool.new(params[:portal_pool]) - perm = Permission.new(:user => @portal_pool.owner, - :role => Role.find_by_name("Instance Creator and User"), - :permission_object => @portal_pool) - perm.save! - # FIXME: do we need any more handling around save failures? What if perm - # creation fails? - flash[:notice] = "Pool added." - redirect_to :action => 'show', :id => @portal_pool.id - end - - def delete - end - - - def images - @pool = PortalPool.find(params[:portal_pool]) - require_privilege(Privilege::POOL_VIEW, @pool) - end - - def accounts_for_pool - @pool = PortalPool.find(params[:pool_id]) - require_privilege(Privilege::ACCOUNT_VIEW,@pool) - @cloud_accounts = [] - all_accounts = CloudAccount.list_for_user(@current_user, Privilege::ACCOUNT_ADD) - all_accounts.each {|account| - @cloud_accounts << account unless @pool.cloud_accounts.map{|x| x.id}.include?(account.id) - } - end - - def add_account - @portal_pool = PortalPool.find(params[:portal_pool]) - @cloud_account = CloudAccount.find(params[:cloud_account]) - require_privilege(Privilege::ACCOUNT_ADD,@portal_pool) - require_privilege(Privilege::ACCOUNT_ADD,@cloud_account) - PortalPool.transaction do - @portal_pool.cloud_accounts << @cloud_account unless @portal_pool.cloud_accounts.map{|x| x.id}.include?(@cloud_account.id) - @portal_pool.save! - @portal_pool.populate_realms_and_images([@cloud_account]) - end - redirect_to :action => 'show', :id => @portal_pool.id - end - - -end diff --git a/src/app/helpers/portal_pool_helper.rb b/src/app/helpers/portal_pool_helper.rb deleted file mode 100644 index a621ae5..0000000 --- a/src/app/helpers/portal_pool_helper.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2009 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. - -module PortalPoolHelper -end diff --git a/src/app/models/cloud_account.rb b/src/app/models/cloud_account.rb index da7e8dd..62cecc3 100644 --- a/src/app/models/cloud_account.rb +++ b/src/app/models/cloud_account.rb @@ -23,7 +23,7 @@ class CloudAccount < ActiveRecord::Base include PermissionedObject belongs_to :provider has_many :pool_accounts, :dependent => :destroy - has_many :portal_pools, :through => :pool_accounts + has_many :pools, :through => :pool_accounts has_many :instances
# what form does the account quota take? diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb index 7714acb..b65fc24 100644 --- a/src/app/models/hardware_profile.rb +++ b/src/app/models/hardware_profile.rb @@ -24,7 +24,7 @@ class HardwareProfile < ActiveRecord::Base has_many :provider_instances, :class_name => "Instance", :foreign_key => "provider_hardware_profile_id" belongs_to :provider - belongs_to :portal_pool + belongs_to :pool
has_and_belongs_to_many :aggregator_hardware_profiles, :class_name => "HardwareProfile", @@ -39,7 +39,7 @@ class HardwareProfile < ActiveRecord::Base :association_foreign_key => "provider_hardware_profile_id"
validates_presence_of :external_key - validates_uniqueness_of :external_key, :scope => [:provider_id, :portal_pool_id] + validates_uniqueness_of :external_key, :scope => [:provider_id, :pool_id]
validates_presence_of :name
@@ -51,7 +51,7 @@ class HardwareProfile < ActiveRecord::Base validates_presence_of :architecture, :if => :provider
def validate - if (provider.nil? and portal_pool.nil?) + if (provider.nil? and pool.nil?) if !aggregator_hardware_profiles.empty? errors.add(:aggregator_hardware_profiles, "Aggregator profiles are not allowed for custom Instance profiles") @@ -60,15 +60,15 @@ class HardwareProfile < ActiveRecord::Base errors.add(:provider_hardware_profiles, "Provider profiles are not allowed for custom Instance profiles") end - elsif (!provider.nil? and !portal_pool.nil?) + elsif (!provider.nil? and !pool.nil?) errors.add(:provider, "provider or pool must be blank") - errors.add(:portal_pool, "provider or pool must be blank") + errors.add(:pool, "provider or pool must be blank") elsif provider.nil? if !provider_hardware_profiles.empty? errors.add(:provider_hardware_profiles, "Provider profiles only allowed for provider profiles") end - elsif portal_pool.nil? + elsif pool.nil? if !aggregator_hardware_profiles.empty? errors.add(:aggregator_hardware_profiles, "Aggregator profiles only allowed for pool profiles") diff --git a/src/app/models/image.rb b/src/app/models/image.rb index 894d4b3..3936bd6 100644 --- a/src/app/models/image.rb +++ b/src/app/models/image.rb @@ -22,7 +22,7 @@ class Image < ActiveRecord::Base has_many :instances belongs_to :provider - belongs_to :portal_pool + belongs_to :pool
has_and_belongs_to_many :aggregator_images, :class_name => "Image", @@ -37,25 +37,25 @@ class Image < ActiveRecord::Base :association_foreign_key => "provider_image_id"
validates_presence_of :external_key - validates_uniqueness_of :external_key, :scope => [:provider_id, :portal_pool_id] + validates_uniqueness_of :external_key, :scope => [:provider_id, :pool_id]
validates_presence_of :name
validates_presence_of :architecture, :if => :provider
def validate - if (provider.nil? and portal_pool.nil?) + if (provider.nil? and pool.nil?) errors.add(:provider, "provider or pool must be specified") - errors.add(:portal_pool, "provider or pool must be specified") - elsif (!provider.nil? and !portal_pool.nil?) + errors.add(:pool, "provider or pool must be specified") + elsif (!provider.nil? and !pool.nil?) errors.add(:provider, "provider or pool must be blank") - errors.add(:portal_pool, "provider or pool must be blank") + errors.add(:pool, "provider or pool must be blank") elsif provider.nil? if !aggregator_images.empty? errors.add(:aggregator_images, "Aggregator image only allowed for provider images") end - elsif portal_pool.nil? + elsif pool.nil? if !provider_images.empty? errors.add(:provider_images, "Provider images only allowed for aggregator images") diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index 453680d..902a458 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -20,24 +20,24 @@ # Likewise, all the methods added will be available for all controllers.
class Instance < ActiveRecord::Base - belongs_to :portal_pool + belongs_to :pool belongs_to :cloud_account
belongs_to :hardware_profile belongs_to :image belongs_to :realm
- validates_presence_of :portal_pool_id + validates_presence_of :pool_id validates_presence_of :hardware_profile_id validates_presence_of :image_id
#validates_presence_of :external_key # TODO: can we do uniqueness validation on indirect association - # -- portal_pool.account.provider + # -- pool.account.provider #validates_uniqueness_of :external_key, :scope => :provider_id
validates_presence_of :name - validates_uniqueness_of :name, :scope => :portal_pool_id + validates_uniqueness_of :name, :scope => :pool_id
# FIXME: for now, hardware profile is required, realm is optional, although for RHEV-M, # hardware profile may be optional too diff --git a/src/app/models/permission.rb b/src/app/models/permission.rb index 2df3f2f..c77061f 100644 --- a/src/app/models/permission.rb +++ b/src/app/models/permission.rb @@ -29,7 +29,7 @@ class Permission < ActiveRecord::Base
belongs_to :permission_object, :polymorphic => true # type-specific associations - belongs_to :portal_pool, :class_name => "PortalPool", + belongs_to :pool, :class_name => "Pool", :foreign_key => "permission_object_id" belongs_to :provider, :class_name => "Provider", :foreign_key => "permission_object_id" diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb new file mode 100644 index 0000000..c97e03f --- /dev/null +++ b/src/app/models/pool.rb @@ -0,0 +1,120 @@ +# +# Copyright (C) 2009 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 Pool < ActiveRecord::Base + include PermissionedObject + has_many :pool_accounts, :dependent => :destroy + has_many :cloud_accounts, :through => :pool_accounts + has_many :instances, :dependent => :destroy + belongs_to :owner, :class_name => "User", :foreign_key => "owner_id" + + has_many :images, :dependent => :destroy + has_many :hardware_profiles, :dependent => :destroy + + + + validates_presence_of :owner_id + validates_presence_of :name + validates_uniqueness_of :name, :scope => :owner_id + validates_uniqueness_of :exported_as, :if => :exported_as + + has_many :permissions, :as => :permission_object, :dependent => :destroy, + :include => [:role], + :order => "permissions.id ASC" + + def realms + realm_list = [] + cloud_accounts.each do |cloud_account| + prefix = cloud_account.account_prefix_for_realm + realm_list << prefix + cloud_account.provider.realms.each do |realm| + realm_list << prefix + Realm::AGGREGATOR_REALM_ACCOUNT_DELIMITER + + realm.name + end + end + realm_list + end + + # FIXME: for already-mapped accounts, update rather than add new + def populate_realms_and_images(accounts=cloud_accounts) + accounts.each do |cloud_account| + client = cloud_account.connect + realms = client.realms + if client.driver_name == "ec2" + images = client.images(:owner_id=>:self) + else + images = client.images + end + # FIXME: this should probably be in the same transaction as pool.save + self.transaction do + realms.each do |realm| + #ignore if it exists + #FIXME: we need to handle keeping in sync forupdates as well as + # account permissions + unless Realm.find_by_external_key_and_provider_id(realm.id, + cloud_account.provider.id) + ar_realm = Realm.new(:external_key => realm.id, + :name => realm.name ? realm.name : realm.id, + :provider_id => cloud_account.provider.id) + ar_realm.save! + end + end + images.each do |image| + #ignore if it exists + #FIXME: we need to handle keeping in sync for updates as well as + # account permissions + ar_image = Image.find_by_external_key_and_provider_id(image.id, + cloud_account.provider.id) + unless ar_image + ar_image = Image.new(:external_key => image.id, + :name => image.name ? image.name : + (image.description ? image.description : + image.id), + :architecture => image.architecture, + :provider_id => cloud_account.provider.id) + ar_image.save! + end + front_end_image = Image.new(:external_key => + cloud_account.account_prefix_for_realm + + Realm::AGGREGATOR_REALM_ACCOUNT_DELIMITER + + ar_image.external_key, + :name => ar_image.name, + :architecture => ar_image.architecture, + :pool_id => id) + front_end_image.save! + end + cloud_account.provider.hardware_profiles.each do |hardware_profile| + front_hardware_profile = HardwareProfile.new(:external_key => + cloud_account.account_prefix_for_realm + + hardware_profile.external_key, + :name => hardware_profile.name, + :memory => hardware_profile.memory, + :storage => hardware_profile.storage, + :architecture => hardware_profile.architecture, + :pool_id => id) + front_hardware_profile.save! + end + end + end + end + + +end diff --git a/src/app/models/pool_account.rb b/src/app/models/pool_account.rb index 2ba8de7..1bb5429 100644 --- a/src/app/models/pool_account.rb +++ b/src/app/models/pool_account.rb @@ -20,10 +20,10 @@ # Likewise, all the methods added will be available for all controllers. class PoolAccount < ActiveRecord::Base belongs_to :cloud_account - belongs_to :portal_pool + belongs_to :pool belongs_to :quota
validates_presence_of :cloud_account_id - validates_presence_of :portal_pool_id + validates_presence_of :pool_id
end diff --git a/src/app/models/portal_pool.rb b/src/app/models/portal_pool.rb deleted file mode 100644 index 62cc903..0000000 --- a/src/app/models/portal_pool.rb +++ /dev/null @@ -1,120 +0,0 @@ -# -# Copyright (C) 2009 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 PortalPool < ActiveRecord::Base - include PermissionedObject - has_many :pool_accounts, :dependent => :destroy - has_many :cloud_accounts, :through => :pool_accounts - has_many :instances, :dependent => :destroy - belongs_to :owner, :class_name => "User", :foreign_key => "owner_id" - - has_many :images, :dependent => :destroy - has_many :hardware_profiles, :dependent => :destroy - - - - validates_presence_of :owner_id - validates_presence_of :name - validates_uniqueness_of :name, :scope => :owner_id - validates_uniqueness_of :exported_as, :if => :exported_as - - has_many :permissions, :as => :permission_object, :dependent => :destroy, - :include => [:role], - :order => "permissions.id ASC" - - def realms - realm_list = [] - cloud_accounts.each do |cloud_account| - prefix = cloud_account.account_prefix_for_realm - realm_list << prefix - cloud_account.provider.realms.each do |realm| - realm_list << prefix + Realm::AGGREGATOR_REALM_ACCOUNT_DELIMITER + - realm.name - end - end - realm_list - end - - # FIXME: for already-mapped accounts, update rather than add new - def populate_realms_and_images(accounts=cloud_accounts) - accounts.each do |cloud_account| - client = cloud_account.connect - realms = client.realms - if client.driver_name == "ec2" - images = client.images(:owner_id=>:self) - else - images = client.images - end - # FIXME: this should probably be in the same transaction as portal_pool.save - self.transaction do - realms.each do |realm| - #ignore if it exists - #FIXME: we need to handle keeping in sync forupdates as well as - # account permissions - unless Realm.find_by_external_key_and_provider_id(realm.id, - cloud_account.provider.id) - ar_realm = Realm.new(:external_key => realm.id, - :name => realm.name ? realm.name : realm.id, - :provider_id => cloud_account.provider.id) - ar_realm.save! - end - end - images.each do |image| - #ignore if it exists - #FIXME: we need to handle keeping in sync for updates as well as - # account permissions - ar_image = Image.find_by_external_key_and_provider_id(image.id, - cloud_account.provider.id) - unless ar_image - ar_image = Image.new(:external_key => image.id, - :name => image.name ? image.name : - (image.description ? image.description : - image.id), - :architecture => image.architecture, - :provider_id => cloud_account.provider.id) - ar_image.save! - end - front_end_image = Image.new(:external_key => - cloud_account.account_prefix_for_realm + - Realm::AGGREGATOR_REALM_ACCOUNT_DELIMITER + - ar_image.external_key, - :name => ar_image.name, - :architecture => ar_image.architecture, - :portal_pool_id => id) - front_end_image.save! - end - cloud_account.provider.hardware_profiles.each do |hardware_profile| - front_hardware_profile = HardwareProfile.new(:external_key => - cloud_account.account_prefix_for_realm + - hardware_profile.external_key, - :name => hardware_profile.name, - :memory => hardware_profile.memory, - :storage => hardware_profile.storage, - :architecture => hardware_profile.architecture, - :portal_pool_id => id) - front_hardware_profile.save! - end - end - end - end - - -end diff --git a/src/app/models/privilege.rb b/src/app/models/privilege.rb index 69f22b9..9e085c4 100644 --- a/src/app/models/privilege.rb +++ b/src/app/models/privilege.rb @@ -62,7 +62,7 @@ class Privilege < ActiveRecord::Base
# quota privileges normally checked at the pool or account level, # depending on which quota level we're dealing with - # (account level for cloud-imposed quota, pool level for portal quota) + # (account level for cloud-imposed quota, pool level for aggregator quota) QUOTA_MODIFY = "quota_modify" # can create or modify a quota QUOTA_VIEW = "quota_view" # can view a quota
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb index 70051e5..e45b8cc 100644 --- a/src/app/models/provider.rb +++ b/src/app/models/provider.rb @@ -65,8 +65,8 @@ class Provider < ActiveRecord::Base end end
- def portal_pools - cloud_accounts.collect {|account| account.portal_pools}.flatten + def pools + cloud_accounts.collect {|account| account.pools}.flatten end
# TODO: implement or remove - this is meant to contain a hash of diff --git a/src/app/models/quota.rb b/src/app/models/quota.rb index 28d1943..21205b5 100644 --- a/src/app/models/quota.rb +++ b/src/app/models/quota.rb @@ -20,6 +20,6 @@ # Likewise, all the methods added will be available for all controllers.
class Quota < ActiveRecord::Base - has_one :portal_pool + has_one :pool has_one :pool_account end diff --git a/src/app/models/user.rb b/src/app/models/user.rb index 3e20689..b08d03d 100644 --- a/src/app/models/user.rb +++ b/src/app/models/user.rb @@ -23,5 +23,5 @@ class User < ActiveRecord::Base acts_as_authentic
has_many :permissions - has_many :owned_pools, :class_name => "PortalPool", :foreign_key => "owner_id" + has_many :owned_pools, :class_name => "Pool", :foreign_key => "owner_id" end diff --git a/src/app/services/registration_service.rb b/src/app/services/registration_service.rb index 2ced83d..e414c6a 100644 --- a/src/app/services/registration_service.rb +++ b/src/app/services/registration_service.rb @@ -9,10 +9,10 @@ class RegistrationService begin User.transaction do @user.save! - @portal_pool = PortalPool.create!({ :name => @user.login, :owner => @user}) + @pool = Pool.create!({ :name => @user.login, :owner => @user}) Permission.create!({:user => @user, :role => Role.find_by_name("Self-service Pool User"), - :permission_object => @portal_pool}) + :permission_object => @pool}) end rescue false diff --git a/src/app/views/instance/new.html.erb b/src/app/views/instance/new.html.erb index 1ca2024..986959a 100644 --- a/src/app/views/instance/new.html.erb +++ b/src/app/views/instance/new.html.erb @@ -23,7 +23,7 @@ </li> <% end %> </ul> - <%= hidden_field :instance, :portal_pool_id %> + <%= hidden_field :instance, :pool_id %> <%= submit_tag "Save", :class => "submit" %> <% end %> </div> diff --git a/src/app/views/layouts/_main_nav.html.erb b/src/app/views/layouts/_main_nav.html.erb index 4fe81fd..0e14f4a 100644 --- a/src/app/views/layouts/_main_nav.html.erb +++ b/src/app/views/layouts/_main_nav.html.erb @@ -1,6 +1,6 @@ <%=link_to "Add a provider", {:controller => "provider", :action => "new"}, :class => "actionlink" %>
-<%=link_to "Add a pool", {:controller => "portal_pool", :action => "new"}, :class => "actionlink" %> +<%=link_to "Add a pool", {:controller => "pool", :action => "new"}, :class => "actionlink" %>
<%= link_to "Add a user", {:controller => "users", :action => "new"}, :class=>"actionlink" if has_user_modify?(BasePortalObject.general_permission_scope) %> <%= link_to "User access", {:controller => "permissions", :action => "list"}, :class=>"actionlink" if has_view_perms?(BasePortalObject.general_permission_scope) %> @@ -23,15 +23,15 @@ <% end %> </ul> <h3>Pools</h3> -<ul id="portal_pools"> +<ul id="pools"> <% if !@pools.nil? %> <% @pools.each { |pool| %> - <% if controller.controller_name == "portal_pool" && pool.id == cur_id + <% if controller.controller_name == "pool" && pool.id == cur_id selected_pool = "selected" else selected_pool = "" end %> <li><%= link_to pool.name, - {:controller => "portal_pool", :action => "show", :id => pool}, + {:controller => "pool", :action => "show", :id => pool}, :class => "poolname #{selected_pool}" %></li> <% } %> <% end %> diff --git a/src/app/views/layouts/_navigation_tabs.rhtml b/src/app/views/layouts/_navigation_tabs.rhtml index 2791132..fd51d52 100644 --- a/src/app/views/layouts/_navigation_tabs.rhtml +++ b/src/app/views/layouts/_navigation_tabs.rhtml @@ -1,5 +1,5 @@ <% if 1 ==2 %> -<% if controller.controller_name == "portal_pool" %> +<% if controller.controller_name == "pool" %> <script> $(document).ready(function(){ $tabs = $("#hardware_nav_tabs").tabs({ diff --git a/src/app/views/pool/accounts.html.erb b/src/app/views/pool/accounts.html.erb new file mode 100644 index 0000000..907c27b --- /dev/null +++ b/src/app/views/pool/accounts.html.erb @@ -0,0 +1,31 @@ +<% if @pool.cloud_accounts.size == 0 %> +<h1>There are no accounts to display</h1> +<% else %> + <table> + <thead> + <tr> + <th scope="col">Provider</th> + <th scope="col">Username</th> + <th scope="col">Actions</th> + </tr> + </thead> + <tbody> + <%@pool.cloud_accounts.each {|account| %> + <tr> + <td><%= account.provider.name %></td> + <td><%= account.username %></td> + <td> + <%= link_to "User access", + {:controller => "permissions", + :action => "list", + :cloud_account_id => account.id}, + :class=>"actionlink" if has_view_perms?(account) %> + </td> + </tr> + <% } %> + </tbody> + </table> +<% end %> +<%= link_to "View/Add Existing Cloud Accounts", {:controller => "pool",:action => "accounts_for_pool", :pool_id => @pool}, :class=>"actionlink" %> +<%= link_to "Add a New Cloud Account", {:controller => "cloud_accounts",:action => "new_from_pool", :pool_id => @pool}, :class=>"actionlink" %><br/> + diff --git a/src/app/views/pool/accounts_for_pool.html.erb b/src/app/views/pool/accounts_for_pool.html.erb new file mode 100644 index 0000000..fc4e5cb --- /dev/null +++ b/src/app/views/pool/accounts_for_pool.html.erb @@ -0,0 +1,36 @@ +<% if @pool.cloud_accounts.size > 0 %> +<h1>These Cloud Accounts are already attached to this pool</h1> +<table> +<thead> +<tr> +<th scope="col">Provider Name</th> +<th scope="col">Cloud Account User Name</th> +</tr> +<% @pool.cloud_accounts.each {|a| %> +<tr> +<td><%= a.provider.name %></td> +<td><%= a.username %></td> +</tr> +<% } %> +</table> +<% end %> + +<% if @cloud_accounts.size == 0 %> +<h1>There are no existing Cloud Accounts available to add</h1> +<% else %> +<h1>These Cloud Accounts are available to add</h1> +<table> +<thead> +<tr> +<th scope="col">Provider Name</th> +<th scope="col">Cloud Account User Name</th> +</tr> +<% @cloud_accounts.each {|a| %> +<tr> +<td><%= a.provider.name %></td> +<td><%= a.username %> <%= link_to "Add this account", {:controller=> "pool", + :action => "add_account", :pool => @pool, :cloud_account => a}, :class => "actionlink" %></td> +</tr> +<% } %> +</table> +<% end %> diff --git a/src/app/views/pool/delete.html.erb b/src/app/views/pool/delete.html.erb new file mode 100644 index 0000000..b21ec14 --- /dev/null +++ b/src/app/views/pool/delete.html.erb @@ -0,0 +1,2 @@ +<h1>ProviderController#delete</h1> +<p>Find me in app/views/provider_controller/delete.html.erb</p> diff --git a/src/app/views/pool/hardware_profiles.html.erb b/src/app/views/pool/hardware_profiles.html.erb new file mode 100644 index 0000000..579d796 --- /dev/null +++ b/src/app/views/pool/hardware_profiles.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'hardware_profiles/list' %> diff --git a/src/app/views/pool/images.html.erb b/src/app/views/pool/images.html.erb new file mode 100644 index 0000000..e0187a8 --- /dev/null +++ b/src/app/views/pool/images.html.erb @@ -0,0 +1,20 @@ +<% if @pool.images.size == 0 %> +<h1>There are no images to display</h1> +<% else %> + <table> + <thead> + <tr> + <th scope="col">Name</th> + <th scope="col">Arch</th> + </tr> + </thead> + <tbody> + <%@pool.images.each {|image| %> + <tr> + <td><%= image.name %></td> + <td><%= image.architecture %></td> + </tr> + <% } %> + </tbody> + </table> +<% end %> \ No newline at end of file diff --git a/src/app/views/pool/index.html.erb b/src/app/views/pool/index.html.erb new file mode 100644 index 0000000..1650cee --- /dev/null +++ b/src/app/views/pool/index.html.erb @@ -0,0 +1,8 @@ +<% if @pools.size == 0 %> +<h1>There are no pools to display</h1> +<% else %> + <%@pools.each {|pool| %> + <%= pool.name %><br/> + <% } %> +<% end %> +<%= link_to "Add a pool", :controller => "pool", :action => "new", :provider => @provider%> diff --git a/src/app/views/pool/new.html.erb b/src/app/views/pool/new.html.erb new file mode 100644 index 0000000..b1e329f --- /dev/null +++ b/src/app/views/pool/new.html.erb @@ -0,0 +1,15 @@ +<div class="dcloud_form"> + <%= error_messages_for 'pool' %> + <%= error_messages_for 'account' %> + + <h2>Create a new Pool</h2><br /> + + <% form_tag :action => 'create' do -%> + <legend>Pool</legend> + <ul> + <li><label>Name<span>Provide a descriptive name for this pool.</span></label><%= text_field :pool, :name %></li> + </ul> + </fieldset> + <%= submit_tag "Save", :class => "submit" %> + <% end %> +</div> diff --git a/src/app/views/pool/realms.html.erb b/src/app/views/pool/realms.html.erb new file mode 100644 index 0000000..3aca533 --- /dev/null +++ b/src/app/views/pool/realms.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'realms/list' %> diff --git a/src/app/views/pool/show.html.erb b/src/app/views/pool/show.html.erb new file mode 100644 index 0000000..acc5f1a --- /dev/null +++ b/src/app/views/pool/show.html.erb @@ -0,0 +1,43 @@ +<% if @instances.size == 0 %> +<h1>There are no instances to display</h1> +<% else %> + <table> + <thead> + <tr> + <th scope="col">Actions</th> + <th scope="col">Name</th> + <th scope="col">State</th> + <th scope="col">Hardware Profile</th> + <th scope="col">Image</th> + </tr> + </thead> + <tbody> + <%@instances.each {|instance| %> + <tr> + <td> + <ul class="instance_action_list"> + <%instance.get_action_list.each {|action|%> + <li> + <%= link_to action, :controller => "instance", + :action => "instance_action", + :id => instance, + :instance_action => action %> + </li> + <% } %> + </ul> + </td> + <td><%= instance.name %></td> + <td><%= instance.state %></td> + <td><%= instance.hardware_profile.name %></td> + <td><%= instance.image.name %></td> + </tr> + <% } %> + </tbody> + </table> +<% end %> +<%= link_to "Add a new instance", {:controller => "instance", :action => "new", :id => @pool}, :class=>"actionlink"%> +<%= link_to "Back end Accounts", {:action => "accounts", :id => @pool.id}, :class=>"actionlink"%> +<%= link_to "User access", {:controller => "permissions", :action => "list", :pool_id => @pool.id}, :class=>"actionlink" if has_view_perms? %> +<%= link_to "Hardware Profiles", {:action => "hardware_profiles", :id => @pool.id}, :class=>"actionlink"%> +<%=link_to "View Images", {:controller => "pool", :action => "images", :pool => @pool}, :class => "actionlink" %> +<%= link_to "Realms", {:action => "realms", :id => @pool.id}, :class=>"actionlink"%> diff --git a/src/app/views/portal_pool/accounts.html.erb b/src/app/views/portal_pool/accounts.html.erb deleted file mode 100644 index 3a95eae..0000000 --- a/src/app/views/portal_pool/accounts.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -<% if @pool.cloud_accounts.size == 0 %> -<h1>There are no accounts to display</h1> -<% else %> - <table> - <thead> - <tr> - <th scope="col">Provider</th> - <th scope="col">Username</th> - <th scope="col">Actions</th> - </tr> - </thead> - <tbody> - <%@pool.cloud_accounts.each {|account| %> - <tr> - <td><%= account.provider.name %></td> - <td><%= account.username %></td> - <td> - <%= link_to "User access", - {:controller => "permissions", - :action => "list", - :cloud_account_id => account.id}, - :class=>"actionlink" if has_view_perms?(account) %> - </td> - </tr> - <% } %> - </tbody> - </table> -<% end %> -<%= link_to "View/Add Existing Cloud Accounts", {:controller => "portal_pool",:action => "accounts_for_pool", :pool_id => @pool}, :class=>"actionlink" %> -<%= link_to "Add a New Cloud Account", {:controller => "cloud_accounts",:action => "new_from_pool", :pool_id => @pool}, :class=>"actionlink" %><br/> - diff --git a/src/app/views/portal_pool/accounts_for_pool.html.erb b/src/app/views/portal_pool/accounts_for_pool.html.erb deleted file mode 100644 index e273551..0000000 --- a/src/app/views/portal_pool/accounts_for_pool.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<% if @pool.cloud_accounts.size > 0 %> -<h1>These Cloud Accounts are already attached to this pool</h1> -<table> -<thead> -<tr> -<th scope="col">Provider Name</th> -<th scope="col">Cloud Account User Name</th> -</tr> -<% @pool.cloud_accounts.each {|a| %> -<tr> -<td><%= a.provider.name %></td> -<td><%= a.username %></td> -</tr> -<% } %> -</table> -<% end %> - -<% if @cloud_accounts.size == 0 %> -<h1>There are no existing Cloud Accounts available to add</h1> -<% else %> -<h1>These Cloud Accounts are available to add</h1> -<table> -<thead> -<tr> -<th scope="col">Provider Name</th> -<th scope="col">Cloud Account User Name</th> -</tr> -<% @cloud_accounts.each {|a| %> -<tr> -<td><%= a.provider.name %></td> -<td><%= a.username %> <%= link_to "Add this account", {:controller=> "portal_pool", - :action => "add_account", :portal_pool => @pool, :cloud_account => a}, :class => "actionlink" %></td> -</tr> -<% } %> -</table> -<% end %> diff --git a/src/app/views/portal_pool/delete.html.erb b/src/app/views/portal_pool/delete.html.erb deleted file mode 100644 index b21ec14..0000000 --- a/src/app/views/portal_pool/delete.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<h1>ProviderController#delete</h1> -<p>Find me in app/views/provider_controller/delete.html.erb</p> diff --git a/src/app/views/portal_pool/hardware_profiles.html.erb b/src/app/views/portal_pool/hardware_profiles.html.erb deleted file mode 100644 index 579d796..0000000 --- a/src/app/views/portal_pool/hardware_profiles.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => 'hardware_profiles/list' %> diff --git a/src/app/views/portal_pool/images.html.erb b/src/app/views/portal_pool/images.html.erb deleted file mode 100644 index e0187a8..0000000 --- a/src/app/views/portal_pool/images.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% if @pool.images.size == 0 %> -<h1>There are no images to display</h1> -<% else %> - <table> - <thead> - <tr> - <th scope="col">Name</th> - <th scope="col">Arch</th> - </tr> - </thead> - <tbody> - <%@pool.images.each {|image| %> - <tr> - <td><%= image.name %></td> - <td><%= image.architecture %></td> - </tr> - <% } %> - </tbody> - </table> -<% end %> \ No newline at end of file diff --git a/src/app/views/portal_pool/index.html.erb b/src/app/views/portal_pool/index.html.erb deleted file mode 100644 index efb47e8..0000000 --- a/src/app/views/portal_pool/index.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<% if @pools.size == 0 %> -<h1>There are no pools to display</h1> -<% else %> - <%@pools.each {|pool| %> - <%= pool.name %><br/> - <% } %> -<% end %> -<%= link_to "Add a pool", :controller => "portal_pool", :action => "new", :provider => @provider%> diff --git a/src/app/views/portal_pool/new.html.erb b/src/app/views/portal_pool/new.html.erb deleted file mode 100644 index e98fc4b..0000000 --- a/src/app/views/portal_pool/new.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<div class="dcloud_form"> - <%= error_messages_for 'portal_pool' %> - <%= error_messages_for 'account' %> - - <h2>Create a new Pool</h2><br /> - - <% form_tag :action => 'create' do -%> - <legend>Pool</legend> - <ul> - <li><label>Name<span>Provide a descriptive name for this pool.</span></label><%= text_field :portal_pool, :name %></li> - </ul> - </fieldset> - <%= submit_tag "Save", :class => "submit" %> - <% end %> -</div> diff --git a/src/app/views/portal_pool/realms.html.erb b/src/app/views/portal_pool/realms.html.erb deleted file mode 100644 index 3aca533..0000000 --- a/src/app/views/portal_pool/realms.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => 'realms/list' %> diff --git a/src/app/views/portal_pool/show.html.erb b/src/app/views/portal_pool/show.html.erb deleted file mode 100644 index 31e2d7c..0000000 --- a/src/app/views/portal_pool/show.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -<% if @instances.size == 0 %> -<h1>There are no instances to display</h1> -<% else %> - <table> - <thead> - <tr> - <th scope="col">Actions</th> - <th scope="col">Name</th> - <th scope="col">State</th> - <th scope="col">Hardware Profile</th> - <th scope="col">Image</th> - </tr> - </thead> - <tbody> - <%@instances.each {|instance| %> - <tr> - <td> - <ul class="instance_action_list"> - <%instance.get_action_list.each {|action|%> - <li> - <%= link_to action, :controller => "instance", - :action => "instance_action", - :id => instance, - :instance_action => action %> - </li> - <% } %> - </ul> - </td> - <td><%= instance.name %></td> - <td><%= instance.state %></td> - <td><%= instance.hardware_profile.name %></td> - <td><%= instance.image.name %></td> - </tr> - <% } %> - </tbody> - </table> -<% end %> -<%= link_to "Add a new instance", {:controller => "instance", :action => "new", :id => @pool}, :class=>"actionlink"%> -<%= link_to "Back end Accounts", {:action => "accounts", :id => @pool.id}, :class=>"actionlink"%> -<%= link_to "User access", {:controller => "permissions", :action => "list", :portal_pool_id => @pool.id}, :class=>"actionlink" if has_view_perms? %> -<%= link_to "Hardware Profiles", {:action => "hardware_profiles", :id => @pool.id}, :class=>"actionlink"%> -<%=link_to "View Images", {:controller => "portal_pool", :action => "images", :portal_pool => @pool}, :class => "actionlink" %> -<%= link_to "Realms", {:action => "realms", :id => @pool.id}, :class=>"actionlink"%> diff --git a/src/app/views/provider/new_account.html.erb b/src/app/views/provider/new_account.html.erb index 177906b..b9ae229 100644 --- a/src/app/views/provider/new_account.html.erb +++ b/src/app/views/provider/new_account.html.erb @@ -1,5 +1,5 @@ <div class="dcloud_form"> - <%= error_messages_for 'portal_pool' %> + <%= error_messages_for 'pool' %> <%= error_messages_for 'account' %>
<h2>Create an Account for this Provider</h2><br /> diff --git a/src/app/views/provider/show.html.erb b/src/app/views/provider/show.html.erb index 2ec5f62..0897828 100644 --- a/src/app/views/provider/show.html.erb +++ b/src/app/views/provider/show.html.erb @@ -1,4 +1,4 @@ -<% if @provider.portal_pools.size == 0 %> +<% if @provider.pools.size == 0 %> <h1>There are no pools to display</h1> <% else %> <table> @@ -9,7 +9,7 @@ </tr> </thead> <tbody> - <%@provider.portal_pools.each {|pool| %> + <%@provider.pools.each {|pool| %> <tr> <td><%= pool.name %></td> <td><%= pool.instances.count %></td> @@ -18,7 +18,7 @@ </tbody> </table> <% end %> -<%= link_to "Add a pool", {:controller => "portal_pool", :action => "new", :provider => @provider}, :class => "actionlink" %> +<%= link_to "Add a pool", {:controller => "pool", :action => "new", :provider => @provider}, :class => "actionlink" %> <%= link_to "Realms", {:action => "realms", :id => @provider.id}, :class=>"actionlink"%> <%= link_to "Accounts", {:action => "accounts", :id => @provider.id}, :class=>"actionlink"%> <%= link_to "User access", {:controller => "permissions", :action => "list", :provider_id => @provider.id}, :class=>"actionlink" if has_view_perms? %> diff --git a/src/db/migrate/20090803141507_create_pools.rb b/src/db/migrate/20090803141507_create_pools.rb new file mode 100644 index 0000000..5552869 --- /dev/null +++ b/src/db/migrate/20090803141507_create_pools.rb @@ -0,0 +1,39 @@ +# +# Copyright (C) 2009 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 CreatePools < ActiveRecord::Migration + def self.up + create_table :pools do |t| + t.string :name, :null => false + t.string :exported_as + t.integer :owner_id, :null => false + t.integer :quota_id + t.integer :lock_version, :default => 0 + t.timestamps + end + + end + + def self.down + drop_table :cloud_accounts_pools + drop_table :pools + end +end diff --git a/src/db/migrate/20090803141507_create_portal_pools.rb b/src/db/migrate/20090803141507_create_portal_pools.rb deleted file mode 100644 index d60b050..0000000 --- a/src/db/migrate/20090803141507_create_portal_pools.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2009 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 CreatePortalPools < ActiveRecord::Migration - def self.up - create_table :portal_pools do |t| - t.string :name, :null => false - t.string :exported_as - t.integer :owner_id, :null => false - t.integer :quota_id - t.integer :lock_version, :default => 0 - t.timestamps - end - - end - - def self.down - drop_table :cloud_accounts_portal_pools - drop_table :portal_pools - end -end diff --git a/src/db/migrate/20090804135630_create_hardware_profiles.rb b/src/db/migrate/20090804135630_create_hardware_profiles.rb index 0c4209f..f3e1b65 100644 --- a/src/db/migrate/20090804135630_create_hardware_profiles.rb +++ b/src/db/migrate/20090804135630_create_hardware_profiles.rb @@ -28,7 +28,7 @@ class CreateHardwareProfiles < ActiveRecord::Migration t.float :storage, :null => false t.string :architecture, :null => false t.integer :provider_id - t.integer :portal_pool_id + t.integer :pool_id t.integer :lock_version, :default => 0 t.timestamps end diff --git a/src/db/migrate/20090804140143_create_images.rb b/src/db/migrate/20090804140143_create_images.rb index 0520c73..bb3db82 100644 --- a/src/db/migrate/20090804140143_create_images.rb +++ b/src/db/migrate/20090804140143_create_images.rb @@ -26,7 +26,7 @@ class CreateImages < ActiveRecord::Migration t.string :name, :null => false, :limit => 1024 t.string :architecture, :null => false t.integer :provider_id - t.integer :portal_pool_id + t.integer :pool_id t.integer :lock_version, :default => 0 t.timestamps end diff --git a/src/db/migrate/20090804142049_create_instances.rb b/src/db/migrate/20090804142049_create_instances.rb index 9cd76d4..714a7e4 100644 --- a/src/db/migrate/20090804142049_create_instances.rb +++ b/src/db/migrate/20090804142049_create_instances.rb @@ -27,7 +27,7 @@ class CreateInstances < ActiveRecord::Migration t.integer :hardware_profile_id, :null => false t.integer :image_id, :null => false t.integer :realm_id - t.integer :portal_pool_id, :null => false + t.integer :pool_id, :null => false t.integer :cloud_account_id t.string :public_address t.string :private_address diff --git a/src/db/migrate/20091008153058_create_roles.rb b/src/db/migrate/20091008153058_create_roles.rb index a8031fb..3e578c8 100644 --- a/src/db/migrate/20091008153058_create_roles.rb +++ b/src/db/migrate/20091008153058_create_roles.rb @@ -33,18 +33,18 @@ class CreateRoles < ActiveRecord::Migration
#create default roles roles = {"Instance Controller" => - {:role_scope => "PortalPool", + {:role_scope => "Pool", :privileges => ["instance_control", "instance_view", "pool_view"]}, "Instance Controller With Monitoring" => - {:role_scope => "PortalPool", + {:role_scope => "Pool", :privileges => ["instance_control", "instance_view", "pool_view", "stats_view"]}, "Instance Creator and User" => - {:role_scope => "PortalPool", + {:role_scope => "Pool", :privileges => ["instance_control", "instance_view", "pool_view", @@ -54,7 +54,7 @@ class CreateRoles < ActiveRecord::Migration "set_perms", "view_perms"]}, "Self-service Pool User" => - {:role_scope => "PortalPool", + {:role_scope => "Pool", :privileges => ["instance_control", "instance_view", "pool_view", diff --git a/src/db/migrate/20091215182906_create_pool_accounts.rb b/src/db/migrate/20091215182906_create_pool_accounts.rb index e3b4fe6..aa71c09 100644 --- a/src/db/migrate/20091215182906_create_pool_accounts.rb +++ b/src/db/migrate/20091215182906_create_pool_accounts.rb @@ -23,7 +23,7 @@ class CreatePoolAccounts < ActiveRecord::Migration def self.up create_table :pool_accounts do |t| t.integer :cloud_account_id, :null => false - t.integer :portal_pool_id, :null => false + t.integer :pool_id, :null => false t.integer :quota_id t.integer :lock_version, :default => 0 t.timestamps diff --git a/src/public/stylesheets/dcloud.css b/src/public/stylesheets/dcloud.css index 5b68ab6..d67a971 100644 --- a/src/public/stylesheets/dcloud.css +++ b/src/public/stylesheets/dcloud.css @@ -210,25 +210,25 @@ ul#providers li a:hover { background: #efefef; }
-ul#portal_pools { +ul#pools { list-style-type: none; line-height: 36px; margin: 0; padding: 0 0 0 10px; }
-ul#portal_pools li { +ul#pools li { border-bottom: none; }
-ul#portal_pools li a { +ul#pools li a { display: block; line-height: 36px; padding-left: 32px; border-bottom: none; }
-ul#portal_pools li a:hover { +ul#pools li a:hover { background: #efefef url(../images/icon_vmpool.png) no-repeat 2px 50%; }
diff --git a/src/spec/controllers/hardware_profiles_controller_spec.rb b/src/spec/controllers/hardware_profiles_controller_spec.rb index e4b837d..5d21841 100644 --- a/src/spec/controllers/hardware_profiles_controller_spec.rb +++ b/src/spec/controllers/hardware_profiles_controller_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper'
describe HardwareProfilesController do
+ fixtures :all before(:each) do @admin_permission = Factory :admin_permission @admin = @admin_permission.user diff --git a/src/spec/controllers/pool_controller_spec.rb b/src/spec/controllers/pool_controller_spec.rb new file mode 100644 index 0000000..71131b8 --- /dev/null +++ b/src/spec/controllers/pool_controller_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +describe PoolController do + + before(:each) do + @admin_permission = Factory :admin_permission + @admin = @admin_permission.user + activate_authlogic + end + + it "should provide ui to create new pool" do + UserSession.create(@admin) + get :new + response.should be_success + response.should render_template("new") + end + + it "should fail to grant access to new pool ui for unauthenticated user" do + get :new + response.should_not be_success + end + + it "should provider means to create new pool" do + UserSession.create(@admin) + lambda do + post :create, :pool => { :name => 'foopool' } + end.should change(Pool, :count).by(1) + id = Pool.find(:first, :conditions => ['name = ?', 'foopool']).id + response.should redirect_to("http://test.host/pool/show/#%7Bid%7D") + end + + it "should provide ui to view hardware profiles" do + UserSession.create(@admin) + pool = Factory :tpool + + get :hardware_profiles, :id => pool.id + response.should be_success + assigns[:hardware_profiles].size.should == pool.hardware_profiles.size + response.should render_template("hardware_profiles") + end + + it "should get cloud accounts" do + @pool = Factory :tpool + UserSession.create(@admin) + get :accounts, :id => @pool.id + response.should be_success + response.should render_template("accounts") + @pool.should_not == nil + end + + it "should provide ui to view realms" do + UserSession.create(@admin) + pool = Factory :tpool + + get :realms, :id => pool.id + response.should be_success + assigns[:realm_names].size.should == pool.realms.size + response.should render_template("realms") + end + +end diff --git a/src/spec/controllers/portal_pool_controller_spec.rb b/src/spec/controllers/portal_pool_controller_spec.rb deleted file mode 100644 index 2ea6b4d..0000000 --- a/src/spec/controllers/portal_pool_controller_spec.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'spec_helper' - -describe PortalPoolController do - - before(:each) do - @admin_permission = Factory :admin_permission - @admin = @admin_permission.user - activate_authlogic - end - - it "should provide ui to create new pool" do - UserSession.create(@admin) - get :new - response.should be_success - response.should render_template("new") - end - - it "should fail to grant access to new pool ui for unauthenticated user" do - get :new - response.should_not be_success - end - - it "should provider means to create new pool" do - UserSession.create(@admin) - lambda do - post :create, :portal_pool => { :name => 'foopool' } - end.should change(PortalPool, :count).by(1) - id = PortalPool.find(:first, :conditions => ['name = ?', 'foopool']).id - response.should redirect_to("http://test.host/portal_pool/show/#%7Bid%7D") - end - - it "should provide ui to view hardware profiles" do - UserSession.create(@admin) - pool = Factory :tpool - - get :hardware_profiles, :id => pool.id - response.should be_success - assigns[:hardware_profiles].size.should == pool.hardware_profiles.size - response.should render_template("hardware_profiles") - end - - it "should get cloud accounts" do - @pool = Factory :tpool - UserSession.create(@admin) - get :accounts, :id => @pool.id - response.should be_success - response.should render_template("accounts") - @pool.should_not == nil - end - - it "should provide ui to view realms" do - UserSession.create(@admin) - pool = Factory :tpool - - get :realms, :id => pool.id - response.should be_success - assigns[:realm_names].size.should == pool.realms.size - response.should render_template("realms") - end - -end diff --git a/src/spec/controllers/provider_controller_spec.rb b/src/spec/controllers/provider_controller_spec.rb index 767f415..de894ca 100644 --- a/src/spec/controllers/provider_controller_spec.rb +++ b/src/spec/controllers/provider_controller_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper'
describe ProviderController do
+ fixtures :all before(:each) do @admin_permission = Factory :provider_admin_permission @provider = @admin_permission.permission_object diff --git a/src/spec/controllers/users_controller_spec.rb b/src/spec/controllers/users_controller_spec.rb index a9e4c96..1189294 100644 --- a/src/spec/controllers/users_controller_spec.rb +++ b/src/spec/controllers/users_controller_spec.rb @@ -29,7 +29,7 @@ describe UsersController do :password => "testpass", :password_confirmation => "testpass" } }.should change{ User.count } - p = PortalPool.find_by_name("tuser2") + p = Pool.find_by_name("tuser2") p.should_not be_nil assigns[:user].login.should == p.owner.login p.name.should == "tuser2" @@ -45,7 +45,7 @@ describe UsersController do lambda { post :create, :user => {} }.should_not change{ User.count } - p = PortalPool.find_by_name("tuser2") + p = Pool.find_by_name("tuser2") p.should be_nil returned_user = assigns[:user] returned_user.errors.empty?.should be_false diff --git a/src/spec/factories/pool.rb b/src/spec/factories/pool.rb new file mode 100644 index 0000000..2f9111e --- /dev/null +++ b/src/spec/factories/pool.rb @@ -0,0 +1,9 @@ +Factory.define :pool do |p| + p.name 'mypool' + p.owner { |owner| owner.association(:user, :login => 'pool_owner', :email => 'pool_owner@example.com') } +end + +Factory.define :tpool, :parent => :pool do |p| + p.name 'tpool' + p.hardware_profiles { |hp| [hp.association(:pool_hwp1)] } +end diff --git a/src/spec/factories/portal_pool.rb b/src/spec/factories/portal_pool.rb deleted file mode 100644 index d0a8e52..0000000 --- a/src/spec/factories/portal_pool.rb +++ /dev/null @@ -1,9 +0,0 @@ -Factory.define :portal_pool do |p| - p.name 'mypool' - p.owner { |owner| owner.association(:user, :login => 'pool_owner', :email => 'pool_owner@example.com') } -end - -Factory.define :tpool, :parent => :portal_pool do |p| - p.name 'tpool' - p.hardware_profiles { |hp| [hp.association(:pool_hwp1)] } -end diff --git a/src/spec/fixtures/roles.yml b/src/spec/fixtures/roles.yml index 559e42a..aafe654 100644 --- a/src/spec/fixtures/roles.yml +++ b/src/spec/fixtures/roles.yml @@ -7,19 +7,19 @@ # column: value instance_controller: name: Instance Controller - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view instance_controller_with_monitoring: name: Instance Controller With Monitoring - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view, stats_view instance_creator_and_user: name: Instance Creator and User - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view, stats_view, instance_modify, quota_view, set_perms, view_perms self_service_pool_user: name: Self-service Pool User - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view, stats_view, instance_modify, quota_view, set_perms, view_perms, account_add pool_creator: name: Pool Creator diff --git a/src/spec/models/registration_service_spec.rb b/src/spec/models/registration_service_spec.rb index bdf09b4..40f16f2 100644 --- a/src/spec/models/registration_service_spec.rb +++ b/src/spec/models/registration_service_spec.rb @@ -13,7 +13,7 @@ describe RegistrationService do describe "#save" do
context "adding valid user with no errors" do - it "should create user, portal_pool and self-service permission" do + it "should create user, pool and self-service permission" do user = User.new({:login => 'gooduser', :email => 'guser@example.com', :password => 'password', @@ -33,7 +33,7 @@ describe RegistrationService do } end
- it "should return portal_pool errors if pool create fails" do + it "should return pool errors if pool create fails" do #TODO: implement this test. We should check this, but not sure of best # way right now. end diff --git a/src/test/fixtures/instances.yml b/src/test/fixtures/instances.yml index 528a5e4..951258d 100644 --- a/src/test/fixtures/instances.yml +++ b/src/test/fixtures/instances.yml @@ -6,7 +6,7 @@ test_instance: hardware_profile: c1_xlarge_frontend image: fedora_13_image_frontend realm: us_realm - portal_pool: test_pool + pool: test_pool cloud_account: mock_account public_address: private_address: diff --git a/src/test/fixtures/permissions.yml b/src/test/fixtures/permissions.yml index b2d7bdd..2e889db 100644 --- a/src/test/fixtures/permissions.yml +++ b/src/test/fixtures/permissions.yml @@ -7,4 +7,4 @@ admin_permission: user_permission: role: instance_creator_and_user user: test_user - permission_object: test_pool (PortalPool) + permission_object: test_pool (Pool) diff --git a/src/test/fixtures/pool_accounts.yml b/src/test/fixtures/pool_accounts.yml index 3170b3b..c5db498 100644 --- a/src/test/fixtures/pool_accounts.yml +++ b/src/test/fixtures/pool_accounts.yml @@ -2,4 +2,4 @@
test_pool_mock_account: cloud_account: mock_account - portal_pool: test_pool + pool: test_pool diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml new file mode 100644 index 0000000..da63a52 --- /dev/null +++ b/src/test/fixtures/pools.yml @@ -0,0 +1,6 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +test_pool + name: test_pool + owner: test_user + cloud_accounts: mock_account diff --git a/src/test/fixtures/portal_pools.yml b/src/test/fixtures/portal_pools.yml deleted file mode 100644 index da63a52..0000000 --- a/src/test/fixtures/portal_pools.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html - -test_pool - name: test_pool - owner: test_user - cloud_accounts: mock_account diff --git a/src/test/fixtures/roles.yml b/src/test/fixtures/roles.yml index 2ac7e5f..1391546 100644 --- a/src/test/fixtures/roles.yml +++ b/src/test/fixtures/roles.yml @@ -7,19 +7,19 @@ # column: value instance_controller: name: Instance Controller - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view instance_controller_with_monitoring: name: Instance Controller With Monitoring - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view, stats_view instance_creator_and_user: name: Instance Creator and User - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view, stats_view, instance_modify, quota_view, set_perms, view_perms self_service_pool_user: name: Self-service Pool User - scope: PortalPool + scope: Pool privileges: instance_control, instance_view, pool_view, stats_view, instance_modify, quota_view, set_perms, view_perms, account_modify pool_creator: name: Pool Creator diff --git a/src/test/unit/pool_test.rb b/src/test/unit/pool_test.rb new file mode 100644 index 0000000..06e655b --- /dev/null +++ b/src/test/unit/pool_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class PoolTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end diff --git a/src/test/unit/portal_pool_test.rb b/src/test/unit/portal_pool_test.rb deleted file mode 100644 index f4d8c0a..0000000 --- a/src/test/unit/portal_pool_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'test_helper' - -class PortalPoolTest < ActiveSupport::TestCase - # Replace this with your real tests. - test "the truth" do - assert true - end -end
Minor error applying patch:
+ warning: 1 line adds whitespace errors. 81a935a3404789ec778428916440f3a425a2834e src/app/views/pool/accounts.html.erb:1: new blank line at EOF.
On Thu, Apr 1, 2010 at 3:30 PM, Scott Seago sseago@redhat.com wrote:
You'll need to re-generate your data model after applying this patch.
diff --git a/src/db/migrate/20090803141507_create_pools.rb b/src/db/migrate/20090803141507_create_pools.rb new file mode 100644 index 0000000..5552869 --- /dev/null +++ b/src/db/migrate/20090803141507_create_pools.rb @@ -0,0 +1,39 @@ +# +# Copyright (C) 2009 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 CreatePools < ActiveRecord::Migration
- def self.up
- create_table :pools do |t|
t.string :name, :null => false
t.string :exported_as
t.integer :owner_id, :null => false
t.integer :quota_id
t.integer :lock_version, :default => 0
t.timestamps
- end
- end
- def self.down
- drop_table :cloud_accounts_pools
Minor thing - this table ^ does not seem to exist, so I dont think it needs to be listed here, unless I am missing something. listing tables in my dev db does not show it.
- drop_table :pools
- end
+end
Other than that, ACK, I have reviewed the changes, run the tests, and set up a new instance, everything seems to work as it should
deltacloud-devel@lists.fedorahosted.org