David, works fine... Thanks! On Wed, Mar 16, 2011 at 8:21 PM, David Lutterkort <[email protected]> wrote: > On Wed, 2011-03-16 at 12:23 -0300, Felipe Cardoso Martins wrote: >> David, >> >> reading the source I understand the problem, look the source >> "deltacloud/trunk/server/lib/deltacloud/base_driver/base_driver.rb" >> >> def filter_hardware_profiles(profiles, opts) >> if opts >> if v = opts[:architecture] >> profiles = profiles.select { |hwp| hwp.include?(:architecture, v) } >> end >> if v = opts[:name] >> profiles = profiles.select { |hwp| hwp.name == v } >> end >> end >> profiles >> end >> >> What is wrong, source or documentation? > > The source - we advertise that you can filter by id in the API, so we > need to make sure that's what the code does. The patch below fixes that. > Unfortunately, I can't get all the tests to run (client tests segfault, > and feature tests abort rake, not sure yet what's happening there) > > David > > From ba2e74cba6d6eb0b981f3b799406b111b938858c Mon Sep 17 00:00:00 2001 > From: David Lutterkort <[email protected]> > Date: Wed, 16 Mar 2011 16:13:42 -0700 > Subject: [PATCH] Make filtering of HWP by id work > > --- > server/lib/deltacloud/base_driver/base_driver.rb | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/server/lib/deltacloud/base_driver/base_driver.rb > b/server/lib/deltacloud/base_driver/base_driver.rb > index 2442385..77257ee 100644 > --- a/server/lib/deltacloud/base_driver/base_driver.rb > +++ b/server/lib/deltacloud/base_driver/base_driver.rb > @@ -68,7 +68,7 @@ module Deltacloud > end > > def hardware_profile(credentials, name) > - hardware_profiles(credentials, :name => name).first > + hardware_profiles(credentials, :id => name).first > end > > def filter_hardware_profiles(profiles, opts) > @@ -76,7 +76,8 @@ module Deltacloud > if v = opts[:architecture] > profiles = profiles.select { |hwp| hwp.include?(:architecture, v) } > end > - if v = opts[:name] > + # As a request param, we call 'name' 'id' > + if v = opts[:id] > profiles = profiles.select { |hwp| hwp.name == v } > end > end > @@ -86,7 +87,7 @@ module Deltacloud > def find_hardware_profile(credentials, name, image_id) > hwp = nil > if name > - unless hwp = hardware_profiles(credentials, :name => name).first > + unless hwp = hardware_profiles(credentials, :id => name).first > raise BackendError.new(400, "bad-hardware-profile-name", > "Hardware profile '#{name}' does not exist", nil) > end > -- > 1.7.4 > > > >
-- Abraço, Felipe Cardoso Martins [email protected] http://www.linkedin.com/in/felipecardosomartins “O segredo do prazer no trabalho pode ser resumido em uma palavra: excelência. Saber como fazer bem algo é ter prazer nisso. ” Pearl Buck
