Permalink
Browse files

ensure that global s3 connection options are duplicated to s3 task ob…

…jects
  • Loading branch information...
1 parent 58f0ba9 commit 73334ea658ebacc591517c905644b9d376cd2817 @technoweenie committed Dec 5, 2008
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/attachment_fu/tasks/s3.rb
@@ -18,7 +18,7 @@ class << self
# :proxy => http proxy for accessing S3
def connect(options)
o = options.slice(:access_key_id, :secret_access_key, :server, :port, :use_ssl, :persistent, :proxy)
- AWS::S3::Base.establish_connection!(o)
+ AWS::S3::Base.establish_connection!(o.dup) # establish_connection! modifies the hash
@connection_options = o
end
@@ -53,6 +53,7 @@ def s3
end
@options = options
+ @options.update(self.class.connection_options) if self.class.connected?
@options[:access] ||= :authenticated_read
self.class.connect(@options) unless self.class.connected?
end
@@ -192,10 +193,18 @@ def connected?
!task.nil?
end
+ def options
+ task.options
+ end
+
def task
@asset.class.attachment_tasks[:s3]
rescue ArgumentError
end
+
+ def inspect
+ "<#{@asset.class} S3: #{path.inspect}, #{options.inspect}>"
+ end
end
end
end

0 comments on commit 73334ea

Please sign in to comment.