[PATCH configure] Change service name from imagefactoryd to imagefactory for spec tests
by steve linabery
From: Steve Linabery <slinabery(a)gmail.com>
---
spec/spec_helper.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e2506c4..31d4602 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,7 +10,7 @@ AEOLUS_PACKAGES = ['iwhd', 'imagefactory',
'aeolus-conductor', 'aeolus-conductor-doc', 'aeolus-conductor-daemons',
'aeolus-configure']
-AEOLUS_SERVICES = ['iwhd', 'deltacloud-mock', 'deltacloud-ec2-us-east-1', 'deltacloud-ec2-us-west-1', 'imagefactoryd',
+AEOLUS_SERVICES = ['iwhd', 'deltacloud-mock', 'deltacloud-ec2-us-east-1', 'deltacloud-ec2-us-west-1', 'imagefactory',
'aeolus-conductor', 'conductor-condor_refreshd', 'conductor-dbomatic']
# 'conductor-delayed_job'] TODO where is the init script for this?
--
1.7.4
12 years, 6 months
[PATCH conductor] Fix Redmine #728
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
Building the rpms using `make rpms` now adds a timestamp and commit id to all
the built rpms -- including the Console and Connector.
---
Makefile.am | 5 +++--
services/image_factory/console/rake/rpmtask.rb | 7 +++++--
.../image_factory_connector/rake/rpmtask.rb | 12 ++++++++++--
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 4acec50..36de8b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,14 +37,15 @@ GIT_RELEASE = $$(date --utc +%Y%m%d%H%M%S)git$(git_head)
RPMDIR = $$(rpm --eval '%{_rpmdir}')
RPM_FLAGS = --define "conductor_cache_dir $(CONDUCTOR_CACHE_DIR)"
RPM_FLAGS += $(if $(_conductor_dev),--define "extra_release .$(GIT_RELEASE)")
+RAKE_EXTRA_RELEASE = $(if $(_conductor_dev),"extra_release=.$(GIT_RELEASE)")
SUBDIRS = src/classad_plugin
ACLOCAL_AMFLAGS = -I m4
rpms: dist
- cd services/image_factory/console; rake rpms
- cd services/image_factory/image_factory_connector; rake rpms
+ cd services/image_factory/console; rake rpms $(RAKE_EXTRA_RELEASE)
+ cd services/image_factory/image_factory_connector; rake rpms $(RAKE_EXTRA_RELEASE)
rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
srpms: dist
diff --git a/services/image_factory/console/rake/rpmtask.rb b/services/image_factory/console/rake/rpmtask.rb
index d11283b..7534693 100644
--- a/services/image_factory/console/rake/rpmtask.rb
+++ b/services/image_factory/console/rake/rpmtask.rb
@@ -75,12 +75,15 @@ module Rake
task :rpms => [rpm_file]
# FIXME properly determine :package build artifact(s) to copy to sources dir
- file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do
+ file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do |t,args|
cp "#{package_dir}/#{@name}-#{(a)version}.tgz", "#{@topdir}/SOURCES/"
# FIXME - This seems like a hack, but we don't know the gem's name
cp "#{package_dir}/#{(a)name.gsub('rubygem-', '')}-#{(a)version}.gem", "#{@topdir}/SOURCES/"
cp @rpm_spec, "#{@topdir}/SPECS"
- sh "#{@rpmbuild_cmd} --define '_topdir #{@topdir}' -ba #{@rpm_spec}"
+ sh "#{@rpmbuild_cmd} " +
+ "--define '_topdir #{@topdir}' " +
+ "--define 'extra_release #{args.extra_release}' " +
+ "-ba #{@rpm_spec}"
end
end
diff --git a/services/image_factory/image_factory_connector/rake/rpmtask.rb b/services/image_factory/image_factory_connector/rake/rpmtask.rb
index c88d461..416a42b 100644
--- a/services/image_factory/image_factory_connector/rake/rpmtask.rb
+++ b/services/image_factory/image_factory_connector/rake/rpmtask.rb
@@ -80,7 +80,12 @@ module Rake
task :rpms => [rpm_file]
# FIXME properly determine :package build artifact(s) to copy to sources dir
- file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do
+ file rpm_file => [:package, "#{@topdir}/SOURCES", "#{@topdir}/SPECS"] do |t,args|
+ if args.extra_release.nil? || args.extra_release.empty?
+ extra_release = ''
+ else
+ extra_release = '.' + args.extra_release
+ end
cp "#{package_dir}/#{@name}-#{(a)version}.tgz", "#{@topdir}/SOURCES/"
@sources.each do |source|
# TODO - Is there a smarter way of doing this?
@@ -89,7 +94,10 @@ module Rake
cp "#{dir}/#{source}", "#{@topdir}/SOURCES/"
end
cp @rpm_spec, "#{@topdir}/SPECS"
- sh "#{@rpmbuild_cmd} --define '_topdir #{@topdir}' -ba #{@rpm_spec}"
+ sh "#{@rpmbuild_cmd} " +
+ "--define '_topdir #{@topdir}' " +
+ "--define 'extra_release #{args.extra_release}' " +
+ "-ba #{@rpm_spec}"
end
end
--
1.7.4
12 years, 6 months
[PATCH] add top-level template permissions so end users can create templates and start instances. (rev 2)
by Scott Seago
Signed-off-by: Scott Seago <sseago(a)redhat.com>
---
.../controllers/resources/instances_controller.rb | 4 +-
src/app/models/permission.rb | 3 +-
src/app/services/registration_service.rb | 15 ++++--
.../20110322120000_add_template_creator_role.rb | 47 ++++++++++++++++++++
src/db/seeds.rb | 12 ++++-
src/features/permission.feature | 12 +++++-
src/lib/tasks/dc_tasks.rake | 13 ++++--
src/spec/services/registration_service_spec.rb | 6 ++-
8 files changed, 95 insertions(+), 17 deletions(-)
create mode 100644 src/db/migrate/20110322120000_add_template_creator_role.rb
diff --git a/src/app/controllers/resources/instances_controller.rb b/src/app/controllers/resources/instances_controller.rb
index 234fe6b..f857aa7 100644
--- a/src/app/controllers/resources/instances_controller.rb
+++ b/src/app/controllers/resources/instances_controller.rb
@@ -168,7 +168,7 @@ class Resources::InstancesController < ApplicationController
end
def init_new_instance_attrs
- @pools = Pool.list_for_user(@current_user, Privilege::MODIFY, :target_type => Instance)
+ @pools = Pool.list_for_user(@current_user, Privilege::CREATE, :target_type => Instance)
@realms = FrontendRealm.all
@hardware_profiles = HardwareProfile.all(
:include => :architecture,
@@ -189,7 +189,7 @@ class Resources::InstancesController < ApplicationController
{:name => 'CREATED BY', :sort_attr => 'users.last_name'},
]
- @pools = Pool.list_for_user(@current_user, Privilege::MODIFY, :target_type => Instance)
+ @pools = Pool.list_for_user(@current_user, Privilege::CREATE, :target_type => Instance)
end
def load_instances
diff --git a/src/app/models/permission.rb b/src/app/models/permission.rb
index dc10166..34e37bd 100644
--- a/src/app/models/permission.rb
+++ b/src/app/models/permission.rb
@@ -40,7 +40,8 @@ class Permission < ActiveRecord::Base
validates_presence_of :user_id
validates_uniqueness_of :user_id, :scope => [:permission_object_id,
- :permission_object_type]
+ :permission_object_type,
+ :role_id]
belongs_to :permission_object, :polymorphic => true
# type-specific associations
diff --git a/src/app/services/registration_service.rb b/src/app/services/registration_service.rb
index 046fdcd..277a502 100644
--- a/src/app/services/registration_service.rb
+++ b/src/app/services/registration_service.rb
@@ -21,11 +21,16 @@ class RegistrationService
end
@user.save!
-
- self_service_default_role = MetadataObject.lookup("self_service_default_role")
- self_service_default_pool = MetadataObject.lookup("self_service_default_pool")
- Permission.create!(:user => @user, :role => self_service_default_role,
- :permission_object => self_service_default_pool)
+ # perm list in the format:
+ # "[resource1_key, resource1_role], [resource2_key, resource2_role], ..."
+ MetadataObject.lookup("self_service_perms_list").split(/[\]],? ?|[\[]/).
+ select {|x| !x.empty? }.each do |x|
+ obj_key, role_key = x.split(/, ?/)
+ default_obj = MetadataObject.lookup(obj_key)
+ default_role = MetadataObject.lookup(role_key)
+ Permission.create!(:user => @user, :role => default_role,
+ :permission_object => default_obj)
+ end
return true
rescue ActiveRecord::RecordInvalid => e
Rails.logger.error e.message
diff --git a/src/db/migrate/20110322120000_add_template_creator_role.rb b/src/db/migrate/20110322120000_add_template_creator_role.rb
new file mode 100644
index 0000000..301f048
--- /dev/null
+++ b/src/db/migrate/20110322120000_add_template_creator_role.rb
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2011 Red Hat, Inc.
+# Written by Scott Seago <sseago(a)redhat.com>
+#
+# 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.
+
+class AddTemplateCreatorRole < ActiveRecord::Migration
+
+
+ def self.up
+ unless Role.all.empty?
+ Role.transaction do
+ role_name = "Template Creator"
+ role = Role.find_or_initialize_by_name(role_name)
+ role.update_attributes({:name => role_name, :scope => BasePermissionObject.name,
+ :assign_to_owner => false})
+ role.save!
+ ["view","use","create"].each do |action|
+ Privilege.create!(:role => role, :target_type => Template.name,
+ :action => action)
+ end
+ end
+ settings = {"self_service_default_template_obj" => BasePermissionObject.general_permission_scope,
+ "self_service_default_template_role" => Role.find_by_name("Template Creator"),
+ "self_service_perms_list" => "[self_service_default_pool,self_service_default_role], [self_service_default_template_obj,self_service_default_template_role]"}
+ settings.each_pair do |key, value|
+ MetadataObject.set(key, value)
+ end
+ end
+ end
+
+ def self.down
+ end
+end
diff --git a/src/db/seeds.rb b/src/db/seeds.rb
index cf23e60..1bfb969 100644
--- a/src/db/seeds.rb
+++ b/src/db/seeds.rb
@@ -57,6 +57,7 @@ roles =
Quota => [VIEW, MOD],
PoolFamily => [VIEW, MOD,CRE,VPRM,GPRM]}],
"Template Administrator" => [false, {Template => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
+ "Template Creator" => [false, {Template => [VIEW,USE, CRE]}],
"Administrator" => [false, {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM],
HardwareProfile => [ MOD,CRE,VPRM,GPRM],
@@ -92,14 +93,21 @@ BasePermissionObject.create!(:name => "general_permission_scope")
# Set meta objects
MetadataObject.set("default_pool_family", PoolFamily.find_by_name('default'))
-default_pool = Pool.find_by_name("default_pool")
default_quota = Quota.create
+default_pool = Pool.find_by_name("default_pool")
default_role = Role.find_by_name("Pool User")
+default_template_role = Role.find_by_name("Template Creator")
+
settings = {"allow_self_service_logins" => "true",
"self_service_default_quota" => default_quota,
"self_service_default_pool" => default_pool,
- "self_service_default_role" => default_role}
+ "self_service_default_role" => default_role,
+ "self_service_default_template_obj" => BasePermissionObject.general_permission_scope,
+ "self_service_default_template_role" => default_template_role,
+ # perm list in the format:
+ # "[resource1_key, resource1_role], [resource2_key, resource2_role], ..."
+ "self_service_perms_list" => "[self_service_default_pool,self_service_default_role], [self_service_default_template_obj,self_service_default_template_role]"}
settings.each_pair do |key, value|
MetadataObject.set(key, value)
end
diff --git a/src/features/permission.feature b/src/features/permission.feature
index 5267da4..ee2d736 100644
--- a/src/features/permission.feature
+++ b/src/features/permission.feature
@@ -21,12 +21,22 @@ Feature: Manage Permissions
And I should see "Permission record added"
And I should see "testuser"
- Scenario: Create a permission which already exists
+ Scenario: Create a second permission on a resource
Given there is a permission for the user "testuser"
And I am on the new permission page
When I select "testuser" from "permission[user_id]"
And I select "Provider Creator" from "permission[role_id]"
And I press "Save"
+ Then I should be on the permissions page
+ And I should see "Permission record added"
+ And I should see "testuser"
+
+ Scenario: Attempt to duplicate a permission
+ Given there is a permission for the user "testuser"
+ And I am on the new permission page
+ When I select "testuser" from "permission[user_id]"
+ And I select "Administrator" from "permission[role_id]"
+ And I press "Save"
Then I should see "new Permission"
Scenario: Delete a permission
diff --git a/src/lib/tasks/dc_tasks.rake b/src/lib/tasks/dc_tasks.rake
index f7e853d..8255d32 100644
--- a/src/lib/tasks/dc_tasks.rake
+++ b/src/lib/tasks/dc_tasks.rake
@@ -46,10 +46,15 @@ namespace :dc do
puts "Permission already granted for user #{args.login}"
exit(1)
end
-
- user.permissions << Permission.new(:role => Role.find_by_name('Administrator'),
- :permission_object => BasePermissionObject.general_permission_scope)
- puts "Granting administrator privileges for #{args.login}..."
+ permission = Permission.new(:role => Role.find_by_name('Administrator'),
+ :permission_object => BasePermissionObject.general_permission_scope,
+ :user => user)
+ if permission.save
+ puts "Granting administrator privileges for #{args.login}..."
+ else
+ puts "Granting administrator privileges for #{args.login} failed #{permission.errors.to_xml}"
+ exit(1)
+ end
end
diff --git a/src/spec/services/registration_service_spec.rb b/src/spec/services/registration_service_spec.rb
index 810fe6e..ea38412 100644
--- a/src/spec/services/registration_service_spec.rb
+++ b/src/spec/services/registration_service_spec.rb
@@ -17,7 +17,7 @@ describe RegistrationService do
end
end
- it "should register a user with default pool/quota/role when default settings set" do
+ it "should register a user with default pool/quota/role/template perms when default settings set" do
@user = Factory :user
@pool = MetadataObject.lookup("self_service_default_pool")
@role = MetadataObject.lookup("self_service_default_role")
@@ -33,6 +33,8 @@ describe RegistrationService do
@user.quota.maximum_running_instances.should == @quota.maximum_running_instances
@user.quota.maximum_total_instances.should == @quota.maximum_total_instances
+ BasePermissionObject.general_permission_scope.has_privilege(@user,Privilege::CREATE, Template).should == true
+ BasePermissionObject.general_permission_scope.has_privilege(@user,Privilege::USE, Template).should == true
end
end
@@ -51,7 +53,7 @@ describe RegistrationService do
lambda do
lambda do
registration_process.save.should be_true
- end.should change(Permission, :count).by(1)
+ end.should change(Permission, :count).by(2)
end.should change(User, :count).by(1)
end.should change(Quota, :count).by(1)
--
1.7.4
12 years, 6 months
[PATCH] bug #673 / bz #657025 - logrotate all aeolus conductor logs
by Mo Morsi
---
conf/aeolus-conductor.logrotate | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/conf/aeolus-conductor.logrotate b/conf/aeolus-conductor.logrotate
index f8df8b4..b0f73c1 100644
--- a/conf/aeolus-conductor.logrotate
+++ b/conf/aeolus-conductor.logrotate
@@ -10,3 +10,24 @@ notifempty
/etc/init.d/aeolus-conductor restart
endscript
}
+
+/var/log/aeolus-conductor/aeolus-connector.log {
+ sharedscripts
+ postrotate
+ /etc/init.d/aeolus-connector restart
+ endscript
+}
+
+/var/log/aeolus-conductor/condor_refreshd.log {
+ sharedscripts
+ postrotate
+ /etc/init.d/conductor-condor_refreshd restart
+ endscript
+}
+
+/var/log/aeolus-conductor/dbomatic.log {
+ sharedscripts
+ postrotate
+ /etc/init.d/conductor-dbomatic restart
+ endscript
+}
--
1.7.2.3
12 years, 6 months
[PATCH conductor] Remove test links in Provider and Provider Account forms v2
by Richard Su
Added Test button in Provider Properties tab.
---
.../admin/provider_accounts_controller.rb | 12 +-----
src/app/controllers/admin/providers_controller.rb | 43 +++++++++++---------
.../admin/provider_accounts/_provider_form.haml | 6 ---
src/app/views/admin/providers/_form.haml | 4 --
src/app/views/admin/providers/_properties.haml | 1 +
src/features/provider.feature | 20 +++------
src/features/provider_account.feature | 23 ++++-------
.../provider_accounts_controller_spec.rb | 9 ----
8 files changed, 41 insertions(+), 77 deletions(-)
diff --git a/src/app/controllers/admin/provider_accounts_controller.rb b/src/app/controllers/admin/provider_accounts_controller.rb
index 49fced8..6835432 100644
--- a/src/app/controllers/admin/provider_accounts_controller.rb
+++ b/src/app/controllers/admin/provider_accounts_controller.rb
@@ -57,15 +57,10 @@ class Admin::ProviderAccountsController < ApplicationController
@provider_account.provider = @provider
@provider_account.quota = @quota = Quota.new
- if params.delete :test_account
- test_account(@provider_account)
- render :action => 'new' and return
- end
-
limit = params[:quota][:maximum_running_instances] if params[:quota]
@provider_account.quota.set_maximum_running_instances(limit)
- if @provider_account.invalid?
+ if @provider_account.invalid? || !(a)provider_account.valid_credentials?
flash[:error] = "Credentials are invalid!"
render :action => 'new' and return
end
@@ -96,11 +91,6 @@ class Admin::ProviderAccountsController < ApplicationController
@quota = @provider_account.quota
@providers = Provider.find(:all)
- if params.delete :test_account
- test_account(@provider_account)
- render :action => 'edit' and return
- end
-
limit = params[:quota][:maximum_running_instances] if params[:quota]
@provider_account.quota.set_maximum_running_instances(limit)
if @provider_account.update_attributes(params[:provider_account])
diff --git a/src/app/controllers/admin/providers_controller.rb b/src/app/controllers/admin/providers_controller.rb
index 3f4e289..8a7c0c8 100644
--- a/src/app/controllers/admin/providers_controller.rb
+++ b/src/app/controllers/admin/providers_controller.rb
@@ -37,6 +37,11 @@ class Admin::ProvidersController < ApplicationController
require_privilege(Privilege::VIEW, @provider)
@tab_captions = ['Properties', 'HW Profiles', 'Realms', 'Provider Accounts', 'Services','History','Permissions']
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
+
+ if params.delete :test_provider
+ test_connection(@provider)
+ end
+
respond_to do |format|
format.js do
if @url_params.delete :details_pane
@@ -56,9 +61,9 @@ class Admin::ProvidersController < ApplicationController
params[:provider][:provider_type_id] = provider_type.id
end
@provider = Provider.new(params[:provider])
- if params[:test_connection]
- test_connection(@provider)
- render :action => 'new'
+ if !(a)provider.connect
+ flash[:notice] = "Failed to connect to Provider"
+ render :action => "new"
else
if @provider.save && @provider.populate_hardware_profiles
@provider.assign_owner_roles(current_user)
@@ -73,22 +78,22 @@ class Admin::ProvidersController < ApplicationController
end
def update
- @provider = Provider.find_by_id(params[:id])
- require_privilege(Privilege::MODIFY, @provider)
- @provider.update_attributes(params[:provider])
- if params[:test_connection]
- test_connection(@provider)
- render :action => 'edit'
- else
- if @provider.errors.empty? and @provider.save
- flash[:notice] = "Provider updated."
- redirect_to admin_providers_path
- else
- flash[:notice] = "Cannot update the provider."
- render :action => 'edit'
- end
- kick_condor
- end
+ @provider = Provider.find_by_id(params[:id])
+ require_privilege(Privilege::MODIFY, @provider)
+ @provider.update_attributes(params[:provider])
+ if !(a)provider.connect
+ flash[:notice] = "Failed to connect to Provider"
+ render :action => "edit"
+ else
+ if @provider.errors.empty? and @provider.save
+ flash[:notice] = "Provider updated."
+ redirect_to admin_providers_path
+ else
+ flash[:notice] = "Cannot update the provider."
+ render :action => 'edit'
+ end
+ end
+ kick_condor
end
def multi_destroy
diff --git a/src/app/views/admin/provider_accounts/_provider_form.haml b/src/app/views/admin/provider_accounts/_provider_form.haml
index d4c1462..182fc36 100644
--- a/src/app/views/admin/provider_accounts/_provider_form.haml
+++ b/src/app/views/admin/provider_accounts/_provider_form.haml
@@ -21,12 +21,6 @@
)
%fieldset.clear
-.grid_3.omega
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('provider_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
- = t('provider_accounts.form.test_account')
- )
-
:javascript
function set_unlimited_quota(elem_id) {
$("#" + elem_id)[0].value = "unlimited";
diff --git a/src/app/views/admin/providers/_form.haml b/src/app/views/admin/providers/_form.haml
index df888dc..b400d00 100644
--- a/src/app/views/admin/providers/_form.haml
+++ b/src/app/views/admin/providers/_form.haml
@@ -7,10 +7,6 @@
%fieldset.clear
= form.label :url, 'Provider URL :'
= form.text_field :url, :title => 'provider_url', :value => @provider.url, :class => "grid_5"
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('.test_connection'), :name => 'test_connection', :id => 'test_connection' }
- Test connection
- )
%fieldset.clear
= form.label :provider_type
= form.select(:provider_type_id, ProviderType.all.collect {|provider_type| [provider_type.name,provider_type.id] }, :prompt => "Select type of provider")
diff --git a/src/app/views/admin/providers/_properties.haml b/src/app/views/admin/providers/_properties.haml
index 163401e..044895a 100644
--- a/src/app/views/admin/providers/_properties.haml
+++ b/src/app/views/admin/providers/_properties.haml
@@ -2,3 +2,4 @@
Properties for
= @provider.name
= link_to "Edit", edit_admin_provider_path(@provider), {:class => 'button'}
+= link_to "Test", admin_provider_path(@provider, {:test_provider => true}), { :class => 'button' }
diff --git a/src/features/provider.feature b/src/features/provider.feature
index 4b6c50c..34ab613 100644
--- a/src/features/provider.feature
+++ b/src/features/provider.feature
@@ -40,23 +40,17 @@ Feature: Manage Providers
And I should see "Provider added"
And I should have a provider named "testprovider"
- Scenario: Test Provider Connection Successful
+ Scenario: Create a new Provider failure when using wrong url
Given I am on the admin providers page
+ And there is not a provider named "testprovider"
When I follow "Create"
Then I should be on the new admin provider page
When I fill in "provider[name]" with "testprovider"
- And I fill in "provider[url]" with "http://localhost:3001/api"
- And I press "test_connection"
- Then I should see "Successfuly Connected to Provider"
-
- Scenario: Test Provider Connection Failure
- Given I am on the admin providers page
- When I follow "Create"
- Then I should be on the new admin provider page
- When I fill in "provider[name]" with "incorrect_provider"
- And I fill in "provider[url]" with "http://incorrecthost:3001/api"
- And I press "test_connection"
- Then I should see "Failed to Connect to Provider"
+ And I fill in "provider[url]" with "http://localhost:3010/api"
+ And I select "Amazon EC2" from "provider_provider_type_id"
+ And I press "Save"
+ Then I should be on the admin providers page
+ And I should see "Failed to connect to Provider"
Scenario: Delete a provider
Given I am on the homepage
diff --git a/src/features/provider_account.feature b/src/features/provider_account.feature
index 1702e8f..b4ce54a 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -33,27 +33,20 @@ Feature: Manage Provider Accounts
And I should see "Properties for testaccount"
And I should see "Running instances quota: 13"
- Scenario: Test Provider Account Connection Successful
- Given there is a provider named "testprovider"
- And there are no provider accounts
- And I am on the admin provider accounts page
- When I follow "New Account"
- Then I should be on the new admin provider account page
- When I fill in "provider_account[credentials_hash][username]" with "mockuser"
- And I fill in "provider_account[credentials_hash][password]" with "mockpassword"
- And I press "Test Account"
- Then I should see "Test Connection Success"
-
- Scenario: Test Provider Account Connection Failure
+ Scenario: Create a new Provider Account using wrong credentials
Given there is a provider named "testprovider"
And there are no provider accounts
And I am on the admin provider accounts page
When I follow "New Account"
Then I should be on the new admin provider account page
+ And I should see "New Account"
+ When I select "testprovider" from "provider_account_provider_id"
+ And I fill in "provider_account[label]" with "testaccount"
When I fill in "provider_account[credentials_hash][username]" with "mockuser"
- And I fill in "provider_account[credentials_hash][password]" with "wrong password"
- And I press "Test Account"
- Then I should see "Test Connection Failed"
+ And I fill in "provider_account[credentials_hash][password]" with "wrongpassword"
+ And I fill in "quota[maximum_running_instances]" with "13"
+ And I press "Add"
+ Then I should see "Credentials are invalid!"
Scenario: Delete a provider account
Given there is a provider named "testprovider"
diff --git a/src/spec/controllers/provider_accounts_controller_spec.rb b/src/spec/controllers/provider_accounts_controller_spec.rb
index 5327548..c6887cf 100644
--- a/src/spec/controllers/provider_accounts_controller_spec.rb
+++ b/src/spec/controllers/provider_accounts_controller_spec.rb
@@ -21,15 +21,6 @@ describe Admin::ProviderAccountsController do
response.should render_template("index")
end
- it "allows test account validity on create when passing test_account param" do
- UserSession.create(@admin)
- @provider_account.credentials_hash = {}
- post :create, :provider_account => {:provider_id => @provider.id}, :test_account => true
- response.should be_success
- response.should render_template("new")
- response.flash[:error].should == "Test Connection Failed: Invalid Account Details"
- end
-
it "doesn't allow to save provider's account if not valid credentials" do
UserSession.create(@admin)
post :create, :provider_account => {:provider_id => @provider.id}
--
1.7.4
12 years, 6 months
[PATCH conductor] Remove test links in Provider and Provider Account forms
by Richard Su
Added Test button in Provider Properties tab.
---
.../admin/provider_accounts_controller.rb | 19 ++------
src/app/controllers/admin/providers_controller.rb | 43 +++++++++++---------
src/app/views/admin/provider_accounts/_ec2.haml | 4 --
src/app/views/admin/provider_accounts/_gogrid.haml | 4 --
src/app/views/admin/provider_accounts/_mock.haml | 6 +--
.../views/admin/provider_accounts/_opennebula.haml | 4 --
.../views/admin/provider_accounts/_rackspace.haml | 4 --
src/app/views/admin/providers/_form.haml | 4 --
src/app/views/admin/providers/_properties.haml | 1 +
src/features/provider.feature | 20 +++------
src/features/provider_account.feature | 23 ++++-------
.../provider_accounts_controller_spec.rb | 8 ----
12 files changed, 46 insertions(+), 94 deletions(-)
diff --git a/src/app/controllers/admin/provider_accounts_controller.rb b/src/app/controllers/admin/provider_accounts_controller.rb
index ceffe17..276bbf9 100644
--- a/src/app/controllers/admin/provider_accounts_controller.rb
+++ b/src/app/controllers/admin/provider_accounts_controller.rb
@@ -57,18 +57,14 @@ class Admin::ProviderAccountsController < ApplicationController
@provider_account.provider = @provider
@provider_account.quota = @quota = Quota.new
- if params.delete :test_account
- test_account(@provider_account)
- render :action => 'new' and return
- end
-
limit = params[:quota][:maximum_running_instances] if params[:quota]
@provider_account.quota.set_maximum_running_instances(limit)
- if @provider_account.invalid?
- if not @provider_account.valid_credentials?
- flash.now[:error] = "The entered credential information is incorrect"
- elsif @provider_account.errors.on(:username)
+ if not @provider_account.valid_credentials?
+ flash.now[:error] = "The entered credential information is incorrect"
+ render :action => 'new' and return
+ elsif @provider_account.invalid?
+ if @provider_account.errors.on(:username)
flash.now[:error] = "The access key '#{params[:provider_account][:username]}' has already been taken."
else
flash.now[:error] = "You must fill in all the required fields"
@@ -102,11 +98,6 @@ class Admin::ProviderAccountsController < ApplicationController
@quota = @provider_account.quota
@providers = Provider.find(:all)
- if params.delete :test_account
- test_account(@provider_account)
- render :action => 'edit' and return
- end
-
limit = params[:quota][:maximum_running_instances] if params[:quota]
@provider_account.quota.set_maximum_running_instances(limit)
if @provider_account.update_attributes(params[:provider_account])
diff --git a/src/app/controllers/admin/providers_controller.rb b/src/app/controllers/admin/providers_controller.rb
index 435e8a9..dc4cb5b 100644
--- a/src/app/controllers/admin/providers_controller.rb
+++ b/src/app/controllers/admin/providers_controller.rb
@@ -37,6 +37,11 @@ class Admin::ProvidersController < ApplicationController
require_privilege(Privilege::VIEW, @provider)
@tab_captions = ['Properties', 'HW Profiles', 'Realms', 'Provider Accounts', 'Services','History','Permissions']
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
+
+ if params.delete :test_provider
+ test_connection(@provider)
+ end
+
respond_to do |format|
format.js do
if @url_params.delete :details_pane
@@ -51,9 +56,9 @@ class Admin::ProvidersController < ApplicationController
def create
require_privilege(Privilege::CREATE, Provider)
@provider = Provider.new(params[:provider])
- if params[:test_connection]
- test_connection(@provider)
- render :action => 'new'
+ if !(a)provider.connect
+ flash[:notice] = "Failed to connect to Provider"
+ render :action => "new"
else
if @provider.save && @provider.populate_hardware_profiles
@provider.assign_owner_roles(current_user)
@@ -68,22 +73,22 @@ class Admin::ProvidersController < ApplicationController
end
def update
- @provider = Provider.find_by_id(params[:id])
- require_privilege(Privilege::MODIFY, @provider)
- @provider.update_attributes(params[:provider])
- if params[:test_connection]
- test_connection(@provider)
- render :action => 'edit'
- else
- if @provider.errors.empty? and @provider.save
- flash[:notice] = "Provider updated."
- redirect_to admin_providers_path
- else
- flash[:notice] = "Cannot update the provider."
- render :action => 'edit'
- end
- kick_condor
- end
+ @provider = Provider.find_by_id(params[:id])
+ require_privilege(Privilege::MODIFY, @provider)
+ @provider.update_attributes(params[:provider])
+ if !(a)provider.connect
+ flash[:notice] = "Failed to connect to Provider"
+ render :action => "edit"
+ else
+ if @provider.errors.empty? and @provider.save
+ flash[:notice] = "Provider updated."
+ redirect_to admin_providers_path
+ else
+ flash[:notice] = "Cannot update the provider."
+ render :action => 'edit'
+ end
+ end
+ kick_condor
end
def multi_destroy
diff --git a/src/app/views/admin/provider_accounts/_ec2.haml b/src/app/views/admin/provider_accounts/_ec2.haml
index 43c4078..a5beafd 100644
--- a/src/app/views/admin/provider_accounts/_ec2.haml
+++ b/src/app/views/admin/provider_accounts/_ec2.haml
@@ -28,10 +28,6 @@
%span.required *
= file_field :provider_account, :x509_cert_pub_file, :title => t('provider_accounts.form.account_public_cert')
.grid_3.omega
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('provider_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
- = t('provider_accounts.form.test_account')
- )
:javascript
function set_unlimited_quota(elem_id) {
diff --git a/src/app/views/admin/provider_accounts/_gogrid.haml b/src/app/views/admin/provider_accounts/_gogrid.haml
index 421768e..225f972 100644
--- a/src/app/views/admin/provider_accounts/_gogrid.haml
+++ b/src/app/views/admin/provider_accounts/_gogrid.haml
@@ -10,7 +10,3 @@
= label_tag "Quota"
= text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
.grid_3.omega
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('provider_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
- = t('provider_accounts.form.test_account')
- )
diff --git a/src/app/views/admin/provider_accounts/_mock.haml b/src/app/views/admin/provider_accounts/_mock.haml
index 421768e..30fcd38 100644
--- a/src/app/views/admin/provider_accounts/_mock.haml
+++ b/src/app/views/admin/provider_accounts/_mock.haml
@@ -9,8 +9,4 @@
= password_field :provider_account,:password
= label_tag "Quota"
= text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
-.grid_3.omega
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('provider_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
- = t('provider_accounts.form.test_account')
- )
+.grid_3.omega
\ No newline at end of file
diff --git a/src/app/views/admin/provider_accounts/_opennebula.haml b/src/app/views/admin/provider_accounts/_opennebula.haml
index abcf8a2..29d35bc 100644
--- a/src/app/views/admin/provider_accounts/_opennebula.haml
+++ b/src/app/views/admin/provider_accounts/_opennebula.haml
@@ -10,7 +10,3 @@
= label_tag "Quota"
= text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
.grid_3.omega
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('provider_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
- = t('provider_accounts.form.test_account')
- )
diff --git a/src/app/views/admin/provider_accounts/_rackspace.haml b/src/app/views/admin/provider_accounts/_rackspace.haml
index bc99d32..d6dbec9 100644
--- a/src/app/views/admin/provider_accounts/_rackspace.haml
+++ b/src/app/views/admin/provider_accounts/_rackspace.haml
@@ -10,7 +10,3 @@
= label_tag "Quota"
= text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
.grid_3.omega
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('provider_accounts.form.test_account'), :name => 'test_account', :id => 'test_account' }<>
- = t('provider_accounts.form.test_account')
- )
diff --git a/src/app/views/admin/providers/_form.haml b/src/app/views/admin/providers/_form.haml
index df888dc..b400d00 100644
--- a/src/app/views/admin/providers/_form.haml
+++ b/src/app/views/admin/providers/_form.haml
@@ -7,10 +7,6 @@
%fieldset.clear
= form.label :url, 'Provider URL :'
= form.text_field :url, :title => 'provider_url', :value => @provider.url, :class => "grid_5"
- (
- %button.linkbutton.nospace{ :type => 'submit', :value => t('.test_connection'), :name => 'test_connection', :id => 'test_connection' }
- Test connection
- )
%fieldset.clear
= form.label :provider_type
= form.select(:provider_type_id, ProviderType.all.collect {|provider_type| [provider_type.name,provider_type.id] }, :prompt => "Select type of provider")
diff --git a/src/app/views/admin/providers/_properties.haml b/src/app/views/admin/providers/_properties.haml
index 163401e..044895a 100644
--- a/src/app/views/admin/providers/_properties.haml
+++ b/src/app/views/admin/providers/_properties.haml
@@ -2,3 +2,4 @@
Properties for
= @provider.name
= link_to "Edit", edit_admin_provider_path(@provider), {:class => 'button'}
+= link_to "Test", admin_provider_path(@provider, {:test_provider => true}), { :class => 'button' }
diff --git a/src/features/provider.feature b/src/features/provider.feature
index 4b6c50c..34ab613 100644
--- a/src/features/provider.feature
+++ b/src/features/provider.feature
@@ -40,23 +40,17 @@ Feature: Manage Providers
And I should see "Provider added"
And I should have a provider named "testprovider"
- Scenario: Test Provider Connection Successful
+ Scenario: Create a new Provider failure when using wrong url
Given I am on the admin providers page
+ And there is not a provider named "testprovider"
When I follow "Create"
Then I should be on the new admin provider page
When I fill in "provider[name]" with "testprovider"
- And I fill in "provider[url]" with "http://localhost:3001/api"
- And I press "test_connection"
- Then I should see "Successfuly Connected to Provider"
-
- Scenario: Test Provider Connection Failure
- Given I am on the admin providers page
- When I follow "Create"
- Then I should be on the new admin provider page
- When I fill in "provider[name]" with "incorrect_provider"
- And I fill in "provider[url]" with "http://incorrecthost:3001/api"
- And I press "test_connection"
- Then I should see "Failed to Connect to Provider"
+ And I fill in "provider[url]" with "http://localhost:3010/api"
+ And I select "Amazon EC2" from "provider_provider_type_id"
+ And I press "Save"
+ Then I should be on the admin providers page
+ And I should see "Failed to connect to Provider"
Scenario: Delete a provider
Given I am on the homepage
diff --git a/src/features/provider_account.feature b/src/features/provider_account.feature
index e59dab9..14c3574 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -33,27 +33,20 @@ Feature: Manage Provider Accounts
And I should see "Properties for testaccount"
And I should see "Running instances quota: 13"
- Scenario: Test Provider Account Connection Successful
+ Scenario: Create a new Provider Account using wrong credentials
Given there is a provider named "testprovider"
And there are no provider accounts
And I am on the admin provider accounts page
When I follow "New Account"
Then I should be on the new admin provider account page
- When I fill in "provider_account[username]" with "mockuser"
- And I fill in "provider_account[password]" with "mockpassword"
- And I press "Test Account"
- Then I should see "Test Connection Success"
-
- Scenario: Test Provider Account Connection Failure
- Given there is a provider named "testprovider"
- And there are no provider accounts
- And I am on the admin provider accounts page
- When I follow "New Account"
- Then I should be on the new admin provider account page
- When I fill in "provider_account[username]" with "mockuser"
+ And I should see "New Account"
+ When I select "testprovider" from "provider_account_provider_id"
+ And I fill in "provider_account[label]" with "testaccount"
+ And I fill in "provider_account[username]" with "mockuser"
And I fill in "provider_account[password]" with "wrong password"
- And I press "Test Account"
- Then I should see "Test Connection Failed"
+ And I fill in "quota[maximum_running_instances]" with "13"
+ And I press "Add"
+ Then I should see "credential information is incorrect"
Scenario: Delete a provider account
Given there is a provider named "testprovider"
diff --git a/src/spec/controllers/provider_accounts_controller_spec.rb b/src/spec/controllers/provider_accounts_controller_spec.rb
index 567538b..a6d6806 100644
--- a/src/spec/controllers/provider_accounts_controller_spec.rb
+++ b/src/spec/controllers/provider_accounts_controller_spec.rb
@@ -21,14 +21,6 @@ describe Admin::ProviderAccountsController do
response.should render_template("index")
end
- it "allows test account validity on create when passing test_account param" do
- UserSession.create(@admin)
- post :create, :provider_account => {:provider_id => @provider.id}, :test_account => true
- response.should be_success
- response.should render_template("new")
- response.flash[:error].should == "Test Connection Failed: Invalid Account Details"
- end
-
it "doesn't allow to save provider's account if not valid credentials" do
UserSession.create(@admin)
post :create, :provider_account => {:provider_id => @provider.id}
--
1.7.4
12 years, 6 months
[PATCH configure] fix to deltacloud module to only load packages once
by Mo Morsi
---
recipes/aeolus_recipe/aeolus_recipe.pp | 1 -
recipes/aeolus_recipe/manifests/deltacloud.pp | 16 ++++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/recipes/aeolus_recipe/aeolus_recipe.pp b/recipes/aeolus_recipe/aeolus_recipe.pp
index a371845..f2f4110 100644
--- a/recipes/aeolus_recipe/aeolus_recipe.pp
+++ b/recipes/aeolus_recipe/aeolus_recipe.pp
@@ -26,7 +26,6 @@
import "aeolus_recipe/aeolus"
# include the various aeolus components
-include aeolus::deltacloud::core
include aeolus::conductor
include aeolus::image-factory
include aeolus::iwhd
diff --git a/recipes/aeolus_recipe/manifests/deltacloud.pp b/recipes/aeolus_recipe/manifests/deltacloud.pp
index eaab24e..af6da11 100644
--- a/recipes/aeolus_recipe/manifests/deltacloud.pp
+++ b/recipes/aeolus_recipe/manifests/deltacloud.pp
@@ -10,15 +10,23 @@ class aeolus::deltacloud::core {
}
}
-# install the deltacloud component w/ the specified driver
-define aeolus::deltacloud($provider_type="", $port="3002") {
+class aeolus::deltacloud::ec2 {
### Install the driver-specific components
- $enable_ec2_packages = $enable_packages and $provider_type == "ec2"
- if $enable_ec2_packages {
+ if $enable_packages {
# install ec2 support,
package { "rubygem-aws":
provider => 'yum', ensure => 'installed' }
}
+}
+
+
+# install the deltacloud component w/ the specified driver
+define aeolus::deltacloud($provider_type="", $port="3002") {
+ include aeolus::deltacloud::core
+
+ if $provider_type == "ec2" {
+ include aeolus::deltacloud::ec2
+ }
### we need to sync time to communicate w/ cloud providers
include ntp::client
--
1.7.2.3
12 years, 6 months
[PATCH conductor 1/1] Bugzilla: 690960
by Mike Orazi
Moved aeolus user creation to %pre instead of %pre daemons so it is
available when file ownership is defined in %install for the main
package.
---
aeolus-conductor.spec.in | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 8ccc8df..26297ff 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -91,6 +91,12 @@ Documentation and tests for the Aeolus Conductor.
make clean
make
+%pre
+getent group aeolus >/dev/null || /usr/sbin/groupadd -g 451 -r aeolus 2>/dev/null || :
+getent passwd aeolus >/dev/null || \
+ /usr/sbin/useradd -u 451 -g aeolus -c "aeolus" \
+ -s /sbin/nologin -r -d /var/aeolus aeolus 2> /dev/null || :
+
%install
%{__rm} -rf %{buildroot}
@@ -181,12 +187,6 @@ touch %{buildroot}%{app_root}/log/delayed_job.log
#%check
#rake spec
-%pre daemons
-getent group aeolus >/dev/null || /usr/sbin/groupadd -g 451 -r aeolus 2>/dev/null || :
-getent passwd aeolus >/dev/null || \
- /usr/sbin/useradd -u 451 -g aeolus -c "aeolus" \
- -s /sbin/nologin -r -d /var/aeolus aeolus 2> /dev/null || :
-
%post daemons
# Register the services
/sbin/chkconfig --add aeolus-conductor
--
1.7.4
12 years, 6 months