This is the same patchset[1] as last time, just rebased to apply against the lastest HEAD
[1] https://fedorahosted.org/pipermail/aeolus-devel/2012-March/009596.html
--- Rakefile | 2 +- rubygem-aeolus-image.spec.in | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Rakefile b/Rakefile index e43f22b..59cb58b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'rspec/core/rake_task' -require 'rake/rpmtask' +require './rake/rpmtask'
RPMBUILD_DIR = "#{File.expand_path('~')}/rpmbuild" RPM_SPEC = "rubygem-aeolus-image.spec" diff --git a/rubygem-aeolus-image.spec.in b/rubygem-aeolus-image.spec.in index e8eea79..d54bbbf 100644 --- a/rubygem-aeolus-image.spec.in +++ b/rubygem-aeolus-image.spec.in @@ -1,7 +1,12 @@ %global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemname aeolus-image %global geminstdir %{gemdir}/gems/%{gemname}-%{version} +%if 0%{?fedora} > 16 +%global rubyabi 1.9.1 +%else %global rubyabi 1.8 +%endif +
Summary: Ruby Client for interacting with Image Warehouse and Image Factory Name: rubygem-aeolus-image @@ -18,9 +23,6 @@ Requires: rubygems Requires: rubygem(nokogiri) >= 1.4.0 Requires: rubygem(rest-client) Requires: rubygem(oauth) -Requires: rubygem(vcr) -Requires: rubygem(webmock) -Requires: rubygem(timecop)
BuildRequires: ruby BuildRequires: rubygems @@ -56,6 +58,9 @@ rm -rf %{buildroot}%{gemdir}/gems/%{gemname}-%{version}/.yardoc %{gemdir}/specifications/%{gemname}-%{version}.gemspec
%changelog +* Wed Feb 15 2012 Mo Morsi mmorsi@redhat.com - 0.3.0-3 +- updated to ruby 1.9 + * Mon Jan 09 2012 Steve Linabery slinaber@redhat.com - 0.3.0-2 - d0624e1 Add provider_account-filtered 'provider images' method to build model - 8108b42 Remove extra_release from spec.in
Just waiting for fedora 17 to download and i'll test this. Could take a while though tinterweb here is slow.
On 04/17/2012 02:15 PM, Mo Morsi wrote:
Rakefile | 2 +- rubygem-aeolus-image.spec.in | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Rakefile b/Rakefile index e43f22b..59cb58b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'rspec/core/rake_task' -require 'rake/rpmtask' +require './rake/rpmtask'
RPMBUILD_DIR = "#{File.expand_path('~')}/rpmbuild" RPM_SPEC = "rubygem-aeolus-image.spec" diff --git a/rubygem-aeolus-image.spec.in b/rubygem-aeolus-image.spec.in index e8eea79..d54bbbf 100644 --- a/rubygem-aeolus-image.spec.in +++ b/rubygem-aeolus-image.spec.in @@ -1,7 +1,12 @@ %global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemname aeolus-image %global geminstdir %{gemdir}/gems/%{gemname}-%{version} +%if 0%{?fedora}> 16 +%global rubyabi 1.9.1 +%else %global rubyabi 1.8 +%endif
Summary: Ruby Client for interacting with Image Warehouse and Image Factory Name: rubygem-aeolus-image
@@ -18,9 +23,6 @@ Requires: rubygems Requires: rubygem(nokogiri)>= 1.4.0 Requires: rubygem(rest-client) Requires: rubygem(oauth) -Requires: rubygem(vcr) -Requires: rubygem(webmock) -Requires: rubygem(timecop)
BuildRequires: ruby BuildRequires: rubygems @@ -56,6 +58,9 @@ rm -rf %{buildroot}%{gemdir}/gems/%{gemname}-%{version}/.yardoc %{gemdir}/specifications/%{gemname}-%{version}.gemspec
%changelog +* Wed Feb 15 2012 Mo Morsimmorsi@redhat.com - 0.3.0-3 +- updated to ruby 1.9
- Mon Jan 09 2012 Steve Linaberyslinaber@redhat.com - 0.3.0-2
- d0624e1 Add provider_account-filtered 'provider images' method to build model
- 8108b42 Remove extra_release from spec.in
On 04/17/12, Mo Morsi wrote:
Hi,
diff --git a/Rakefile b/Rakefile index e43f22b..59cb58b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'rspec/core/rake_task' -require 'rake/rpmtask' +require './rake/rpmtask'
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
On 17/04/12 15:53 +0200, Michal Fojtik wrote:
On 04/17/12, Mo Morsi wrote:
Hi,
diff --git a/Rakefile b/Rakefile index e43f22b..59cb58b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'rspec/core/rake_task' -require 'rake/rpmtask' +require './rake/rpmtask'
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
-j
-- Michal Fojtik Sr. Software Engineer, Deltacloud API (http://deltacloud.org)
Dne 17.4.2012 16:20, Jason Guiditta napsal(a):
On 17/04/12 15:53 +0200, Michal Fojtik wrote:
On 04/17/12, Mo Morsi wrote:
Hi,
diff --git a/Rakefile b/Rakefile index e43f22b..59cb58b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'rspec/core/rake_task' -require 'rake/rpmtask' +require './rake/rpmtask'
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
https://rubygems.org/gems/backports
?
Vit
-j
-- Michal Fojtik Sr. Software Engineer, Deltacloud API (http://deltacloud.org)
On 17/04/12 16:47 +0200, Vít Ondruch wrote:
Dne 17.4.2012 16:20, Jason Guiditta napsal(a):
On 17/04/12 15:53 +0200, Michal Fojtik wrote:
On 04/17/12, Mo Morsi wrote:
Hi,
diff --git a/Rakefile b/Rakefile index e43f22b..59cb58b 100644 --- a/Rakefile +++ b/Rakefile @@ -19,7 +19,7 @@ require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'rspec/core/rake_task' -require 'rake/rpmtask' +require './rake/rpmtask'
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
https://rubygems.org/gems/backports
?
Vit
Yes, there are a number of those, that is precisely what I was getting at.
-j
On 04/17/12, Vít Ondruch wrote:
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
Thanks Vit for this. Is there any chance to have this packaged? :-)
?
Vit
-j
-- Michal Fojtik Sr. Software Engineer, Deltacloud API (http://deltacloud.org)
Dne 17.4.2012 16:53, Michal Fojtik napsal(a):
On 04/17/12, Vít Ondruch wrote:
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
Thanks Vit for this. Is there any chance to have this packaged? :-)
Of course there is chance, if that is the preferred choice ...
Vit
Hi Mo,
As we discussed I've had a few issues with conductor and aeolus-image with your patches on fedora 17. I tried to get this working with manual setup but still having issues. Unfortunately I'm going to have to nack this patch set until some of the issues are solved. I've put a list below with some output.
Regards
Martyn
* We have 1 test failure in aeolus-image.
Failures:
1) Aeolus::Image::Warehouse::WarehouseModel#== when other object has the same instance variables list with the same values Failure/Error: it { subject.==(other_warehouse_model).should be_true } expected false to be true # ./spec/models/warehouse/warehouse_model_spec.rb:41:in `block (5 levels) in module:Warehouse'
Finished in 0.45152 seconds 109 examples, 1 failure, 4 pending
Failed examples:
rspec ./spec/models/warehouse/warehouse_model_spec.rb:41 # Aeolus::Image::Warehouse::WarehouseModel#== when other object has the same instance variables list with the same values rake aborted!
* Conductor migrations fail:
rake aborted! (/home/martyn/aeolus-tests/conductor/src/config/locales/it.yml): couldn't parse YAML at line 386 column 54
Tasks: TOP => db:migrate (See full trace by running task with --trace) [martyn@vm1 src]$ rake db:migrate --trace Using gem require instead of bundler ========= cucumber/test env deps loaded... ========== ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment Failed to load /home/martyn/aeolus-tests/conductor/src/config/oauth.json, continuing without OAuth support. Run rake dc:oauth_keys and restart Conductor to enable. ** Execute db:migrate rake aborted! (/home/martyn/aeolus-tests/conductor/src/config/locales/it.yml): couldn't parse YAML at line 386 column 54
* We require shadow rubygem for aoelus-configure, puppet dep
* Need to update the conductor spec to remove the fastercsv dependency
On 04/17/2012 04:59 PM, Vít Ondruch wrote:
Dne 17.4.2012 16:53, Michal Fojtik napsal(a):
On 04/17/12, Vít Ondruch wrote:
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
Thanks Vit for this. Is there any chance to have this packaged? :-)
Of course there is chance, if that is the preferred choice ...
Vit
On 04/19/2012 02:02 PM, Martyn Taylor wrote:
Hi Mo,
As we discussed I've had a few issues with conductor and aeolus-image with your patches on fedora 17. I tried to get this working with manual setup but still having issues. Unfortunately I'm going to have to nack this patch set until some of the issues are solved. I've put a list below with some output.
Regards
Martyn
- We have 1 test failure in aeolus-image.
Failures:
- Aeolus::Image::Warehouse::WarehouseModel#== when other object has
the same instance variables list with the same values Failure/Error: it { subject.==(other_warehouse_model).should be_true } expected false to be true # ./spec/models/warehouse/warehouse_model_spec.rb:41:in `block (5 levels) in module:Warehouse'
Finished in 0.45152 seconds 109 examples, 1 failure, 4 pending
Failed examples:
rspec ./spec/models/warehouse/warehouse_model_spec.rb:41 # Aeolus::Image::Warehouse::WarehouseModel#== when other object has the same instance variables list with the same values rake aborted!
Which environment are you testing this on? When I tried this on a stock F16 install w/ the patch applied to the latest aeolus-image HEAD all the tests pass.
On F17 this test fails both before and after this patch is applied so the patch doesn't break anything currently working. I looked into the issue and discovered that pre ruby-1.9 'instance_variables' return an array of string instance variable names, where as in ruby-1.9 an array of symbols is returned [1]. This will be fixed in a subsequent patch with the following change:
--- a/lib/aeolus_image/model/warehouse/warehouse_model.rb +++ b/lib/aeolus_image/model/warehouse/warehouse_model.rb @@ -40,7 +40,7 @@ module Aeolus return false unless instance_variables.sort == other_obj.instance_variables.sort # Otherwise, ensure that they're all the same instance_variables.each do |iv| - next if iv == "@obj" + next if iv == "@obj" || iv == :@obj return false unless other_obj.instance_variable_get(iv) == instance_variable_get(iv) return false unless other_obj.body == body end
Regardless, at this point I'm more concerned that everything still works in the environment which we are currently running / supporting than on a newer stack. Once the patches are in, we can continue testing this out end-to-end in the new environment.
- Conductor migrations fail:
rake aborted! (/home/martyn/aeolus-tests/conductor/src/config/locales/it.yml): couldn't parse YAML at line 386 column 54
Tasks: TOP => db:migrate (See full trace by running task with --trace) [martyn@vm1 src]$ rake db:migrate --trace Using gem require instead of bundler ========= cucumber/test env deps loaded... ========== ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment Failed to load /home/martyn/aeolus-tests/conductor/src/config/oauth.json, continuing without OAuth support. Run rake dc:oauth_keys and restart Conductor to enable. ** Execute db:migrate rake aborted! (/home/martyn/aeolus-tests/conductor/src/config/locales/it.yml): couldn't parse YAML at line 386 column 54
Same comment as above. In any case, this looks like it is a similar issue to the ones fixed with patch 2/4 in the conductor set ("properly quote strings") just in a new locale (one of the ones recently introduced). In any case the fixes from the patch should still be valid for the new locales (will incorporate these into the updated set).
- We require shadow rubygem for aoelus-configure, puppet dep
Yes, ruby-shadow which puppet currently depends on is incompatible w/ Ruby 1.9. rubygem-shadow is being submitted to Fedora (BZ#782560) to replace it at which point puppet will be updated to depend on that.
Since these patches are for the upstream code base, and we aren't building RPMS for F17+ yet, this shouldn't be a blocker to get these patches in. You should be able to pull rubygem-shadow directly from the BZ if you want to test configure atm.
- Need to update the conductor spec to remove the fastercsv dependency
Patch 1/4 of the conductor patches in this set ("update conductor to ruby 1.9") does this:
+%if 0%{?fedora} > 16 +Requires: rubygem(net-ldap) +%else +Requires: rubygem(fastercsv) +Requires: rubygem(ruby-net-ldap) +%endif
In any case, would you mind having another go at the set, primarily focusing on make sure nothing is broken on F16 / ruby 1.8 / our current environment. If all is green on that front, we can just push this and start testing F17 out for a new Aeolus community release.
Appreciate it, -Mo
[1] http://blog.grayproductions.net/articles/getting_code_ready_for_ruby_19
OK updated patchset just sent to list
On 04/19/2012 02:02 PM, Martyn Taylor wrote:
Hi Mo,
As we discussed I've had a few issues with conductor and aeolus-image with your patches on fedora 17. I tried to get this working with manual setup but still having issues. Unfortunately I'm going to have to nack this patch set until some of the issues are solved. I've put a list below with some output.
Regards
Martyn
- We have 1 test failure in aeolus-image.
Failures:
- Aeolus::Image::Warehouse::WarehouseModel#== when other object has
the same instance variables list with the same values Failure/Error: it { subject.==(other_warehouse_model).should be_true } expected false to be true # ./spec/models/warehouse/warehouse_model_spec.rb:41:in `block (5 levels) in module:Warehouse'
Finished in 0.45152 seconds 109 examples, 1 failure, 4 pending
Failed examples:
rspec ./spec/models/warehouse/warehouse_model_spec.rb:41 # Aeolus::Image::Warehouse::WarehouseModel#== when other object has the same instance variables list with the same values rake aborted!
Fixed, aeolus-image-rubygem patch incorporates fix to this.
- Conductor migrations fail:
rake aborted! (/home/martyn/aeolus-tests/conductor/src/config/locales/it.yml): couldn't parse YAML at line 386 column 54
Tasks: TOP => db:migrate (See full trace by running task with --trace) [martyn@vm1 src]$ rake db:migrate --trace Using gem require instead of bundler ========= cucumber/test env deps loaded... ========== ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment Failed to load /home/martyn/aeolus-tests/conductor/src/config/oauth.json, continuing without OAuth support. Run rake dc:oauth_keys and restart Conductor to enable. ** Execute db:migrate rake aborted! (/home/martyn/aeolus-tests/conductor/src/config/locales/it.yml): couldn't parse YAML at line 386 column 54
Fixed, updated / fixed all the locals, the migrations now run on F17.
- We require shadow rubygem for aoelus-configure, puppet dep
ruby-shadow was updated to build against Ruby 1.9 so this is no longer an issue.
- Need to update the conductor spec to remove the fastercsv dependency
This was part of the original patchset, shout out if I missed anything though.
-Mo
On 04/17/2012 04:59 PM, Vít Ondruch wrote:
Dne 17.4.2012 16:53, Michal Fojtik napsal(a):
On 04/17/12, Vít Ondruch wrote:
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
Thanks Vit for this. Is there any chance to have this packaged? :-)
Of course there is chance, if that is the preferred choice ...
Vit
Yes that'd be the preferred alternative, this way we can just require backports in our Rakefile and use require_relative
Until that's in Fedora and we can introduce the dependency would rather just add the explicit path to the few places that need it as that seems to be the quickest solution until we have the correct fix (using backports). If this becomes problematic / out of hand as we start testing things e2e on ruby 1.9 then we can look into temporarily manually adding this method.
-Mo
Dne 26.4.2012 15:43, Mo Morsi napsal(a):
On 04/17/2012 04:59 PM, Vít Ondruch wrote:
Dne 17.4.2012 16:53, Michal Fojtik napsal(a):
On 04/17/12, Vít Ondruch wrote:
I found personally this change to use relate path very frustrating in Ruby 1.9. Fortunately there is a 'helper' in Ruby 1.9 that you can use to stop playing with $. variables:
require_relative 'rake/rpmtask'
In MRI1.8 there is no such method, but in Ruby you can just add it :-)
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end
-- Michal
I like this approach, and woudl suggest we do the same - we may want to consider a -compat package to hold this kind of stuff for ruby 1.8, otherwise we end up with lots of projects duplicating this same block of code. Just a thought.
Thanks Vit for this. Is there any chance to have this packaged? :-)
Of course there is chance, if that is the preferred choice ...
Vit
Yes that'd be the preferred alternative, this way we can just require backports in our Rakefile and use require_relative
Until that's in Fedora and we can introduce the dependency would rather just add the explicit path to the few places that need it as that seems to be the quickest solution until we have the correct fix (using backports). If this becomes problematic / out of hand as we start testing things e2e on ruby 1.9 then we can look into temporarily manually adding this method.
-Mo
https://bugzilla.redhat.com/show_bug.cgi?id=816991
Vit
--- aeolus-conductor.spec.in | 21 ++++++++++++++++++--- src/Gemfile | 4 +++- src/app/models/instance.rb | 3 ++- src/config/application.rb | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in index 93af028..cabe83c 100644 --- a/aeolus-conductor.spec.in +++ b/aeolus-conductor.spec.in @@ -1,6 +1,14 @@ %global app_root %{_datadir}/%{name} %global doc_root %{_datadir}/%{name}-doc
+%if 0%{?fedora} > 16 +%global rubyver 1.9.3 +%global rubyabi 1.9.1 +%else +%global rubyver 1.8.1 +%global rubyabi 1.8 +%endif + Name: aeolus-conductor Version: @VERSION@ Release: 0%{?dist} @@ -17,8 +25,8 @@ URL: http://aeolusproject.org # cp aeolus-conductor-0.3.0.tar.gz ~/rpmbuild/SOURCES Source0: aeolus-conductor-%{version}.tar.gz
-Requires: ruby >= 1.8.1 -Requires: ruby(abi) = 1.8 +Requires: ruby >= %{rubyver} +Requires: ruby(abi) = %{rubyabi} Requires: rubygem(rails) >= 3.0.7 Requires: rubygem(haml) >= 3.1 Requires: rubygem(nokogiri) >= 1.4.0 @@ -41,6 +49,13 @@ Requires: postgresql Requires: postgresql-server Requires: system-logos
+%if 0%{?fedora} > 16 +Requires: rubygem(net-ldap) +%else +Requires: rubygem(fastercsv) +Requires: rubygem(ruby-net-ldap) +%endif + # to ensure the service is actually started # and is accessible in the init script Requires: curl @@ -79,7 +94,6 @@ Summary: Aeolus Conductor development and testing files Group: Applications/Internet Requires: %{name} = %{version}-%{release} Requires: rubygem(cucumber) -Requires: rubygem(rspec) Requires: rubygem(timecop) Requires: rubygem(cucumber-rails) Requires: rubygem(rspec-rails) >= 2.6.1 @@ -90,6 +104,7 @@ Requires: rubygem(vcr) Requires: rubygem(factory_girl_rails) Requires: rubygem(webmock) Requires: rubygem(launchy) +Requires: rubygem(minitest)
%description devel Tests and other development tools for the Aeolus Conductor. diff --git a/src/Gemfile b/src/Gemfile index 2d8e8df..7f26313 100644 --- a/src/Gemfile +++ b/src/Gemfile @@ -17,11 +17,13 @@ gem 'pg' gem 'thin' gem 'json' gem 'railties' -gem 'fastercsv' gem 'rails_warden' gem 'ruby-net-ldap' gem 'aeolus-image' gem 'oauth' +platforms :ruby_18 do + gem 'fastercsv' +end group :development, :test do gem 'rspec-rails' gem 'rspec-core' diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index ee5b8df..2c79b31 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -420,7 +420,8 @@ class Instance < ActiveRecord::Base
def self.csv_export(instances) - csv_string = FasterCSV.generate(:col_sep => ";", :row_sep => "\r\n") do |csv| + csvm = Object.const_defined?(:FasterCSV) ? FasterCSV : CSV + csv_string = csvm.generate(:col_sep => ";", :row_sep => "\r\n") do |csv| event_attributes = Event.new.attributes.keys.reject {|key| key if key == "created_at" || key == "updated_at"}
csv << event_attributes.map {|event| event.capitalize } diff --git a/src/config/application.rb b/src/config/application.rb index d1c2a7b..8aaf5df 100644 --- a/src/config/application.rb +++ b/src/config/application.rb @@ -39,7 +39,7 @@ else require 'pg' require 'thin' require 'json' - require 'fastercsv' + require 'fastercsv' if RUBY_VERSION =~ /1.8..*/ # no longer needed in ruby 1.9+ require 'nokogiri' #require 'railties'
--- src/config/locales/en.yml | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml index a3044ad..aed93f3 100644 --- a/src/config/locales/en.yml +++ b/src/config/locales/en.yml @@ -214,7 +214,7 @@ en: arch: ARCH deployable_xml: Deployable XML show: - name: %{name} Deployment + name: "%{name} Deployment" new: launch: Launch this deployment deployable_definition: Deployable definition @@ -534,8 +534,8 @@ en: new: new_hwp: New Hardware Profile show: - frontend_hwp: %{name} (Front End) - backend_hwp: %{name} (Provider) + frontend_hwp: "%{name} (Front End)" + backend_hwp: "%{name} (Provider)" matching_hwp: Matching Provider Hardware Profiles flash: notice:
--- src/app/controllers/application_controller.rb | 4 ++-- src/app/controllers/deployables_controller.rb | 2 +- .../controllers/hardware_profiles_controller.rb | 2 +- src/app/controllers/images_controller.rb | 2 +- src/app/controllers/instances_controller.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb index db471ba..01b1bc6 100644 --- a/src/app/controllers/application_controller.rb +++ b/src/app/controllers/application_controller.rb @@ -115,7 +115,7 @@ class ApplicationController < ActionController::Base # Returns an array of ids from params[:id], params[:ids]. def ids_list(other_attrs=[]) other_attrs.each do |attr_key| - return params[attr_key].to_a if params.include?(attr_key) + return Array(params[attr_key]) if params.include?(attr_key) end if params[:id].present? return Array(params[:id]) @@ -165,7 +165,7 @@ class ApplicationController < ActionController::Base hash[:object] = ivar[1, ivar.size] hash[:errors] ||= [] val.errors.each {|key,msg| - arr.push([key, msg.to_a].to_a) + arr.push([key, Array(msg)].to_a) } hash[:errors] += arr end diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb index 7d3d744..6916f09 100644 --- a/src/app/controllers/deployables_controller.rb +++ b/src/app/controllers/deployables_controller.rb @@ -38,7 +38,7 @@ class DeployablesController < ApplicationController @image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image]) @hw_profiles = HardwareProfile.frontend.list_for_user(current_user, Privilege::VIEW) @deployable.name = @image.name - @selected_catalogs = params[:catalog_id].to_a + @selected_catalogs = Catalog.find(Array(Array(params[:catalog_id]))) load_catalogs @selected_catalogs.each do |catalog_id| require_privilege(Privilege::CREATE, Deployable, Catalog.find_by_id(catalog_id)) diff --git a/src/app/controllers/hardware_profiles_controller.rb b/src/app/controllers/hardware_profiles_controller.rb index 069e61f..dc19c13 100644 --- a/src/app/controllers/hardware_profiles_controller.rb +++ b/src/app/controllers/hardware_profiles_controller.rb @@ -42,7 +42,7 @@ class HardwareProfilesController < ApplicationController end
def show - @hardware_profile = HardwareProfile.find(params[:id].to_a.first) + @hardware_profile = HardwareProfile.find(Array(params[:id]).first) require_privilege(Privilege::VIEW, @hardware_profile) @title = if @hardware_profile.provider_hardware_profile? t('hardware_profiles.show.backend_hwp', :name => @hardware_profile.name) diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb index cad12f9..e34b130 100644 --- a/src/app/controllers/images_controller.rb +++ b/src/app/controllers/images_controller.rb @@ -347,7 +347,7 @@ class ImagesController < ApplicationController end
def multi_destroy - selected_images = params[:images_selected].to_a + selected_images = Array(params[:images_selected]) selected_images.each do |uuid| image = Aeolus::Image::Warehouse::Image.find(uuid) @environment = PoolFamily.where('name' => image.environment).first diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb index 7773d81..4be3a98 100644 --- a/src/app/controllers/instances_controller.rb +++ b/src/app/controllers/instances_controller.rb @@ -218,7 +218,7 @@ class InstancesController < ApplicationController private
def load_instance - @instance = Instance.find(params[:id].to_a.first) + @instance = Instance.find(Array(params[:id]).first) require_privilege(Privilege::USE,@instance) end
--- .../controllers/permissions_controller_spec.rb | 2 +- src/spec/controllers/pools_controller_spec.rb | 5 ++++- src/spec/models/instance_spec.rb | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/spec/controllers/permissions_controller_spec.rb b/src/spec/controllers/permissions_controller_spec.rb index dedf655..050fdf8 100644 --- a/src/spec/controllers/permissions_controller_spec.rb +++ b/src/spec/controllers/permissions_controller_spec.rb @@ -34,7 +34,7 @@ describe PermissionsController do @permission = FactoryGirl.create(:permission, :user => @admin, :role => @old_role, :permission_object => @deployable)
post :multi_update, :permission_object_id => @deployable.id, :permission_object_type => @deployable.class.to_s, - :permission_role_selected => "#{@permission.id},#{@new_role.id}", :polymorphic_path_extras => { 'catalog_id' => @catalog.id} + :permission_role_selected => ["#{@permission.id},#{@new_role.id}"], :polymorphic_path_extras => { 'catalog_id' => @catalog.id}
response.should redirect_to catalog_deployable_path(@catalog, @deployable) end diff --git a/src/spec/controllers/pools_controller_spec.rb b/src/spec/controllers/pools_controller_spec.rb index 21af9d0..ba68755 100644 --- a/src/spec/controllers/pools_controller_spec.rb +++ b/src/spec/controllers/pools_controller_spec.rb @@ -119,7 +119,10 @@ describe PoolsController do describe "#destroy" do before do @pool = Factory.build(:pool) - Pool.stub!(:find).and_return([@pool]) + @tpool = Factory.build(:tpool) + @pool.save! + @tpool.save! + Pool.stub!(:find).and_return([@pool], @tpool) delete :multi_destroy, :pools_selected => [@pool.id], :format => :json end
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb index edcc68d..11a1a62 100644 --- a/src/spec/models/instance_spec.rb +++ b/src/spec/models/instance_spec.rb @@ -16,6 +16,8 @@
require 'spec_helper'
+require 'csv' + describe Instance do before(:each) do @quota = FactoryGirl.create :quota @@ -257,7 +259,9 @@ describe Instance do end
it "should return csv header string for export" do - reader = CSV::Reader.create(Instance.csv_export([FactoryGirl.create(:instance)])) + reader = CSV.const_defined?(:Reader) ? + CSV::Reader.create(Instance.csv_export([FactoryGirl.create(:instance)])) : + CSV.parse(Instance.csv_export([FactoryGirl.create(:instance)])) header = reader.shift ['Status_code','Event_time','Summary','Source_type','Description','Source_id'].each do |attribute| header[0].split(';').include?(attribute).should be_true
aeolus-devel@lists.fedorahosted.org