[PATCH conductor] Fix pools_controller.spec failures due to formatting changes in rails
by Richard Su
The formatting changed with a different version of rails.
The check on the text was removed. Check on the HTTP response code,
404, is sufficient.
---
src/spec/controllers/pools_controller_spec.rb | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/src/spec/controllers/pools_controller_spec.rb b/src/spec/controllers/pools_controller_spec.rb
index 31cd31c..b890c19 100644
--- a/src/spec/controllers/pools_controller_spec.rb
+++ b/src/spec/controllers/pools_controller_spec.rb
@@ -183,8 +183,6 @@ describe PoolsController do
response.status.should be_eql(404)
response.should have_content_type("application/xml")
response.body.should be_xml
- xml = Nokogiri::XML(response.body)
- xml.xpath("/error/message").text.should == "Couldn't find Pool with ID=-1"
end
end
@@ -237,8 +235,6 @@ describe PoolsController do
response.status.should be_eql(404)
response.should have_content_type("application/xml")
response.body.should be_xml
- xml = Nokogiri::XML(response.body)
- xml.xpath("/error/message").text.should == "Couldn't find Pool with ID=-1"
end
it "update with blank name" do
@@ -274,8 +270,6 @@ describe PoolsController do
response.status.should be_eql(404)
response.should have_content_type("application/xml")
response.body.should be_xml
- xml = Nokogiri::XML(response.body)
- xml.xpath("/error/message").text.should == "Couldn't find Pool with ID=-1"
end
it "delete default pool should throw error" do
--
1.7.7.6
11 years, 8 months
[PATCH conductor] Revert valid_credentials change in spec_helper.rb
by Richard Su
The method was commented out in the ProviderAccount create patchset
and caused over 100 spec failures.
---
src/spec/spec_helper.rb | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/spec/spec_helper.rb b/src/spec/spec_helper.rb
index ae89927..30ab1d6 100644
--- a/src/spec/spec_helper.rb
+++ b/src/spec/spec_helper.rb
@@ -84,9 +84,9 @@ ProviderAccount.class_eval do
nil
end
-# def valid_credentials?
-# true
-# end
+ def valid_credentials?
+ true
+ end
end
RSpec.configure do |config|
--
1.7.7.6
11 years, 8 months
[PATCH conductor 1/2] BZ821341: template_xml: show the same errors as CLI
by Maros Zatko
From: Maros Zatko <mzatko(a)redhat.com>
---
src/app/controllers/images_controller.rb | 8 ++++----
src/app/models/template_xml.rb | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index c3ca98c..af2bacc 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -234,8 +234,8 @@ class ImagesController < ApplicationController
begin
doc = TemplateXML.new(xml_source)
- rescue Nokogiri::XML::SyntaxError
- errors = [t('template_xml.errors.xml_parse_error')]
+ rescue Nokogiri::XML::SyntaxError => e
+ errors = [e.message]
else
doc.name = @name unless @name.blank?
@name = doc.name
@@ -259,8 +259,8 @@ class ImagesController < ApplicationController
begin
doc = TemplateXML.new(@xml)
- rescue Nokogiri::XML::SyntaxError
- errors = [t('template_xml.errors.xml_parse_error')]
+ rescue Nokogiri::XML::SyntaxError => e
+ errors = [e.message]
else
@name = doc.name
errors = doc.validate
diff --git a/src/app/models/template_xml.rb b/src/app/models/template_xml.rb
index 323b4e0..6462f36 100644
--- a/src/app/models/template_xml.rb
+++ b/src/app/models/template_xml.rb
@@ -38,8 +38,8 @@ class TemplateXML
def self.validate(xmlstr)
begin
doc = TemplateXML.new(xmlstr)
- rescue Nokogiri::XML::SyntaxError
- return [I18n.t('template_xml.errors.xml_parse_error')]
+ rescue Nokogiri::XML::SyntaxError => e
+ return [e.message]
end
return doc.validate
end
--
1.7.10.4
11 years, 8 months
security update
by Mo Morsi
I created a feature in redmine to track the remaining work on the
security backlog generated from the last audit. It can be found here:
https://www.aeolusproject.org/redmine/issues/3693
By this point the process should be fairly established, the remaining
work is largely a continuation / repetition of the work already done to
cover the remaining controllers / models (plus a few specific things
that need to be taken care of). The patches that have been pushed to the
codebase so far should serve as a good example on how to proceed on this
front.
As always I'm looking for assistance w/ the security backlog so things
move along faster. Appreciate it.
-Mo
11 years, 8 months
[PATCH conductor] Fix upstream cuke failures in deployment.feature - RM 3720-3726
by Richard Su
https://www.aeolusproject.org/redmine/issues/3720
https://www.aeolusproject.org/redmine/issues/3721
https://www.aeolusproject.org/redmine/issues/3722
https://www.aeolusproject.org/redmine/issues/3723
https://www.aeolusproject.org/redmine/issues/3724
https://www.aeolusproject.org/redmine/issues/3725
https://www.aeolusproject.org/redmine/issues/3726
Stubbed ProviderAccount.connect to return a mock
Deltacloud::API connection.
There is one test where a valid connection is not desired:
"Stop inaccessible deployments". In this test the original
stub on ProviderAccount.connect is replaced by a new stub
that returns nil.
---
src/features/step_definitions/deployment_steps.rb | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/features/step_definitions/deployment_steps.rb b/src/features/step_definitions/deployment_steps.rb
index d9e80bc..862c3e4 100644
--- a/src/features/step_definitions/deployment_steps.rb
+++ b/src/features/step_definitions/deployment_steps.rb
@@ -1,9 +1,23 @@
+def mock_deltacloud
+ @deltacloud_connection = mock("Deltacloud::API")
+ @deltacloud_state = mock("Deltacloud::API::InstanceState")
+ @transitions = Array.new
+ deltacloud_transition = mock("Deltacloud::API::Transition")
+ deltacloud_transition.stub(:to).and_return('running')
+ deltacloud_transition.stub(:action).and_return('stop')
+ @transitions << deltacloud_transition
+ @deltacloud_state.stub(:transitions).and_return(@transitions)
+ @deltacloud_connection.stub(:instance_state).and_return(@deltacloud_state)
+ ProviderAccount.any_instance.stub(:connect).and_return(@deltacloud_connection)
+end
+
Given /^there is a deployment named "([^"]*)" belonging to "([^"]*)" owned by "([^"]*)"$/ do |deployment_name, deployable_name, owner_name|
user = FactoryGirl.create(:user, :login => owner_name, :last_name => owner_name)
@deployment = Factory.create(:deployment, {:name => deployment_name, :pool => Pool.first, :owner => user})
instance = Factory.create(:instance, {:deployment => @deployment})
@deployment.instances << instance
@deployment.save
+ mock_deltacloud
end
When /^I check "([^"]*)" deployment/ do |name|
@@ -30,6 +44,7 @@ Given /^a deployment "([^"]*)" exists$/ do |arg1|
instance = Factory.create(:instance, {:deployment => @deployment})
@deployment.instances << instance
end
+ mock_deltacloud
@deployment
end
@@ -47,6 +62,7 @@ Given /^"([^"]*)" deployment's provider is not accessible$/ do |arg1|
# cleanly
provider = @deployment.provider
provider.update_attribute(:url, 'http://localhost:3002/invalid_api')
+ ProviderAccount.any_instance.stub(:connect).and_return(nil)
end
When /^I am viewing the deployment "([^"]*)"$/ do |arg1|
--
1.7.7.6
11 years, 8 months
[PATCH conductor 1/2] Adjusts RSpec tests depending on outdated strings
by Matt Wagner
---
.../api/provider_images_controller_spec.rb | 2 +-
.../controllers/config_servers_controller_spec.rb | 10 +++++-----
.../controllers/deployables_controller_spec.rb | 2 +-
src/spec/controllers/pools_controller_spec.rb | 2 +-
.../provider_accounts_controller_spec.rb | 2 +-
src/spec/models/config_server_spec.rb | 2 +-
src/spec/models/instance_spec.rb | 4 ++--
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/spec/controllers/api/provider_images_controller_spec.rb b/src/spec/controllers/api/provider_images_controller_spec.rb
index 51a2e9a..9e6f75e 100644
--- a/src/spec/controllers/api/provider_images_controller_spec.rb
+++ b/src/spec/controllers/api/provider_images_controller_spec.rb
@@ -255,7 +255,7 @@ describe Api::ProviderImagesController do
it "should have error" do
resp = Hash.from_xml(response.body)
resp['error']['code'].should == "InsufficientParametersSupplied"
- resp['error']['message'].should == "No provider account given"
+ resp['error']['message'].should == "No Provider Account given"
end
end
end
diff --git a/src/spec/controllers/config_servers_controller_spec.rb b/src/spec/controllers/config_servers_controller_spec.rb
index 65d5de0..d9c3161 100644
--- a/src/spec/controllers/config_servers_controller_spec.rb
+++ b/src/spec/controllers/config_servers_controller_spec.rb
@@ -88,7 +88,7 @@ describe ConfigServersController do
}
response.should be_success
response.should render_template("new")
- request.flash[:error].should == "The config server information is invalid."
+ request.flash[:error].should == "The config Server information is invalid."
end
it "should fail creating a config server when the endpoint is invalid" do
@@ -103,7 +103,7 @@ describe ConfigServersController do
}
response.should be_success
response.should render_template("new")
- request.flash[:error].should == "The config server information is invalid."
+ request.flash[:error].should == "The config Server information is invalid."
end
it "should require that endpoint is provided" do
@@ -116,7 +116,7 @@ describe ConfigServersController do
}
response.should be_success
response.should render_template("new")
- request.flash[:error].should == "The config server information is invalid."
+ request.flash[:error].should == "The config Server information is invalid."
end
it "should require that key is provided" do
@@ -129,7 +129,7 @@ describe ConfigServersController do
}
response.should be_success
response.should render_template("new")
- request.flash[:error].should == "The config server information is invalid."
+ request.flash[:error].should == "The config Server information is invalid."
end
it "should require that secret is provided" do
@@ -142,7 +142,7 @@ describe ConfigServersController do
}
response.should be_success
response.should render_template("new")
- request.flash[:error].should == "The config server information is invalid."
+ request.flash[:error].should == "The config Server information is invalid."
end
end
end
diff --git a/src/spec/controllers/deployables_controller_spec.rb b/src/spec/controllers/deployables_controller_spec.rb
index e952dbf..49546d8 100644
--- a/src/spec/controllers/deployables_controller_spec.rb
+++ b/src/spec/controllers/deployables_controller_spec.rb
@@ -49,7 +49,7 @@ describe DeployablesController do
Catalog.stub(:list_for_user).and_return(Catalog.includes(:pool).where("1=0"))
HardwareProfile.stub(:list_for_user).and_return([mock(HardwareProfile)])
get :new, :create_from_image => @image.id
- flash[:error].should eql(["No catalog exists! Please create one."])
+ flash[:error].should eql(["No Catalog exists. Please create one."])
end
end
end
diff --git a/src/spec/controllers/pools_controller_spec.rb b/src/spec/controllers/pools_controller_spec.rb
index 87cdcdb..c61ebcd 100644
--- a/src/spec/controllers/pools_controller_spec.rb
+++ b/src/spec/controllers/pools_controller_spec.rb
@@ -286,7 +286,7 @@ describe PoolsController do
response.should have_content_type("application/xml")
response.body.should be_xml
xml = Nokogiri::XML(response.body)
- xml.xpath("/error/message").text.should == "The default pool cannot be deleted"
+ xml.xpath("/error/message").text.should == "The default Pool cannot be deleted"
end
end
end
diff --git a/src/spec/controllers/provider_accounts_controller_spec.rb b/src/spec/controllers/provider_accounts_controller_spec.rb
index 10327eb..8b9fc97 100644
--- a/src/spec/controllers/provider_accounts_controller_spec.rb
+++ b/src/spec/controllers/provider_accounts_controller_spec.rb
@@ -48,7 +48,7 @@ describe ProviderAccountsController do
post :create, :provider_account => {:provider_id => @provider.id, :credentials_hash => {}}, :provider_id => @provider.id
response.should be_success
response.should render_template("new")
- request.flash[:error].should == "Cannot add the provider account."
+ request.flash[:error].should == "Cannot add the Provider account."
end
it "should permit users with account modify permission to access edit cloud account interface" do
diff --git a/src/spec/models/config_server_spec.rb b/src/spec/models/config_server_spec.rb
index 68916df..1b6bd0a 100644
--- a/src/spec/models/config_server_spec.rb
+++ b/src/spec/models/config_server_spec.rb
@@ -47,7 +47,7 @@ describe ConfigServer do
it "should report an error when unauthorized" do
@config_server.should_not be_valid
- @config_server.errors.full_messages.join(" ").should include("Could not validate config server connection")
+ @config_server.errors.full_messages.join(" ").should include("Could not validate Config Server connection")
end
end
end
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index 87dd77d..44d76be 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -309,7 +309,7 @@ describe Instance do
pf = instance.pool.pool_family
pf.provider_accounts = [FactoryGirl.create(:disabled_provider_account)]
errors = instance.matches.last
- errors.find {|e| e =~ /provider must be enabled/}.should_not be_nil
+ errors.find {|e| e =~ /provider must be enabled/i}.should_not be_nil
end
it "should not be launchable if its pool is disabled" do
@@ -374,6 +374,6 @@ describe Instance do
matches, errors = @instance.matches
matches.should be_empty
errors.should_not be_empty
- errors.select {|e| e.include?("no config server available") }.should_not be_empty
+ errors.select {|e| e.include?("no Config Server available") }.should_not be_empty
end
end
--
1.7.7.6
11 years, 8 months
[PATCH conductor] Fix session expiration/backbone interaction
by Scott Seago
The prior commit logs the user out on any backbone request
that comes in more than 15 minutes after login. This modifies the
behavior to log out only if 15 minutes have passed since the last
non-backbone request.
---
src/app/controllers/application_controller.rb | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index 92e7e30..8808b7e 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -462,9 +462,24 @@ class ApplicationController < ActionController::Base
#before filter to invalidate session for backbone
def check_session
- return unless request.format == :json
- session_entity = SessionEntity.find_by_session_id(current_session)
- logout if session_entity.present? && session_entity.created_at < 15.minutes.ago
+ # FIXME: we really need a better "is it backbone?" test than json format
+ # since other actions (ajax API calls from UI, etc) could also use json
+ if request.format == :json
+ # compare to last non-backbone reqest time
+ last_time = session[:last_active_request]
+ if last_time
+ logout if last_time < 15.minutes.ago
+ else
+ # This isn't really an active reqest, but
+ # boostrapping session time if none set
+ # (should really only happen the first time this code is
+ # introduced and there's a non-expired session
+ session[:last_active_request] = Time.now
+ end
+ else
+ # reset last active request time
+ session[:last_active_request] = Time.now
+ end
end
end
--
1.7.6.5
11 years, 8 months
[Still Failing] aeolusproject/conductor#74 (master - cfdf5be)
by Travis CI
Build Update for aeolusproject/conductor
-------------------------------------
Build: #74
Status: Still Failing
Duration: 10 minutes and 17 seconds
Commit: cfdf5be (master)
Author: Scott Seago
Message: Fixes bug relating to provider account routing.
Since provider accounts are only accessible via a nested route, link_to(@account)
fails without an explicit provider_account_path method.
This is a short-term hack to make the profile page work again, the real fix
is to remove the nested route for provider accounts, since there's really
no need for it -- just like we don't nest routes for pools, instances, etc.
Signed-off-by: Matt Wagner <matt.wagner(a)redhat.com>
View the changeset: https://github.com/aeolusproject/conductor/compare/e8ea044f9c14...cfdf5be...
View the full build log and details: http://travis-ci.org/aeolusproject/conductor/builds/2144256
--
You can configure recipients for build notifications in your .travis.yml file. See http://bit.ly/lCybCJ
The delivery of this notification was kindly sponsored by Postmark. Send transactional email confidently using http://postmarkapp.com
11 years, 8 months
[PATCH conductor] Fixes bug relating to provider account routing.
by Scott Seago
Since provider accounts are only accessible via a nested route, link_to(@account)
fails without an explicit provider_account_path method.
This is a short-term hack to make the profile page work again, the real fix
is to remove the nested route for provider accounts, since there's really
no need for it -- just like we don't nest routes for pools, instances, etc.
---
src/app/helpers/application_helper.rb | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/app/helpers/application_helper.rb b/src/app/helpers/application_helper.rb
index 6ddee96..5569071 100644
--- a/src/app/helpers/application_helper.rb
+++ b/src/app/helpers/application_helper.rb
@@ -167,6 +167,11 @@ module ApplicationHelper
will_paginate(collection, :previous_label => t('will_paginate.previous_label'), :next_label => t('will_paginate.next_label'))
end
+ # FIXME: remove this once we remove nested routes for provider accounts.
+ def provider_account_path(account)
+ "/providers/#{account.provider_id}/provider_accounts/#{account.id}"
+ end
+
module_function :count_uptime
class FormBuilderWithRequiredFields < ActionView::Helpers::FormBuilder
--
1.7.6.5
11 years, 8 months