Redmine#1808 aeolus-image list work
by Martyn Taylor
Resent 1 and 2, for ease of review.
These patches do not include spec tests. Reason for making this decision:
a) We do not have a HTTP mock setup to produce mock responses
b) Hashing aeolus-image out is higher priority that setting up a)
c) Given a) and b) it would mean tests would have to rely on entries in conductor and iwhd
d) As with other tests in aeolus-image we would have to rewrite the tests once we adding a mocking feature
12 years, 9 months
[PATCH conductor] BZ 717661 - provider can have only one account
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/app/models/provider_account.rb | 13 +++++++++++--
src/spec/models/provider_account_spec.rb | 12 ++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 88ebe5b..9c5f316 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -68,6 +68,8 @@ class ProviderAccount < ActiveRecord::Base
validate :validate_presence_of_credentials
validate :validate_credentials
validate :validate_unique_username
+ before_create :no_account?
+ before_destroy :destroyable?
def validate_presence_of_credentials
provider.provider_type.credential_definitions.each do |cd|
@@ -92,8 +94,15 @@ class ProviderAccount < ActiveRecord::Base
return true
end
- # Hooks
- before_destroy :destroyable?
+ def no_account?
+ #if provider.provider_accounts.empty?
+ if provider.provider_accounts.empty?
+ return true
+ else
+ errors.add(:base, "Only one account is supported per provider")
+ return false
+ end
+ end
def object_list
super << provider
diff --git a/src/spec/models/provider_account_spec.rb b/src/spec/models/provider_account_spec.rb
index 2c3c090..02666f1 100644
--- a/src/spec/models/provider_account_spec.rb
+++ b/src/spec/models/provider_account_spec.rb
@@ -93,4 +93,16 @@ EOT
provider_account1.credentials_hash.should == provider_account2.credentials_hash
provider_account2.should be_valid
end
+
+ it "should fail to create more than one account per provider" do
+ provider = Factory :mock_provider
+ acc1 = Factory(:mock_provider_account, :provider => provider)
+ acc2 = Factory.build(:mock_provider_account, :provider => provider)
+ acc2.stub!(:valid_credentials?).and_return(true)
+ acc2.stub!(:validate_unique_username).and_return(true)
+ provider.provider_accounts << acc1
+ provider.provider_accounts << acc2
+ acc2.save.should == false
+ acc2.errors[:base].should include('Only one account is supported per provider')
+ end
end
--
1.7.4
12 years, 9 months
[PATCH aeolus] BZ 714287 Remove 'uptime' from UI elements
by steve linabery
Since the uptime attribute is not currently accurate/reliable, remove it from the UI until such time as it is.
Another temp commit message
---
src/app/controllers/pools_controller.rb | 1 -
src/app/views/deployments/_deployment.haml | 2 --
src/app/views/deployments/_filter_view.haml | 2 --
src/app/views/deployments/_filter_view_show.haml | 4 +---
src/app/views/deployments/_operation.haml | 2 --
src/app/views/deployments/_pretty_view_show.haml | 3 ---
src/app/views/instances/_properties.haml | 3 ---
src/app/views/pools/_deployments.haml | 3 ---
8 files changed, 1 insertions(+), 19 deletions(-)
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index 9e3b060..14788a8 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -228,7 +228,6 @@ class PoolsController < ApplicationController
{ :name => '', :sortable => false },
{ :name => t("deployments.deployment_name"), :sortable => false },
{ :name => t("deployables.index.base_deployable"), :sortable => false },
- { :name => t("uptime"), :sortable => false },
{ :name => t("instances.instances"), :sortable => false },
{ :name => t("providers.provider"), :sortable => false }
]
diff --git a/src/app/views/deployments/_deployment.haml b/src/app/views/deployments/_deployment.haml
index 1815fda..03cfbdc 100644
--- a/src/app/views/deployments/_deployment.haml
+++ b/src/app/views/deployments/_deployment.haml
@@ -3,8 +3,6 @@
= link_to(deployment.name, deployment)
%ul
%li
- = count_uptime(deployment.created_at)
- %li
= deployment.instances.count
Instances
%p
diff --git a/src/app/views/deployments/_filter_view.haml b/src/app/views/deployments/_filter_view.haml
index 9812547..e805263 100644
--- a/src/app/views/deployments/_filter_view.haml
+++ b/src/app/views/deployments/_filter_view.haml
@@ -9,8 +9,6 @@
%td
= deployment.deployable_xml.name
%td
- = count_uptime(deployment.created_at)
- %td
= deployment.instances.count
%td
= link_to(deployment.provider.provider_type.name, deployment.provider) if deployment.provider
diff --git a/src/app/views/deployments/_filter_view_show.haml b/src/app/views/deployments/_filter_view_show.haml
index 642e1ea..1aec6ab 100644
--- a/src/app/views/deployments/_filter_view_show.haml
+++ b/src/app/views/deployments/_filter_view_show.haml
@@ -1,6 +1,6 @@
%header
%h2 Instances
-= filter_table([{:name =>''}, {:name => ''}, {:name => 'Name'}, {:name => 'Uptime'}, {:name => 'Public Address'}, {:name => 'State'}], @deployment.instances) do |instance|
+= filter_table([{:name =>''}, {:name => ''}, {:name => 'Name'}, {:name => 'Public Address'}, {:name => 'State'}], @deployment.instances) do |instance|
%tr
%td
%input{:name => "instance_selected[]", :type => "checkbox", :value => instance.id, :id => "instance_checkbox_#{instance.id}" }
@@ -9,8 +9,6 @@
%td
= instance.name
%td
- = count_uptime(instance.created_at)
- %td
= instance.public_addresses
%td
= instance.state
diff --git a/src/app/views/deployments/_operation.haml b/src/app/views/deployments/_operation.haml
index 4462cd2..34da8dc 100644
--- a/src/app/views/deployments/_operation.haml
+++ b/src/app/views/deployments/_operation.haml
@@ -1,7 +1,5 @@
%h3 Operational status of #{(a)deployment.name}
-Uptime:
-= count_uptime((a)deployment.created_at)
%br
Count of instances:
= @deployment.instances.count
diff --git a/src/app/views/deployments/_pretty_view_show.haml b/src/app/views/deployments/_pretty_view_show.haml
index 9b4840e..aacb80f 100644
--- a/src/app/views/deployments/_pretty_view_show.haml
+++ b/src/app/views/deployments/_pretty_view_show.haml
@@ -6,9 +6,6 @@
= instance.name
%ul
%li
- Uptime:
- = count_uptime(instance.created_at)
- %li
IP Address:
= instance.public_addresses
%li
diff --git a/src/app/views/instances/_properties.haml b/src/app/views/instances/_properties.haml
index 38b3ecc..e59d881 100644
--- a/src/app/views/instances/_properties.haml
+++ b/src/app/views/instances/_properties.haml
@@ -33,9 +33,6 @@
= label_tag :instantiation_time, 'Instantiation Time'
%span= @instance.created_at.strftime("%d-%b-%Y %H:%M:%S")
%li
- = label_tag :uptime, 'Uptime'
- %span= @instance.total_state_time((a)instance.state)
- %li
= label_tag :current_alerts, 'Current Alerts'
%span= 0
%li
diff --git a/src/app/views/pools/_deployments.haml b/src/app/views/pools/_deployments.haml
index ea2ddb3..cdd99ad 100644
--- a/src/app/views/pools/_deployments.haml
+++ b/src/app/views/pools/_deployments.haml
@@ -6,9 +6,6 @@
= link_to deployment.name, deployment_path(deployment)
%dl.statistics
%ul
- %li.left
- %dt.uptime Uptime
- %dd= count_uptime(deployment.created_at || Time.now)
%li.right
%dt.instances.count Instances
%dd= deployment.instances.count || 0
\ No newline at end of file
--
1.7.4.4
12 years, 9 months
#671 - BZ 691562 fix
by Matt Wagner
Hi all,
I spent a bit of time tracking down the remnants of #671 / BZ 651562, in
which Apache throws proxy timeout errors because the backend does not
respond in time as a result of API calls timing out.
Most of these errors were fixed a bit ago in deltacloud-client, but it
seems that the versions yum and gem know about don't have this fix, so
the issue was seemingly not fixed. I spent a bit getting deltacloud
0.3.0 running, and was unable to reproduce any errors with Apache
timeouts after attempting to simulate unreachable providers and other
cases where a timeout may occur. The timeouts in deltacloud-client are
slightly shorter than Apache's timeout value.
I'm attaching a patch that cleans up error handling in Conductor
slightly. There were a few spots (e.g., adding a new ProviderAccount
when the provider was unreachable) where the timeout exception was
reaching the user unhandled. This exception now triggers as a
flash[:error] message when raised, in lieu of a hard error.
You will need the 0.3.0 version of deltacloud to test this. (Some older
versions may work, but best not to chance it.) You can build this from
their source, although I suspect some of you already the 0.3.0 RC
installed.
-- Matt
12 years, 9 months
[PATCH aeolus] BZ 714287 Remove 'uptime' from UI elements
by steve linabery
Since the uptime attribute is not currently accurate/reliable, remove it from the UI until such time as it is.
Another temp commit message
---
src/app/controllers/pools_controller.rb | 1 -
src/app/views/deployments/_deployment.haml | 2 --
src/app/views/deployments/_filter_view.haml | 2 --
src/app/views/deployments/_filter_view_show.haml | 4 +---
src/app/views/deployments/_operation.haml | 2 --
src/app/views/deployments/_pretty_view_show.haml | 3 ---
src/app/views/instances/_properties.haml | 3 ---
src/app/views/pools/_deployments.haml | 3 ---
8 files changed, 1 insertions(+), 19 deletions(-)
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index 9e3b060..14788a8 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -228,7 +228,6 @@ class PoolsController < ApplicationController
{ :name => '', :sortable => false },
{ :name => t("deployments.deployment_name"), :sortable => false },
{ :name => t("deployables.index.base_deployable"), :sortable => false },
- { :name => t("uptime"), :sortable => false },
{ :name => t("instances.instances"), :sortable => false },
{ :name => t("providers.provider"), :sortable => false }
]
diff --git a/src/app/views/deployments/_deployment.haml b/src/app/views/deployments/_deployment.haml
index 1815fda..03cfbdc 100644
--- a/src/app/views/deployments/_deployment.haml
+++ b/src/app/views/deployments/_deployment.haml
@@ -3,8 +3,6 @@
= link_to(deployment.name, deployment)
%ul
%li
- = count_uptime(deployment.created_at)
- %li
= deployment.instances.count
Instances
%p
diff --git a/src/app/views/deployments/_filter_view.haml b/src/app/views/deployments/_filter_view.haml
index 9812547..e805263 100644
--- a/src/app/views/deployments/_filter_view.haml
+++ b/src/app/views/deployments/_filter_view.haml
@@ -9,8 +9,6 @@
%td
= deployment.deployable_xml.name
%td
- = count_uptime(deployment.created_at)
- %td
= deployment.instances.count
%td
= link_to(deployment.provider.provider_type.name, deployment.provider) if deployment.provider
diff --git a/src/app/views/deployments/_filter_view_show.haml b/src/app/views/deployments/_filter_view_show.haml
index 642e1ea..1aec6ab 100644
--- a/src/app/views/deployments/_filter_view_show.haml
+++ b/src/app/views/deployments/_filter_view_show.haml
@@ -1,6 +1,6 @@
%header
%h2 Instances
-= filter_table([{:name =>''}, {:name => ''}, {:name => 'Name'}, {:name => 'Uptime'}, {:name => 'Public Address'}, {:name => 'State'}], @deployment.instances) do |instance|
+= filter_table([{:name =>''}, {:name => ''}, {:name => 'Name'}, {:name => 'Public Address'}, {:name => 'State'}], @deployment.instances) do |instance|
%tr
%td
%input{:name => "instance_selected[]", :type => "checkbox", :value => instance.id, :id => "instance_checkbox_#{instance.id}" }
@@ -9,8 +9,6 @@
%td
= instance.name
%td
- = count_uptime(instance.created_at)
- %td
= instance.public_addresses
%td
= instance.state
diff --git a/src/app/views/deployments/_operation.haml b/src/app/views/deployments/_operation.haml
index 4462cd2..34da8dc 100644
--- a/src/app/views/deployments/_operation.haml
+++ b/src/app/views/deployments/_operation.haml
@@ -1,7 +1,5 @@
%h3 Operational status of #{(a)deployment.name}
-Uptime:
-= count_uptime((a)deployment.created_at)
%br
Count of instances:
= @deployment.instances.count
diff --git a/src/app/views/deployments/_pretty_view_show.haml b/src/app/views/deployments/_pretty_view_show.haml
index 9b4840e..aacb80f 100644
--- a/src/app/views/deployments/_pretty_view_show.haml
+++ b/src/app/views/deployments/_pretty_view_show.haml
@@ -6,9 +6,6 @@
= instance.name
%ul
%li
- Uptime:
- = count_uptime(instance.created_at)
- %li
IP Address:
= instance.public_addresses
%li
diff --git a/src/app/views/instances/_properties.haml b/src/app/views/instances/_properties.haml
index 38b3ecc..e59d881 100644
--- a/src/app/views/instances/_properties.haml
+++ b/src/app/views/instances/_properties.haml
@@ -33,9 +33,6 @@
= label_tag :instantiation_time, 'Instantiation Time'
%span= @instance.created_at.strftime("%d-%b-%Y %H:%M:%S")
%li
- = label_tag :uptime, 'Uptime'
- %span= @instance.total_state_time((a)instance.state)
- %li
= label_tag :current_alerts, 'Current Alerts'
%span= 0
%li
diff --git a/src/app/views/pools/_deployments.haml b/src/app/views/pools/_deployments.haml
index ea2ddb3..cdd99ad 100644
--- a/src/app/views/pools/_deployments.haml
+++ b/src/app/views/pools/_deployments.haml
@@ -6,9 +6,6 @@
= link_to deployment.name, deployment_path(deployment)
%dl.statistics
%ul
- %li.left
- %dt.uptime Uptime
- %dd= count_uptime(deployment.created_at || Time.now)
%li.right
%dt.instances.count Instances
%dd= deployment.instances.count || 0
\ No newline at end of file
--
1.7.4.4
12 years, 9 months
[PATCH conductor] Fix compatibility with the new Deltacloud client
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
The latest update of the Deltacloud client in Fedora made a change that broke
our current code:
When getting a Hardware Profile Property that a given Hardware Profile object
didn't have, the old client returned `nil` while the new one raises
`NoMethodError`.
Example of where this happens is the Mock driver. It has a Hardware Profile
called "Opaque" which doesn't have any properties defined.
This change of behaviour caused our test to fail and made it impossible to add
the Mock provider via the UI.
This fixes the Conductor code so that it's compatible with both versions of
the Deltacloud client. Later we may want to deprecate the older clients and
simplify the code somewhat.
---
src/app/models/hardware_profile.rb | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index 06461c4..c9a4a14 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -96,10 +96,19 @@ class HardwareProfile < ActiveRecord::Base
end
def add_properties(api_profile)
- self.memory = new_property(api_profile.memory || default_profile(:memory))
- self.storage = new_property(api_profile.storage || default_profile(:storage))
- self.cpu = new_property(api_profile.cpu || default_profile(:cpu))
- self.architecture = new_property(api_profile.architecture || default_profile(:architecture))
+ self.memory = property_from_api_or_default(api_profile, :memory)
+ self.storage = property_from_api_or_default(api_profile, :storage)
+ self.cpu = property_from_api_or_default(api_profile, :cpu)
+ self.architecture = property_from_api_or_default(api_profile, :architecture)
+ end
+
+ def property_from_api_or_default(api_profile, attribute)
+ prop = nil
+ begin
+ prop = api_profile.send(attribute)
+ rescue NoMethodError
+ end
+ new_property(prop || default_profile(attribute))
end
# If there is no property (nil on the API), create a default
--
1.7.4.4
12 years, 9 months
[PATCH conductor] Enhanced match method
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Added check for matching HW profile
---
src/app/models/instance.rb | 4 ++++
src/spec/models/instance_spec.rb | 7 +++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index aba031b..c34d647 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -325,6 +325,10 @@ class Instance < ActiveRecord::Base
# hardware_profile that can satisfy the input hardware_profile
hwp = HardwareProfile.match_provider_hardware_profile(account.provider,
hardware_profile)
+ unless hwp
+ errors << "#{account.name}: hardware profile match not found"
+ next
+ end
account_images = provider_images.select {|pi| pi.provider == account.provider}
if account_images.empty?
errors << "#{account.name}: image is not pushed to this provider account"
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index de2154c..5856951 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -153,6 +153,13 @@ describe Instance do
@instance.matches.last.should include('testaccount: image is not pushed to this provider account')
end
+ it "shouldn't match provider accounts where matching hardware profile not found" do
+ account = Factory(:mock_provider_account, :label => 'testaccount')
+ account.provider.hardware_profiles.destroy_all
+ @pool.pool_family.provider_accounts << account
+ @instance.matches.last.should include('testaccount: hardware profile match not found')
+ end
+
it "should return a match if all requirements are satisfied" do
build = @instance.image_build || @instance.image.latest_build
provider = Factory(:mock_provider, :name => build.provider_images.first.provider_name)
--
1.7.4
12 years, 9 months
[PATCH conductor] Add delete confirmation to Pools filter view pages
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
This is somewhat related to the bug #717538
https://bugzilla.redhat.com/show_bug.cgi?id=717538
When a table of objects was loaded via ajax (for example by switching to the
Filter View), the javascript click handlers set up in `multiDestroyValidation`
under application.js were lost.
As a result, some Delete buttons no longer asked for confirmation on delete.
---
src/public/javascripts/application.js | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/public/javascripts/application.js b/src/public/javascripts/application.js
index 975cf92..e6b5c42 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -147,7 +147,7 @@ var Conductor = {
},
multiDestroyValidation: function() {
- $('#delete_button').click(function(e) {
+ $('#delete_button').live('click', function(e) {
if ($(".checkbox_table input[@type=radio]:checked").length == 0) {
alert('Please make a selection before clicking Delete button.');
e.preventDefault();
--
1.7.4.4
12 years, 9 months
New condor semi-barfs with "semanage" problem
by Justin Clift
Hi Chris,
Just tried a new install of our testing packages, from a fresh F14 vm.
Noticed something interesting printed out by yum, from what seems to
be the new condor install package:
Installing : condor-7.6.0-5dcloud.fc14.x86_64
/var/tmp/rpm-tmp.To4kH9: line 5: semanage: command not found
Installing : condor-deltacloud-gahp-7.6.0-5dcloud.fc14.x86_64
Any idea if "semanage" is part of a post install script for condor or
something?
Note - this weirdness didn't cause yum to fail. Yum didn't seem to
notice the problem, and I only saw it by accident when scrolling back
through the console output looking for something.
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 9 months
[PATCH conductor] BZ 717172 - fixed realm mapping deletion
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Added class "checkbox_table" to mapping lists (this class is required for using
global delete confirm hook). Class name is little bit confusing, but this view
will be reworked anyway.
---
src/app/views/realms/_mapping.haml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/views/realms/_mapping.haml b/src/app/views/realms/_mapping.haml
index dea5cda..f89cc8b 100644
--- a/src/app/views/realms/_mapping.haml
+++ b/src/app/views/realms/_mapping.haml
@@ -5,7 +5,7 @@
- unless @backend_provider_targets.empty?
%h2 Realm '#{(a)realm.name}' is mapped to providers:
- %ul
+ %ul{:class => 'checkbox_table'}
- @backend_provider_targets.each do |backend|
%li
%input{:name => "id[]", :type => "checkbox", :value => backend.id, :id => "backend_id_#{backend.id}"}
@@ -13,7 +13,7 @@
- unless @backend_realm_targets.empty?
%h2 Realm '#{(a)realm.name}' is mapped to realms:
- %ul
+ %ul{:class => 'checkbox_table'}
- @backend_realm_targets.each do |backend|
%li
%input{:name => "id[]", :type => "checkbox", :value => backend.id, :id => "backend_id_#{backend.id}"}
--
1.7.4
12 years, 9 months