Permalink
Browse files

Merge remote-tracking branch 'internal/public_right_aws' into develop…

…ment
  • Loading branch information...
2 parents acc080b + bdcd8e3 commit 0d7cfc09a09bdf4ee779279f8b13d6335c37529f konstantin committed Dec 7, 2011
Showing with 26 additions and 10 deletions.
  1. +3 −1 lib/ec2/right_ec2_images.rb
  2. +18 −4 lib/s3/right_s3.rb
  3. +5 −4 lib/s3/right_s3_interface.rb
  4. +0 −1 right_aws.gemspec
@@ -162,7 +162,9 @@ def describe_images_by_executable_by(*list_and_options)
# :root_device_name => "/dev/sda1",
# :block_device_mappings => [ { :ebs_snapshot_id=>"snap-7360871a",
# :ebs_delete_on_termination=>true,
- # :device_name=>"/dev/sda1"} ] }
+ # :device_name=>"/dev/sda1"},
+ # { :virtual_name => 'ephemeral0',}
+ # :device_name=>"/dev/sdb"} ]
# ec2.register_image(image_reg_params) #=> "ami-b2a1f7a4"
#
def register_image(options)
View
@@ -97,10 +97,24 @@ def buckets
# (section: Canned Access Policies)
#
def bucket(name, create=false, perms=nil, headers={})
- headers['x-amz-acl'] = perms if perms
- @interface.create_bucket(name, headers) if create
- buckets.each { |bucket| return bucket if bucket.name == name }
- nil
+ result = nil
+ if create
+ headers['x-amz-acl'] = perms if perms
+ @interface.create_bucket(name, headers)
+ end
+ begin
+ buckets.each do |bucket|
+ if bucket.name == name
+ result = bucket
+ break
+ end
+ end
+ rescue RightAws::AwsError => e
+ # With non root creds one can use bucket(s) but can't list them
+ raise e unless e.message['AccessDenied']
+ result = Bucket::new(self, name)
+ end
+ result
end
@@ -78,10 +78,11 @@ def param(name)
#
# Params is a hash:
#
- # {:server => 's3.amazonaws.com' # Amazon service host: 's3.amazonaws.com'(default)
- # :port => 443 # Amazon service port: 80 or 443(default)
- # :protocol => 'https' # Amazon service protocol: 'http' or 'https'(default)
- # :logger => Logger Object} # Logger instance: logs to STDOUT if omitted }
+ # {:server => 's3.amazonaws.com' # Amazon service host: 's3.amazonaws.com'(default)
+ # :port => 443 # Amazon service port: 80 or 443(default)
+ # :protocol => 'https' # Amazon service protocol: 'http' or 'https'(default)
+ # :logger => Logger Object # Logger instance: logs to STDOUT if omitted
+ # :no_subdomains => true} # Force placing bucket name into path instead of domain name
#
def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
init({ :name => 'S3',
View
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
spec.authors = ['RightScale, Inc.']
spec.email = 'support@rightscale.com'
spec.summary = 'Interface classes for the Amazon EC2, SQS, and S3 Web Services'
- spec.has_rdoc = true
spec.rdoc_options = ['--main', 'README.txt', '--title', '']
spec.extra_rdoc_files = ['README.txt']
spec.required_ruby_version = '>= 1.8.7'

0 comments on commit 0d7cfc0

Please sign in to comment.