datatables css minor fixes
by Jan Provazník
This patch slighlty modifies CSS for datatables and jquery.ui.
Disables sorting column highlighting (conflicts with row:hover highlighting).
Fixes images for jquery.ui theme.
14 years
[PATCH aggregator 1/7] Average-Time-to-Submit-time-to-Provider-Task-ModelAverage-Time-to-Submit-time-to-Provider-Task-Model
by Martyn Taylor
From: martyntaylor <mtaylor(a)redhat.com>
---
src/app/models/task.rb | 8 +++++++-
src/app/models/task_observer.rb | 22 ++++++++++++++++++++++
src/db/migrate/20090831140000_create_tasks.rb | 1 +
src/spec/models/task_observer_spec.rb | 24 ++++++++++++++++++++++++
4 files changed, 54 insertions(+), 1 deletions(-)
create mode 100644 src/app/models/task_observer.rb
create mode 100644 src/spec/models/task_observer_spec.rb
diff --git a/src/app/models/task.rb b/src/app/models/task.rb
index 6cb907e..9f23ef2 100644
--- a/src/app/models/task.rb
+++ b/src/app/models/task.rb
@@ -28,6 +28,7 @@ class Task < ActiveRecord::Base
# moved associations here so that nested set :include directives work
STATE_QUEUED = "queued"
+ STATE_PENDING = "pending"
STATE_RUNNING = "running"
STATE_FINISHED = "finished"
STATE_PAUSED = "paused"
@@ -35,7 +36,7 @@ class Task < ActiveRecord::Base
STATE_CANCELED = "canceled"
COMPLETED_STATES = [STATE_FINISHED, STATE_FAILED, STATE_CANCELED]
- WORKING_STATES = [STATE_QUEUED, STATE_RUNNING, STATE_PAUSED]
+ WORKING_STATES = [STATE_QUEUED, STATE_RUNNING, STATE_PAUSED, STATE_PENDING]
validates_inclusion_of :type,
:in => %w( InstanceTask )
@@ -48,6 +49,7 @@ class Task < ActiveRecord::Base
# depending on subclass, action, state
TASK_STATES_OPTIONS = [["Queued", Task::STATE_QUEUED],
+ ["Pending", Task::STATE_PENDING],
["Running", Task::STATE_RUNNING],
["Paused", Task::STATE_PAUSED],
["Finished", Task::STATE_FINISHED],
@@ -92,6 +94,10 @@ class Task < ActiveRecord::Base
ret_val
end
+ def submission_time
+ time.started - time.submitted
+ end
+
def validate
errors.add("created_at", "Task started but does not have the creation time set") if time_started and created_at.nil?
errors.add("time_started", "Task ends but does not have the start time set") if time_ended and time_started.nil?
diff --git a/src/app/models/task_observer.rb b/src/app/models/task_observer.rb
new file mode 100644
index 0000000..3e2d803
--- /dev/null
+++ b/src/app/models/task_observer.rb
@@ -0,0 +1,22 @@
+class TaskObserver < ActiveRecord::Observer
+ def after_save(a_task)
+ if a_task.changed?
+ change = a_task.changes['state']
+ if change
+ update_timestamp(change[0], change[1], a_task)
+ end
+ end
+ end
+
+ def update_timestamp(state_from, state_to, a_task)
+ puts state_to
+ if state_to == Task::STATE_RUNNING
+ a_task.time_started = Time.now
+ elsif state_to == Task::STATE_PENDING
+ a_task.time_submitted = Time.now
+ end
+ end
+
+end
+
+TaskObserver.instance
\ No newline at end of file
diff --git a/src/db/migrate/20090831140000_create_tasks.rb b/src/db/migrate/20090831140000_create_tasks.rb
index a9e099f..2c3e0e2 100644
--- a/src/db/migrate/20090831140000_create_tasks.rb
+++ b/src/db/migrate/20090831140000_create_tasks.rb
@@ -28,6 +28,7 @@ class CreateTasks < ActiveRecord::Migration
t.string :task_target_type
t.string :args
t.timestamp :created_at
+ t.timestamp :time_submitted
t.timestamp :time_started
t.timestamp :time_ended
t.text :message
diff --git a/src/spec/models/task_observer_spec.rb b/src/spec/models/task_observer_spec.rb
new file mode 100644
index 0000000..5d31693
--- /dev/null
+++ b/src/spec/models/task_observer_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe TaskObserver do
+
+ before(:each) do
+ @timestamp = Time.now
+ @task = InstanceTask.new({})
+ end
+
+ it "should set started at timestamp when the task goes to state running" do
+ @task.state = Task::STATE_RUNNING
+ @task.save
+
+ @task.time_started.should >= @timestamp
+ end
+
+ it "should set time submitted timestamp when the task goes to state pending" do
+ @task.state = Task::STATE_PENDING
+ @task.save
+
+ @task.time_submitted.should >= @timestamp
+ end
+
+end
\ No newline at end of file
--
1.6.6.1
14 years
EC2 Mock driver (rev 2)
by Michal Fojtik
Hi,
This patchset allow you to run Cucumber features on EC2 for free ;-)
How ?
Mocking. We have some 'mock' already, but unfortunatelly it work *only* for EC2 and was written for this provider.
After applying this patch, you will see that now mocking is done in nicer and more 'abstract' way and basically it's driver independent.
After brief look to 'base_driver/mock_driver.rb' we can spot block of code which did that job:
def self.wrap_methods(c)
c.class_eval do
cached_methods.each do |m|
alias_method "original_#{m}".to_sym, m.to_sym
define_method m.to_sym do |*args|
args = args.first if args.size.eql?(1) and args.first.class.eql?(Hash)
output = deserialize_data(m, args)
unless output
output = method("original_#{m}".to_sym).to_proc[args]
serialize_data(m, output , args) unless output
end
return output
end
end
end
end
Explanation:
If you include this module into some class, it wraps methods returned from 'cached_methods' class method. Then it takes method arguments and method name and lookup for serialized data.
If there are no serialized data to use, it calls original method and serialize output into Base64 file. When you use this method again, it doesn't call original method but use 'cached' data from mock instead.
There are two nice things:
1. Checksum is created from arguments, so you can call one method with different arguments and this is 'serialized' again and again...
2. For different scenarios you can 'prefix' mock files. (@create-instance, @destroy-instance...)
Some 'sample' data from my EC2 account are included. You can create your own data. All you need to do is write your API credentials into tests/support/ec2/env.rb. Then just run 'rake cucumber' and all output data will be recorded. When you then run this task again, it'll use recorded data instead of connecting to EC2.
Howto start:
1. cd core/tests
2. export API_DRIVER="ec2"
3. rake cucumber
There are still some issues with 'reboot' and 'create' instance, but I hope I'll fix this stuff very soon.
-- Michal
14 years
[Aggregator] Test errors on next
by Jason Guiditta
Anyone else seeing these errors?
rake spec:
1)
ActiveRecord::StatementInvalid in 'Image should have aggregator images
only if it has a pool'
SQLite3::SQLException: providers.name may not be NULL: INSERT INTO
"providers" ("name", "updated_at", "cloud_type", "url", "lock_version",
"created_at") VALUES(NULL, '2010-05-21 14:31:27', NULL, NULL, 0,
'2010-05-21 14:31:27')
/home/jay/.gem/ruby/1.8/gems/factory_girl-1.2.4/lib/factory_girl/proxy/create.rb:6:in `result'
/home/jay/.gem/ruby/1.8/gems/factory_girl-1.2.4/lib/factory_girl/factory.rb:323:in `run'
/home/jay/.gem/ruby/1.8/gems/factory_girl-1.2.4/lib/factory_girl/factory.rb:267:in `create'
./spec/models/image_spec.rb:62:
Finished in 18.541785 seconds
85 examples, 1 failure
Loooong list from rake cucumber:
(::) failed steps (::)
expected: "/account",
got: "/users/show/1" (using ==)
Diff:
@@ -1,2 +1,2 @@
-/account
+/users/show/1
(Spec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:255:in `/^(?:|I )should be on
(.+)$/'
features/authentication.feature:20:in `Then I should be on the account
page'
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id (ActionView::TemplateError)
On line #21 of app/views/dashboard/summary.haml
18: %p
19: Ready to work in the cloud?</p>
20: #getting_started_links
21: %a{:class => "button_link", :href =>
url_for(:controller => :pool, :action => :show, :id =>
@current_users_pool.id)}
22: Go to my personal pool
23: %a{:href => url_for(:controller => :user, :action
=> :pools, :id => @current_user.id)}
24: Show all my pools
app/views/dashboard/summary.haml:21:in
`_run_haml_app47views47dashboard47summary46haml'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/dashboard_controller.rb:29:in `index'
haml (2.2.24) rails/./lib/sass/plugin/rails.rb:20:in `process'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `send'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `do_request'
webrat (0.7.1) lib/webrat/adapters/rails.rb:15:in `get'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `get'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `send'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `process_request'
webrat (0.7.1) lib/webrat/core/session.rb:119:in `request_page'
webrat (0.7.1) lib/webrat/core/session.rb:132:in `request_page'
webrat (0.7.1) lib/webrat/core/elements/form.rb:20:in `submit'
webrat (0.7.1) lib/webrat/core/elements/field.rb:193:in `click'
webrat (0.7.1) lib/webrat/core/scope.rb:291:in `click_button'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `click_button'
webrat (0.7.1) lib/webrat/core/methods.rb:7:in `click_button'
features/step_definitions/authentication.rb:10:in `login'
features/step_definitions/authentication.rb:18:in `__instance_exec0'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`send'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:48:in
`cucumber_instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:69:in
`cucumber_run_with_backtrace_filtering'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:36:in
`cucumber_instance_exec'
cucumber (0.7.3)
bin/./lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/step_match.rb:26:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:62:in
`invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:41:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:99:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:98:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:15:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`each'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:93:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:92:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:54:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:330:in
`before_and_after'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:52:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:319:in `call'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:319:in `around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:13:in `around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:95:in `call'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:95:in
`execute_around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:12:in `around'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:318:in `around'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:316:in `call'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:316:in `around'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:51:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:108:in
`with_visitor'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:45:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:51:in
`visit_feature_element'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:50:in
`visit_feature_element'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:35:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:34:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:34:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:20:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:19:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:29:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:28:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:14:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:13:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:66:in `execute!'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:25:in `execute'
cucumber (0.7.3) bin/cucumber:8
features/authentication.feature:27:in `When I login'
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id (ActionView::TemplateError)
On line #21 of app/views/dashboard/summary.haml
18: %p
19: Ready to work in the cloud?</p>
20: #getting_started_links
21: %a{:class => "button_link", :href =>
url_for(:controller => :pool, :action => :show, :id =>
@current_users_pool.id)}
22: Go to my personal pool
23: %a{:href => url_for(:controller => :user, :action
=> :pools, :id => @current_user.id)}
24: Show all my pools
app/views/dashboard/summary.haml:21:in
`_run_haml_app47views47dashboard47summary46haml'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/dashboard_controller.rb:29:in `index'
haml (2.2.24) rails/./lib/sass/plugin/rails.rb:20:in `process'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `send'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `do_request'
webrat (0.7.1) lib/webrat/adapters/rails.rb:15:in `get'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `get'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `send'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `process_request'
webrat (0.7.1) lib/webrat/core/session.rb:119:in `request_page'
webrat (0.7.1) lib/webrat/core/session.rb:132:in `request_page'
webrat (0.7.1) lib/webrat/core/elements/form.rb:20:in `submit'
webrat (0.7.1) lib/webrat/core/elements/field.rb:193:in `click'
webrat (0.7.1) lib/webrat/core/scope.rb:291:in `click_button'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `click_button'
webrat (0.7.1) lib/webrat/core/methods.rb:7:in `click_button'
features/step_definitions/authentication.rb:10:in `login'
features/step_definitions/authentication.rb:22:in `__instance_exec0'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`send'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:48:in
`cucumber_instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:69:in
`cucumber_run_with_backtrace_filtering'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:36:in
`cucumber_instance_exec'
cucumber (0.7.3)
bin/./lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/step_match.rb:26:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:62:in
`invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:41:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:99:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:98:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:15:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`each'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:93:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:92:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:54:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:330:in
`before_and_after'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:52:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:319:in `call'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:319:in `around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:13:in `around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:95:in `call'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:95:in
`execute_around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:12:in `around'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:318:in `around'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:316:in `call'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:316:in `around'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:51:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:108:in
`with_visitor'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:45:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:51:in
`visit_feature_element'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:50:in
`visit_feature_element'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:35:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:34:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:34:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:20:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:19:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:29:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:28:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:14:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:13:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:66:in `execute!'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:25:in `execute'
cucumber (0.7.3) bin/cucumber:8
features/authentication.feature:39:in `Given I am logged in'
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id (ActionView::TemplateError)
On line #21 of app/views/dashboard/summary.haml
18: %p
19: Ready to work in the cloud?</p>
20: #getting_started_links
21: %a{:class => "button_link", :href =>
url_for(:controller => :pool, :action => :show, :id =>
@current_users_pool.id)}
22: Go to my personal pool
23: %a{:href => url_for(:controller => :user, :action
=> :pools, :id => @current_user.id)}
24: Show all my pools
app/views/dashboard/summary.haml:21:in
`_run_haml_app47views47dashboard47summary46haml'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/dashboard_controller.rb:29:in `index'
haml (2.2.24) rails/./lib/sass/plugin/rails.rb:20:in `process'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `send'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `do_request'
webrat (0.7.1) lib/webrat/adapters/rails.rb:15:in `get'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `get'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `send'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `process_request'
webrat (0.7.1) lib/webrat/core/session.rb:119:in `request_page'
webrat (0.7.1) lib/webrat/core/session.rb:132:in `request_page'
webrat (0.7.1) lib/webrat/core/elements/form.rb:20:in `submit'
webrat (0.7.1) lib/webrat/core/elements/field.rb:193:in `click'
webrat (0.7.1) lib/webrat/core/scope.rb:291:in `click_button'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `click_button'
webrat (0.7.1) lib/webrat/core/methods.rb:7:in `click_button'
features/step_definitions/authentication.rb:10:in `login'
features/step_definitions/authentication.rb:22:in `__instance_exec0'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`send'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:48:in
`cucumber_instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:69:in
`cucumber_run_with_backtrace_filtering'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:36:in
`cucumber_instance_exec'
cucumber (0.7.3)
bin/./lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/step_match.rb:26:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:62:in
`invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:41:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:99:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:98:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:15:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`each'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:93:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:92:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:54:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:330:in
`before_and_after'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:52:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:319:in `call'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:319:in `around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:13:in `around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:95:in `call'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:95:in
`execute_around'
cucumber (0.7.3)
bin/./lib/cucumber/language_support/language_methods.rb:12:in `around'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:318:in `around'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:316:in `call'
cucumber (0.7.3) bin/./lib/cucumber/step_mother.rb:316:in `around'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:51:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:108:in
`with_visitor'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:45:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:51:in
`visit_feature_element'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:50:in
`visit_feature_element'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:35:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:34:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:34:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:20:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:19:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:29:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:28:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:14:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:13:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:66:in `execute!'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:25:in `execute'
cucumber (0.7.3) bin/cucumber:8
features/authentication.feature:50:in `Given I am logged in'
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id (ActionView::TemplateError)
On line #21 of app/views/dashboard/summary.haml
18: %p
19: Ready to work in the cloud?</p>
20: #getting_started_links
21: %a{:class => "button_link", :href =>
url_for(:controller => :pool, :action => :show, :id =>
@current_users_pool.id)}
22: Go to my personal pool
23: %a{:href => url_for(:controller => :user, :action
=> :pools, :id => @current_user.id)}
24: Show all my pools
app/views/dashboard/summary.haml:21:in
`_run_haml_app47views47dashboard47summary46haml'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
haml (2.2.24) rails/./lib/haml/helpers/action_view_mods.rb:13:in
`render_without_mock_proxy'
/home/jay/.gem/ruby/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/dashboard_controller.rb:29:in `index'
haml (2.2.24) rails/./lib/sass/plugin/rails.rb:20:in `process'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `send'
webrat (0.7.1) lib/webrat/adapters/rails.rb:50:in `do_request'
webrat (0.7.1) lib/webrat/adapters/rails.rb:15:in `get'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `get'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `send'
webrat (0.7.1) lib/webrat/core/session.rb:280:in `process_request'
webrat (0.7.1) lib/webrat/core/session.rb:119:in `request_page'
webrat (0.7.1) lib/webrat/core/session.rb:132:in `request_page'
webrat (0.7.1) lib/webrat/core/elements/form.rb:20:in `submit'
webrat (0.7.1) lib/webrat/core/elements/field.rb:193:in `click'
webrat (0.7.1) lib/webrat/core/scope.rb:291:in `click_button'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `click_button'
webrat (0.7.1) lib/webrat/core/methods.rb:7:in `click_button'
features/step_definitions/authentication.rb:10:in `login'
features/step_definitions/authentication.rb:22:in `__instance_exec0'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`send'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:26:in
`instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:48:in
`cucumber_instance_exec'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:69:in
`cucumber_run_with_backtrace_filtering'
cucumber (0.7.3) bin/./lib/cucumber/core_ext/instance_exec.rb:36:in
`cucumber_instance_exec'
cucumber (0.7.3)
bin/./lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/step_match.rb:26:in `invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:62:in
`invoke'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_invocation.rb:41:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:99:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:98:in
`visit_step'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:15:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`each'
cucumber (0.7.3) bin/./lib/cucumber/ast/step_collection.rb:14:in
`accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:93:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:92:in
`visit_steps'
cucumber (0.7.3) bin/./lib/cucumber/ast/background.rb:38:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/background.rb:48:in
`with_visitor'
cucumber (0.7.3) bin/./lib/cucumber/ast/scenario.rb:108:in
`with_visitor'
cucumber (0.7.3) bin/./lib/cucumber/ast/background.rb:47:in
`with_visitor'
cucumber (0.7.3) bin/./lib/cucumber/ast/background.rb:36:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:57:in
`visit_background'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:56:in
`visit_background'
cucumber (0.7.3) bin/./lib/cucumber/ast/feature.rb:33:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:20:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:19:in
`visit_feature'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:29:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:17:in `each'
cucumber (0.7.3) bin/./lib/cucumber/ast/features.rb:28:in `accept'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:14:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:164:in
`broadcast'
cucumber (0.7.3) bin/./lib/cucumber/ast/tree_walker.rb:13:in
`visit_features'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:66:in `execute!'
cucumber (0.7.3) bin/./lib/cucumber/cli/main.rb:25:in `execute'
cucumber (0.7.3) bin/cucumber:8
features/pool.feature:8:in `And I am logged in'
Failing Scenarios:
cucumber features/authentication.feature:7 # Scenario: Register as new
user
cucumber features/authentication.feature:24 # Scenario: Log in as
registered user
cucumber features/authentication.feature:38 # Scenario: Edit profile
cucumber features/authentication.feature:49 # Scenario: log out
cucumber features/pool.feature:10 # Scenario: Create a new Pool
8 scenarios (5 failed, 2 skipped, 1 passed)
67 steps (5 failed, 48 skipped, 14 passed)
14 years, 1 month
[PATCH aggregator 7/7] Updated Auditing for Instance/Task
by Martyn Taylor
From: martyntaylor <mtaylor(a)redhat.com>
---
src/app/models/instance_observer.rb | 2 +-
src/app/models/task_observer.rb | 2 +-
src/app/util/taskomatic.rb | 23 ++++++++++++++++-------
src/config/environment.rb | 4 +++-
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/app/models/instance_observer.rb b/src/app/models/instance_observer.rb
index 283991d..fa5b3d2 100644
--- a/src/app/models/instance_observer.rb
+++ b/src/app/models/instance_observer.rb
@@ -1,6 +1,6 @@
class InstanceObserver < ActiveRecord::Observer
- def after_save(an_instance)
+ def before_save(an_instance)
if an_instance.changed?
change = an_instance.changes['state']
if change
diff --git a/src/app/models/task_observer.rb b/src/app/models/task_observer.rb
index d1834c4..98252b0 100644
--- a/src/app/models/task_observer.rb
+++ b/src/app/models/task_observer.rb
@@ -2,7 +2,7 @@ class TaskObserver < ActiveRecord::Observer
END_STATES = [ Task::STATE_CANCELED, Task::STATE_FAILED, Task::STATE_FINISHED ]
- def after_save(a_task)
+ def before_save(a_task)
if a_task.changed?
change = a_task.changes['state']
if change
diff --git a/src/app/util/taskomatic.rb b/src/app/util/taskomatic.rb
index e66bb62..74e069c 100644
--- a/src/app/util/taskomatic.rb
+++ b/src/app/util/taskomatic.rb
@@ -45,8 +45,6 @@ class Taskomatic
def instance_create
- @task.time_started = Time.now
-
begin
client = @task.instance.cloud_account.connect
realm = @task.instance.realm.external_key rescue nil
@@ -55,9 +53,13 @@ class Taskomatic
unless @task.instance.image.provider_image?
@task.instance.image = @task.instance.image.provider_images[0]
end
+
unless @task.instance.hardware_profile.provider_hardware_profile?
@task.instance.hardware_profile = @task.instance.hardware_profile.provider_hardware_profiles[0]
end
+
+ @task.state = Task::STATE_PENDING
+ @task.save!
dcloud_instance = client.create_instance((a)task.instance.image.external_key,
:flavor => @task.instance.hardware_profile.external_key,
:realm => realm,
@@ -65,6 +67,11 @@ class Taskomatic
if dcloud_instance.class == Net::HTTPInternalServerError
@task.instance.state = Instance::STATE_CREATE_FAILED
raise "Error creating dcloud instance, returned internal server error."
+ @task.state = TASK::STATE_FAILED
+ @task.failure_code = Task::FAILURE_PROVIDER_CONTACT_FAILED
+ else
+ @task.state = Task::STATE_RUNNING
+ @task.save!
end
@logger.info "Task instance create completed with key #{dcloud_instance.id} and state #{dcloud_instance.state}"
@@ -77,7 +84,7 @@ class Taskomatic
else
@task.state = Task::STATE_FINISHED
end
- @task.time_ended = Time.now
+
@task.save!
end
@@ -87,6 +94,9 @@ class Taskomatic
begin
client = @task.instance.cloud_account.connect
dcloud_instance = client.instance((a)task.instance.external_key)
+
+ @task.state = Task::STATE_PENDING
+ @task.save!
dcloud_instance.send(action)
@task.instance.state = dcloud_to_instance_state(dcloud_instance.state)
@@ -98,7 +108,6 @@ class Taskomatic
else
@task.state = Task::STATE_FINISHED
end
- @task.time_ended = Time.now
@task.save!
end
@@ -121,6 +130,8 @@ class Taskomatic
client = @task.instance.cloud_account.connect
dcloud_instance = client.instance((a)task.instance.external_key)
+ @task.state = Task::STATE_PENDING
+ @task.save!
dcloud_instance.destroy!
@logger.info("Task Destroy completed.")
@@ -130,7 +141,6 @@ class Taskomatic
else
@task.state = Task::STATE_FINISHED
end
- @task.time_ended = Time.now
@task.save!
end
@@ -153,5 +163,4 @@ class Taskomatic
end
end
end
-end
-
+end
\ No newline at end of file
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 141642b..1721126 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -40,13 +40,14 @@ Rails::Initializer.run do |config|
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "aws-s3", :lib => "aws/s3"
- config.gem "gettext", :lib => "gettext_rails"
+ config.gem "gettext", :lib => "gettext_rails"
config.gem "gettext", :lib => "gettext_activerecord"
config.gem "authlogic"
config.gem "deltacloud-client", :lib => "deltacloud"
config.gem "haml"
config.gem "will_paginate"
+ config.active_record.observers = :instance_observer, :task_observer
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
@@ -75,4 +76,5 @@ Rails::Initializer.run do |config|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
+
end
--
1.6.6.1
14 years, 1 month
paginated image/instance listing
by Jan Provazník
patch 1: adds rails_datatables plugin to vendors (gem doesn't exist yet, I've made some improvements), this plugin is used as view helper for jquery datatables plugin
patch 2: upgrades jquery and jquery-ui to actual version and adds datatables support
patch 3: removes image dependency on pool - fixed links and create instance form
images/instances are listed in datatables, listing is paginated and searchable
14 years, 1 month
Broken deltacloud-client
by Mo Morsi
It seems the deltacloud-client is quite broken / out of date. Case in
point, it hasn't been updated since last November, there are still many
references to flavors, and running 'rake spec' from a fresh checkout
results in 34 failures (and this is with a running mock core instance
which it should be able to reach via localhost:3000).
I tried spending some time debugging this but there are too many
failures and I have some other higher priority items on the queue. I can
probably take a look at it eventually, but it might be worthwhile for
someone more familiar w/ the client to look at it / fix the errors (this
was causing the errors I was getting when reviewing one of mtaylor's
patches).
-Mo
14 years, 1 month