Skip to content

Commit

Permalink
Merge branch 'master' of github.com:appoxy/aws
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Reeder committed Jan 2, 2011
2 parents 78cef8b + da3e954 commit a5b997f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION.yml
@@ -1,5 +1,5 @@
---
:major: 2
:minor: 3
:patch: 32
:patch: 34
:build:
4 changes: 2 additions & 2 deletions aws.gemspec
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = %q{aws}
s.version = "2.3.32"
s.version = "2.3.34"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Travis Reeder", "Chad Arimura", "RightScale"]
s.date = %q{2010-12-19}
s.date = %q{2010-12-22}
s.description = %q{AWS Ruby Library for interfacing with Amazon Web Services.}
s.email = %q{travis@appoxy.com}
s.extra_rdoc_files = [
Expand Down
9 changes: 7 additions & 2 deletions lib/s3/right_s3.rb
Expand Up @@ -232,7 +232,7 @@ def keys(options={}, head=false)
# p service #=> {"max-keys"=>"2", "prefix"=>"logs", "name"=>"my_awesome_bucket", "marker"=>"", "is_truncated"=>true}
#
def keys_and_service(options={}, head=false)
opt = {}; options.each { |key, value| opt[key.to_s] = value }
opt = {}; options.each { |key, value| opt[key.to_s] = value }
service_data = {}
thislist = {}
list = []
Expand Down Expand Up @@ -364,6 +364,11 @@ def delete(force=false)
force ? @s3.interface.force_delete_bucket(@name) : @s3.interface.delete_bucket(@name)
end

# Deletes an object from s3 in this bucket.
def delete_key(key)
@s3.interface.delete(name, key)
end

# Return a list of grantees.
#
def grantees
Expand Down Expand Up @@ -615,7 +620,7 @@ def reload_meta
# key.reload_meta #=> {"family"=>"oops", "race" => "troll"}
#
def save_meta(meta_headers)
meta = self.class.add_meta_prefix(meta_headers)
meta = self.class.add_meta_prefix(meta_headers)
@bucket.s3.interface.copy(@bucket.name, @name, @bucket.name, @name, :replace, meta)
@meta_headers = self.class.split_meta(meta)[1]
end
Expand Down
15 changes: 13 additions & 2 deletions lib/sdb/right_sdb_interface.rb
Expand Up @@ -381,6 +381,7 @@ def put_attributes(domain_name, item_name, attributes, replace = false, options=

def create_domain_if_not_exist(ex, domain_name)
if ex.message().index("NoSuchDomain")
puts "Creating domain: #{domain_name}"
create_domain(domain_name)
return true
end
Expand All @@ -389,7 +390,7 @@ def create_domain_if_not_exist(ex, domain_name)

#
# items is an array of Aws::SdbInterface::Item.new(o.id, o.attributes, true)
def batch_put_attributes(domain_name, items)
def batch_put_attributes(domain_name, items, options={})
params = {'DomainName' => domain_name}
i = 0
items.each do |item|
Expand All @@ -399,7 +400,17 @@ def batch_put_attributes(domain_name, items)
i += 1
end
link = generate_request("BatchPutAttributes", params)
request_info(link, QSdbSimpleParser.new)
begin
request_info(link, QSdbSimpleParser.new, options)
rescue Aws::AwsError => ex
# puts "RESCUED in batch_put_attributes: " + $!
if options[:create_domain] && create_domain_if_not_exist(ex, domain_name)
options.delete(:create_domain)
batch_put_attributes(domain_name, items, options)
else
raise ex
end
end
rescue Exception
on_exception
end
Expand Down

0 comments on commit a5b997f

Please sign in to comment.