Possible bug: Should the default pool be delete-able?
by Justin Clift
Hi all,
Noticed something strange with the Aeolus dev packages from Monday (11th July).
When trying to delete the default pool (default_pool), no error or other
feedback occurs, however the pool does not get deleted. It just keeps in
the list.
This is the case even when there are several pools and the default pool has
been renamed (ie to "old_pool"). Looks like it's just not possible to get rid
of it.
Bug?
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 9 months
Renaming default_pool to "Default Pool"
by Mark McLoughlin
Hey,
In the pools pretty list, the link to the default pool details looks
like:
default_pool Pool details >>
Which looks pretty bad
How about we:
1) Rename default_pool to "Default Pool" - that seems like a much
more human friendly name
2) Add a helper method to make the link "Default Pool Details" rather
than "Default Pool Details Details" e.g.
name = pool.name.endswith("Pool") ? pool.name : "#{pool.name} Pool"
Any thoughts on that?
Cheers,
Mark.
12 years, 9 months
Multi_stop instances redirect fix
by Jirka Tomasek
Its possile to stop instances from diferent views throughout the
application so redirect_to :back is set in multi_stop action. Although
this solution does not work exactly as expected. I will look into it
more on monday.
12 years, 9 months
[PATCH conductor 1/2] remove duplicate has_many deployments
by Tomas Hrcka
---
src/app/models/pool.rb | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index a243e12..f4e44dd 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -44,7 +44,6 @@ class Pool < ActiveRecord::Base
has_many :instances, :dependent => :destroy
belongs_to :quota, :autosave => true, :dependent => :destroy
belongs_to :pool_family
- has_many :deployments
# NOTE: Commented out because images table doesn't have pool_id foreign key?!
#has_many :images, :dependent => :destroy
--
1.7.4.4
12 years, 9 months
[PATCH conductor 1/2] Ensure that the Quota association is never nil
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
The objects that used quota were valid even when the quota was nil. This added
additional complexity to the code and created a semantic confusion (what does
it mean that pool.quota is nil? And how does it differ from
pool.quota.maximum_running_instances being nil?).
This commit adds tests and validation in place to make sure that the quota
association will no longer be allowed to be nil.
Since the code always created the quota association anyway, no migrations
should be necessary.
---
src/app/controllers/users_controller.rb | 1 +
src/app/models/pool.rb | 1 +
src/app/models/pool_family.rb | 1 +
src/app/models/provider_account.rb | 1 +
src/app/models/user.rb | 1 +
src/app/services/graph_service.rb | 2 +-
src/app/services/registration_service.rb | 10 +++++-----
src/spec/models/pool_family_spec.rb | 6 ++++++
src/spec/models/pool_spec.rb | 8 ++++++++
src/spec/models/provider_account_spec.rb | 7 +++++++
src/spec/models/user_spec.rb | 10 +++++++++-
src/spec/services/registration_service_spec.rb | 2 ++
12 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 2707159..1050ec1 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -37,6 +37,7 @@ class UsersController < ApplicationController
require_privilege(Privilege::MODIFY, User) unless current_user.nil?
@user = User.new(params[:user])
+ @user.quota ||= Quota.new
@registration = RegistrationService.new(@user)
unless @registration.save
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index a243e12..eb88c9e 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -49,6 +49,7 @@ class Pool < ActiveRecord::Base
#has_many :images, :dependent => :destroy
validates_presence_of :name
+ validates_presence_of :quota
validates_presence_of :pool_family
validates_inclusion_of :enabled, :in => [true, false]
validates_uniqueness_of :name
diff --git a/src/app/models/pool_family.rb b/src/app/models/pool_family.rb
index 2caa751..b9dd883 100644
--- a/src/app/models/pool_family.rb
+++ b/src/app/models/pool_family.rb
@@ -52,6 +52,7 @@ class PoolFamily < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
+ validates_presence_of :quota
before_destroy :destroyable?
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 9c5f316..7b35408 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -65,6 +65,7 @@ class ProviderAccount < ActiveRecord::Base
validates_presence_of :provider
validates_presence_of :label
validates_uniqueness_of :label
+ validates_presence_of :quota
validate :validate_presence_of_credentials
validate :validate_credentials
validate :validate_unique_username
diff --git a/src/app/models/user.rb b/src/app/models/user.rb
index 9426cf3..f0231e9 100644
--- a/src/app/models/user.rb
+++ b/src/app/models/user.rb
@@ -65,6 +65,7 @@ class User < ActiveRecord::Base
belongs_to :quota, :autosave => true
accepts_nested_attributes_for :quota
+ validates_presence_of :quota
validates_length_of :first_name, :maximum => 255, :allow_blank => true
validates_length_of :last_name, :maximum => 255, :allow_blank => true
diff --git a/src/app/services/graph_service.rb b/src/app/services/graph_service.rb
index c5f3065..bd064e1 100644
--- a/src/app/services/graph_service.rb
+++ b/src/app/services/graph_service.rb
@@ -127,7 +127,7 @@ class GraphService
providers.each do |provider|
running_instances = 0
provider.provider_accounts.each do |account|
- running_instances = running_instances + account.quota.running_instances if account.quota
+ running_instances += account.quota.running_instances
end
if running_instances > 0
pie_opts[:"#{provider.name}"] = running_instances
diff --git a/src/app/services/registration_service.rb b/src/app/services/registration_service.rb
index 277a502..d2e3131 100644
--- a/src/app/services/registration_service.rb
+++ b/src/app/services/registration_service.rb
@@ -6,11 +6,6 @@ class RegistrationService
end
def save
- unless valid?
- @error = "validation failed"
- return false
- end
-
User.transaction do
begin
if @user.quota.nil? || @user.quota.invalid?
@@ -20,6 +15,11 @@ class RegistrationService
:maximum_total_instances => self_service_default_quota.maximum_total_instances)
end
+ unless valid?
+ @error = "validation failed"
+ return false
+ end
+
@user.save!
# perm list in the format:
# "[resource1_key, resource1_role], [resource2_key, resource2_role], ..."
diff --git a/src/spec/models/pool_family_spec.rb b/src/spec/models/pool_family_spec.rb
index ff9a342..4f783a9 100644
--- a/src/spec/models/pool_family_spec.rb
+++ b/src/spec/models/pool_family_spec.rb
@@ -45,4 +45,10 @@ describe PoolFamily do
@pool_family.errors[:name].should =~ /^must only contain.*/
end
+ it "should require quota to be set" do
+ @pool_family.should be_valid
+
+ @pool_family.quota = nil
+ @pool_family.should_not be_valid
+ end
end
diff --git a/src/spec/models/pool_spec.rb b/src/spec/models/pool_spec.rb
index 58ddec4..5fd32dd 100644
--- a/src/spec/models/pool_spec.rb
+++ b/src/spec/models/pool_spec.rb
@@ -48,4 +48,12 @@ describe Pool do
pool.should_not be_destroyable
end
+ it "should require quota to be set" do
+ pool = Factory :pool
+ pool.should be_valid
+
+ pool.quota = nil
+ pool.should_not be_valid
+ end
+
end
diff --git a/src/spec/models/provider_account_spec.rb b/src/spec/models/provider_account_spec.rb
index 02666f1..56cd944 100644
--- a/src/spec/models/provider_account_spec.rb
+++ b/src/spec/models/provider_account_spec.rb
@@ -105,4 +105,11 @@ EOT
acc2.save.should == false
acc2.errors[:base].should include('Only one account is supported per provider')
end
+
+ it "should require quota to be set" do
+ @provider_account.should be_valid
+
+ @provider_account.quota = nil
+ @provider_account.should_not be_valid
+ end
end
diff --git a/src/spec/models/user_spec.rb b/src/spec/models/user_spec.rb
index e7e69c7..acaba19 100644
--- a/src/spec/models/user_spec.rb
+++ b/src/spec/models/user_spec.rb
@@ -10,7 +10,7 @@ describe User do
end
it "should require password confirmation" do
- user = User.new(Factory.attributes_for(:tuser))
+ user = Factory.build :tuser
user.should be_valid
user.password_confirmation = "different password"
user.should_not be_valid
@@ -59,4 +59,12 @@ describe User do
u.errors[:last_name].should =~ /^is too long.*/
end
+ it "should require quota to be set" do
+ user = Factory :tuser
+ user.should be_valid
+
+ user.quota = nil
+ user.should_not be_valid
+ end
+
end
diff --git a/src/spec/services/registration_service_spec.rb b/src/spec/services/registration_service_spec.rb
index 4052d4a..7edb7b7 100644
--- a/src/spec/services/registration_service_spec.rb
+++ b/src/spec/services/registration_service_spec.rb
@@ -9,6 +9,7 @@ describe RegistrationService do
it "should return errors on user when user is missing required fields" do
user = User.new(:login => 'baduser')
+ user.quota = Quota.new
r = RegistrationService.new(user)
r.save.should be_false
user.errors.empty?.should be_false
@@ -91,6 +92,7 @@ describe RegistrationService do
it "doesn't save quota if user save! raise error" do
user_attributes = Factory.attributes_for(:user)
user = User.new(user_attributes)
+ user.quota = Quota.new
user.should_receive(:save!).and_raise(ActiveRecord::RecordInvalid.new(user))
registration_process = RegistrationService.new(user)
--
1.7.4.4
12 years, 9 months
#720342 - Fixes ProviderAccount quotas
by Matt Wagner
I've probably spent a full day digging into why provider account quotas
don't work, and how this might be solved. At the end of the day, it was
a one-liner: we assign the provider account in condormatic instead of
making it happen post-match in dbomatic. As an incidental benefit,
it's a one-line assignment in condormatic, but it permits us to drop a
bit more code in dbomatic. (I also couldn't help myself from fixing
a typo in a comment while I was in there.)
https://bugzilla.redhat.com/show_bug.cgi?id=720342 has a lengthy comment
explaining this; I ended going with option "a".
I'm going to write a test case for this next...
-- Matt
12 years, 9 months
[PATCH 0/2]: Remove solr from the conductor.
by Chris Lalancette
According to my own tests and to Ken, we aren't using search
currently and it doesn't work anyway. Since the packaging of
solr is up in the air, and we aren't even sure we are going to
use solr in the future, just remove it. We can always re-instate
it later, and/or use another search engine.
12 years, 9 months
iwhd-0.97 released [stable]
by Jim Meyering
Here's the latest version of iwhd.
iwhd is Aeolus' (http://aeolusproject.org/)
rule-based cloud-to-cloud image manager.
See the NEWS section below for what's changed.
Here are the compressed sources:
http://people.redhat.com/meyering/iwhd/iwhd-0.97.tar.gz (1.2MB)
http://people.redhat.com/meyering/iwhd/iwhd-0.97.tar.xz (780KB)
Here are the GPG detached signatures[*]:
http://people.redhat.com/meyering/iwhd/iwhd-0.97.tar.gz.sig
http://people.redhat.com/meyering/iwhd/iwhd-0.97.tar.xz.sig
[*] You can use either of the above signature files to verify that
the corresponding file (without the .sig suffix) is intact. First,
be sure to download both the .sig file and the corresponding tarball.
Then, run a command like this:
gpg --verify iwhd-0.97.tar.gz.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver keys.gnupg.net --recv-keys 000BEEEE
and rerun the `gpg --verify' command.
This release was bootstrapped with the following tools:
Autoconf 2.68.73-6cd9
Automake 1.11a
Gnulib v0.0-5460-g4af5eab
--------------------------------------
NEWS
* Noteworthy changes in release 0.97 (2011-07-12) [stable]
** New features
A registration to RHEV-M now returns the ID and diagnostic messages
in the body of reply to POST request. This permits to register the
same image several times, and helps triaging any problems. The old
"ami-id" attribute is retained and remains the same across registration
back-end types.
** Bug fixes
On Fedora systems, /etc/iwhd/conf.js is not overwritten anymore when
upgrading the package (added %config(noreplace)).
Do not leave a value of "pending xxxx" remain in "ami-id" attribute
in case of an error in registration process. When we did, no application
or human administrator could tell if there was an error or a hung
registration.
** Infrastructure
Adapt to jansson-1.2's new, incompatible changed API, so we can build
both with it and the older API.
12 years, 9 months