Permalink
Browse files

refs #9430, RightAws: Issue 54: regression in right_ec2_ebs.rb

  • Loading branch information...
konstantin
konstantin committed Mar 8, 2011
1 parent 0171b9e commit 10466cc21964bfa1524b66a443e41c0b2fb3307f
Showing with 20 additions and 4 deletions.
  1. +12 −2 lib/ec2/right_ec2.rb
  2. +8 −2 lib/ec2/right_ec2_ebs.rb
View
@@ -144,9 +144,19 @@ def describe_resources_with_list_and_options(remote_function_name, remote_item_n
# 'RemoteFunctionName' -> :remote_funtion_name
cache_name = remote_function_name.right_underscore.to_sym
list, options = AwsUtils::split_items_and_params(list_and_options)
+ # Resource IDs to fetch
request_hash = amazonize_list(remote_item_name, list)
- request_hash.merge!(amazonize_list(['Filter.?.Name', 'Filter.?.Value.?'], options[:filters])) unless options[:filters].right_blank?
- cache_for = (list.right_blank? && options[:filters].right_blank?) ? cache_name : nil
+ # Other custom options
+ options.each do |key, values|
+ next if values.right_blank?
+ case key
+ when :filters then
+ request_hash.merge!(amazonize_list(['Filter.?.Name', 'Filter.?.Value.?'], values))
+ else
+ request_hash.merge!(amazonize_list(key.to_s.right_camelize, values))
+ end
+ end
+ cache_for = (list.right_blank? && options.right_blank?) ? cache_name : nil
link = generate_request(remote_function_name, request_hash)
request_cache_or_info(cache_for, link, parser_class, @@bench, cache_for, &block)
rescue Exception
View
@@ -145,7 +145,9 @@ def detach_volume(volume_id, instance_id=nil, device=nil, force=nil)
# Describe EBS snapshots.
#
- # Accepts a list of snapshots and/or a set of filters as the last parameter.
+ # Accepts a list of snapshots and/or options: :restorable_by, :owner and :filters
+ #
+ # Options: :restorable_by => Array or String, :owner => Array or String, :filters => Hash
#
# Filters: description, owner-alias, owner-id, progress, snapshot-id, start-time, status, tag-key,
# tag-value, tag:key, volume-id, volume-size
@@ -168,7 +170,11 @@ def detach_volume(volume_id, instance_id=nil, device=nil, force=nil)
# :aws_volume_size=>180,
# :aws_status=>"completed"}, ...]
#
- # ec2.describe_snapshots(:filters => {'tag:MyTag' => 'MyValue'))
+ # ec2.describe_snapshots("snap-e676e28a", "snap-e176e281")
+ #
+ # ec2.describe_snapshots(:restorable_by => ['123456781234'],
+ # :owner => ['self', 'amazon'],
+ # :filters => {'tag:MyTag' => 'MyValue'})
#
# P.S. filters: http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeSnapshots.html
#

0 comments on commit 10466cc

Please sign in to comment.