appoxy / aws Goto Github PK
View Code? Open in Web Editor NEWAmazon Web Services (AWS) Ruby Gem
Home Page: https://rubygems.org/gems/aws
Amazon Web Services (AWS) Ruby Gem
Home Page: https://rubygems.org/gems/aws
When using this gem in ruby 1.9, I get a ton of warnings in my logfile about model access:
C:/Ruby19/lib/ruby/gems/aws-2.3.5/lib/awsbase/support.rb:47: warning: top level constant Mailing referenced by Account::Mailing
C:/Ruby19/lib/ruby/gems/aws-2.3.5/lib/awsbase/support.rb:47: warning: top level constant Image referenced by Image::Image
C:/Ruby19/lib/ruby/gems/aws-2.3.5/lib/awsbase/support.rb:47: warning: top level constant Style referenced by Theme::Style
C:/Ruby19/lib/ruby/gems/aws-2.3.5/lib/awsbase/support.rb:47: warning: top level constant Block referenced by Template::Block
C:/Ruby19/lib/ruby/gems/aws-2.3.5/lib/awsbase/support.rb:47: warning: top level constant Asset referenced by Attachment::Asset
C:/Ruby19/lib/ruby/gems/aws-2.3.5/lib/awsbase/support.rb:47: warning: top level constant Image referenced by Asset::Image
This seems to happen with a whole bunch of models, even ones that don't seem to be involved in anything that the aws gem is supposed to be touching.
Hi, I'm trying to use appoxy/aws in a new project with Rails 3.2 and ruby-1.9.3-p125
and am getting an error on launch_instances()
Cannot find the method "to_a" in:
/usr/local/rvm/gems/ruby-1.9.3-p125@rails32x/bundler/gems/aws-62f71d007b5b/lib/ec2/ec2.rb:535:in `launch_instances'
We had no problems with an older project using ruby-1.8.7
Thanks for the gem and your help!
Creating an Aws::Sqs
object with the :connection_mode => :single
is supposed to open a persistent connection to queue.amazonaws.com.
However, after a period of inactivity ( ~2 minutes) when a new message is pushed onto the queue the following message is seen:
Rightscale::HttpConnection : server queue.amazonaws.com closed connection
Opening new HTTPS connection to queue.amazonaws.com:443
This slows down pushing that message by ~500ms. Is there any way to fix this?
thanks!
If you load aws with warnings turned on, you'll see this:
/home/phiggins/projects/aws/lib/ec2/ec2.rb:1045: warning: method redefined; discarding old describe_availability_zones
/home/phiggins/projects/aws/lib/ec2/ec2.rb:407: warning: previous definition of describe_availability_zones was here
Right now the gem only contains the README and the code itself, but no rakefile to generate documentation, the rest of the documentation or anything. Please do provide either a full gem or git tags so that we can package this properly in Gentoo.
Thanks,
Diego
Installing the aws gem pulls in a few other dependencies, but does not install ActiveSupport. Requiring aws then fails because the gem requires ActiveSupport somewhere.
Adding ActiveSupport to the gemspec would be good, removing the dependency would be better. ;)
pjh239-maclap:arXivLib phalliday$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
pjh239-maclap:arXivLib phalliday$ gem list
*** LOCAL GEMS ***
activesupport (3.2.0)
af (0.3.12.3)
amazon-ec2 (0.9.17)
aws (2.5.6)
bacon (1.1.0)
bundler (1.0.21)
extensions (0.6.0)
git (1.2.5)
highline (1.6.9)
http_connection (1.4.1)
i18n (0.6.0)
jeweler (1.7.0)
json (1.6.5, 1.5.1)
json_pure (1.6.5, 1.5.4)
judo (0.5.3)
mime-types (1.17.2)
multi_json (1.0.4)
parseconfig (0.5.2)
rake (0.9.2.2)
rdoc (3.12)
rest-client (1.6.7)
rhc (0.84.15, 0.68.5)
rubyzip2 (2.0.2)
spruz (0.2.13)
terminal-table (1.4.4)
uuidtools (2.1.2)
xml-simple (1.1.1)
pjh239-maclap:arXivLib phalliday$ judo
/Library/Ruby/Gems/1.8/gems/aws-2.5.6/lib/awsbase/awsbase.rb:33: undefined method require_relative' for Aws:Module (NoMethodError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' from /Library/Ruby/Gems/1.8/gems/aws-2.5.6/lib/right_aws.rb:40 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' from /Library/Ruby/Gems/1.8/gems/judo-0.5.3/bin/../lib/judo.rb:4 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' from /Library/Ruby/Gems/1.8/gems/judo-0.5.3/bin/judo:4 from /usr/bin/judo:19:in
load'
from /usr/bin/judo:19
I'm receiving the following:
NoMethodError: undefined method require_relative' for Aws:Module /var/lib/gems/1.8/gems/aws-2.5.6/lib/awsbase/awsbase.rb:33 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require'/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' /var/lib/gems/1.8/gems/aws-2.5.6/lib/right_aws.rb:40 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
The system is Ubuntu 11.04 running ruby 1.8.7 (2010-08-16 patchlevel 302).
Any help would be greatly appreciated.
/usr/lib/ruby/gems/1.8/gems/aws-2.3.20/lib/awsbase/right_awsbase.rb:321:in `init': undefined method `blank?' for "AWS Access Key ID goes here":String (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/aws-2.3.20/lib/sdb/right_sdb_interface.rb:81:in `initialize'
Hey appoxy,
Which version of libxml is aws supposed to work with? I tried the current 2.0.2 and
undefined method on_start_element_ns' for #<Aws::RightSaxParserCallback:0x105e04bf0> /Users/change/.rvm/gems/ree-1.8.7-2010.02/gems/aws-2.4.5/lib/awsbase/parsers.rb:134:in 'parse' /Users/change/.rvm/gems/ree-1.8.7-2010.02/gems/aws-2.4.5/lib/awsbase/parsers.rb:134:in 'parse' /Users/change/.rvm/gems/ree-1.8.7-2010.02/gems/aws-2.4.5/lib/awsbase/awsbase.rb:530:in 'request_info_impl'
gets thrown. It's in my bucket.key(key_str, true)
method. Don't know if this is my issue, so thought I'd set a ticket on github.
Thanks,
Thomas and Erik
Se: http://forums.rightscale.com/showthread.php?t=194
The same problem is present in your fork. I applied the specified fix to my local gem and it works.
Seeing this behavior:
x = 'myown-videos'
Aws::S3Interface.new( KEY, SECRET ).list_bucket x, :prefix => 'go'
x
=> "myown-videos?prefix=go"
In order to setup Route53 DNS records using the Zone apex feature requires the ELB Hosted Zone ID. Unless I'm missing something, there seems to be no way to obtain that for an ELB via Aws::Elb.describe_load_balancers(). This may be because it was only added after the Zone apex feature was added to Route53.
There was a code change Feb 23, 2011, that killed many or all bucket listing, etc for any bucket that is not in the US classic region.
fetch_request_params now always uses a 'classic' old style path based url - which only works for US classic buckets, and nowhere else.
virtual - hosted style requests MUST be used on all EU, Tokyo, etc buckets.
The documentation for the Aws::Sqs.create method indicates that its second parameter controls whether a new SQS queue is created if one by that name doesn't exist.
Looking at the code, it seems that there is some commented out code that does as the docs indicate, but the currently active code ignores the second parameter. This commit looks like the one responsible for the change, citing "performance enhancement".
Either the documentation should be changed to indicate that a queue is created if it does not exist, or that commit should be reverted.
It is pretty easy to add. Its almost exactly like the logging call.
Roughly:
def put_versioning(bucket, state, aws_id, aws_secret)
xmldoc = "<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/\"><Status>#{state}</Status></VersioningConfiguration>"
the_params[:headers] = {}
req_hash = generate_rest_request('PUT', the_params[:headers].merge(:url=>"#{bucket}?versioning", :data => xmldoc))
#request_info(req_hash, S3TrueParser.new)
request_info(req_hash, RightDummyParser.new)
rescue
on_exception
end
Also in canonical_string, you need to add...
out_string << '?versioning' if path[/[&?]versioning($|&|=)/] # all these hardwired constants are weird here.
Hi,
I have setup a delta-cloud server in my local machine. And I try to communicate the openstack via deltacloud server. But i got some exception on while execute the below code. the exception is "error status='401' url='/api/images'"
The below lines are sample code for list the available images in openstack server.:
String url = "http://hostname:3001/api/images";
String username = "openstack_username";
String password= "openstack_password";
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
request.addHeader("username", user);
request.addHeader("password", password);
HttpResponse httpResponse = client.execute(request);
BufferedReader rd = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));
String result = rd.readLine();
Any one can u provide suggestion please.
ruby-aws
is a gem hosted on rubyforge.
http://rubyforge.org/projects/ruby-aws
It is a full-featured library for accessing Mechanical Turk.
It could be great if you could integrate it here with ruby 1.9.2 support.
What does this mean? I'm getting these errors in Rails 3
/Users/daniel/km/sio/trunk/vendor/bundle/gems/aws-2.3.6/lib/awsbase/support.rb:47: warning: toplevel constant User referenced by Invite::User
I have a model called User, and a model called Invite... not sure what the deal is with Invite::User nor why aws cares?
I found that IN statements in WHERE clauses were not being expanded correctly. While one one hand this might be seen as an issue in right_aws (and I opened an issue with them), I see that you try to work around it in query_expression_from_array.
However, for the life of me I couldn't figure out why I was getting incorrectly serialized arrays. Copying the exact code from sdb_interface.rb into a patch fixed my problem:
class Aws::SdbInterface
def query_expression_from_array(params) #:nodoc:
return '' if Aws::Utils.blank?(params)
query = params[0].to_s
i = 1
query.gsub(/(\\)?(\?)/) do
if $1 # if escaped '\?' is found - replace it by '?' without backslash
"?"
else # well, if no backslash precedes '?' then replace it by next param from the list
case params[i]
when Array
ret = "(#{params[i].map{|p| escape(p)}.join(",")})"
else
ret = escape(params[i])
end
i +=1
ret
end
end
end
end
This suggests to me that somehow the right_aws
method is taking precendence over yours.
The following use cases could/should be supported in the end:
Synchronous, like it is now, eg:
results = @sdb.select("select * from sdb")
results.each do |r|
# do something
end
EM async, eg:
@sdb.select("select * from sdb") do |results|
results.each do |r|
# do something
end
end
Concur style, eg:
results_future = executor.execute do
@sdb.select("select * from sdb")
end
# at some point when the results are needed
results = results_future.get
results.each do |r|
# do something
end
OR another concur style, initializing with executor
@sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :executor=>executor)
then:
results_future = @sdb.select("select * from sdb")
# at some point when the results are needed
results = results_future.get
results.each do |r|
# do something
end
OR to mix sync with async:
results_future = @sdb.select("select * from sdb", :executor=>executor)
How do I set content disposition header with the aws gem?
I tried:
s3 = Aws::S3.new(APP_CONFIG['amazon_access_key_id'], APP_CONFIG['amazon_secret_access_key'])
bucket_gen = Aws::S3Generator::Bucket.create(s3, 'bucket_name')
signed_url = bucket_gen.get(URI.unescape(URI.parse(URI.escape(Video.first.encoded_file_url)).path[1..-1]), 10.minute, {'response-content-disposition' => 'attachment'})
puts signed_url
When I navigate to signed_url
, the file loads and is played on the browser, instead of a download file dialogue popping up.
I looked at the aws gem documentation at: http://rubydoc.info/gems/aws/2.4.5/frames http://rubydoc.info/gems/aws/2.4.5/Aws/S3Generator/Bucket:get
And the AWS documentation at: http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectGET.html?r=7673
Any ideas?
Please, return also the common_prefixes given by S3, just as RightAws is doing:
for SQS multi-threaded mode, there's no close_connection method.
Why there isn't close method?
i think it should be.. could you add it ?
Hi,
API_VERSION is set to 2008-06-30 in Aws::AcfInterface while current Amazon Cloudfront API version is 2010-08-01, almost 2 years late (see here for the new features:
http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?WhatsNew.html).
Updating the API version could allow implementation of new features, especially the invalidation methods: http://docs.amazonwebservices.com/AmazonCloudFront/latest/APIReference/index.html?Actions_Invalidations.html
It could be cool to add those to the gem API, I could try to add and pull request this if you're interested (I am for sure!).
Cheers,
Rémy
It seems that because every attribute value (except 'id') is always written as array (multi-value) to SDB that conditional puts and deletes are not possible - (AWS docs state that multi-values conditional updates on multi-values will fail). It looks like the gem needs a complete re-conception and re-write because of this - or - is there a simple monkey patch that could be applied could incorporate this feature ??
Hi,
when I trying to launch an new instance I got some complains about 'nil' value in 'request['X-Amzn-Authorization']' on line 235 in "lib/awsbase/awsbase.rb".
After commenting out this line, everything is working fine.
235 #puts "header=" + request['X-Amzn-Authorization']
-- Michal
Hi,
One of my attributes have russian letters. This attribute encoding = "UTF8"
When I try call put_attributes method I get following error:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/appoxy-aws-1.11.22/lib/awsbase/right_awsbase.rb:43: warning: regexp match /.../n against to UTF-8 string
/opt/local/lib/ruby1.9/gems/1.9.1/gems/appoxy-aws-1.11.22/lib/awsbase/right_awsbase.rb:43: warning: regexp match /.../n against to UTF-8 string
/opt/local/lib/ruby1.9/gems/1.9.1/gems/appoxy-aws-1.11.22/lib/awsbase/right_awsbase.rb:43: warning: regexp match /.../n against to UTF-8 string
/opt/local/lib/ruby1.9/gems/1.9.1/gems/appoxy-aws-1.11.22/lib/awsbase/right_awsbase.rb:43: warning: regexp match /.../n against to UTF-8 string
I, [2009-07-09T23:30:22.910083 #7147] INFO -- : Opening new HTTP connection to sdb.amazonaws.com:80
W, [2009-07-09T23:30:23.497398 #7147] WARN -- : ##### RightAws::SdbInterface returned an error: 403 Forbidden
.....
With attributes without russian letters everything is ok.
Hope you can help me,
Thanks.
the constantize method if active_support isn't present has an issue w/ const_get...
it uses 2 arguments, which is only valid in ruby 1.9
Hi,
i'm getting a couple of warning on Ruby 1.8 (Fedora 14):
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/utils.rb:105: warning: already initialized constant HEX
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/utils.rb:107: warning: already initialized constant TO_REMEMBER
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/utils.rb:108: warning: already initialized constant ASCII
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/errors.rb:128: warning: already initialized constant DEFAULT_CLOSE_ON_4XX_PROBABILITY
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/parsers.rb:47: warning: already initialized constant DEFAULT_XML_LIBRARY
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/awsbase.rb:66: warning: already initialized constant AMAZON_PROBLEMS
/usr/lib/ruby/gems/1.8/gems/aws-2.5.1/lib/ses/../awsbase/awsbase.rb:86: warning: already initialized constant DEFAULT_SIGNATURE_VERSION
-- Michal
using jruby --1.8, 'gem install aws' will fail with ArrayIndexOutOfBoundsException per http://jira.codehaus.org/browse/JRUBY-5581
The problem is that you call upcase on the location name "#{headers[:location].to_s.upcase}"
upcase should not be called. But EU needs to be passed in upper case.
See for instance:
http://developer.amazonwebservices.com/connect/message.jspa?messageID=156006
If you remove the upcase, you will break anyone who passed in 'eu' as a location. That's the only exception, so you could use an if statement.
I'm running on a Mac, Snow Leopard and I get the above error.
Here's the trace from irb:
require 'aws'
NameError: uninitialized constant Aws
from ./aws.rb:7
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
from (irb):1
Any ideas why this is?
Hi,
Can you please explain how to map a block device to the instance in launch_instance() method? I find out there is a param called ':block_device_mappings' which is String but in EC2 docs there is no such param They have something like:
BlockDeviceMapping.N.DeviceName =
BlockDeviceMapping.N.VirtualName =
BlockDeviceMapping.N.Ebs.SnapshotId = vol-XXXXXX
BlockDeviceMapping.N.Ebs.DeleteOnTermination =
It's a bug? Or relic from previous API version?
Amazon now provides the ability to change the visibility timeout on a message you have already received which allows for a long running process to finish without the message being redistributed.
running a client against deltacloud trunk using jruby --1.9 I get openssl errors seemingly related to http://jira.codehaus.org/browse/JRUBY-5529
command: GET http://localhost:3001/api/realms HTTP/1.1 failed with response: HTTP/1.1 500 Internal Server Error; content: [
backend_error
502
Aws::AwsError
127.0.0.1 - - [01/Apr/2011 16:31:03] "GET /api/realms HTTP/1.1" 500 6079 0.0610
New Aws::Ec2 using per_thread-connection mode
Rightscale::HttpConnection : re-raising same error: ec2.us-east-1.amazonaws.com temporarily unavailable: (undefined method read_nonblock' for #<OpenSSL::SSL::SSLSocket:0x74904497>) -- error count: 4, error age: 4 Deltacloud::BackendError - ec2.us-east-1.amazonaws.com temporarily unavailable: (undefined method
read_nonblock' for #OpenSSL::SSL::SSLSocket:0x74904497):
/Users/adriancole/workspace/deltacloud/server/lib/deltacloud/base_driver/base_driver.rb:249:in safely' org/jruby/RubyArray.java:1572:in
each'
/Users/adriancole/workspace/deltacloud/server/lib/deltacloud/base_driver/base_driver.rb:247:in safely' /Users/adriancole/workspace/deltacloud/server/lib/deltacloud/drivers/ec2/ec2_driver.rb:151:in
realms'
org/jruby/RubyBasicObject.java:1677:in __send__' org/jruby/RubyKernel.java:2067:in
send'
/Users/adriancole/workspace/deltacloud/server/lib/deltacloud/helpers/application_helper.rb:82:in filter_all' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/1.9/benchmark.rb:294:in
measure'
/Users/adriancole/workspace/deltacloud/server/lib/deltacloud/helpers/application_helper.rb:81:in filter_all' /Users/adriancole/workspace/deltacloud/server/server.rb:162:in
(root)'
org/jruby/RubyBasicObject.java:1697:in instance_eval' /Users/adriancole/workspace/deltacloud/server/lib/sinatra/rabbit.rb:106:in
HEAD /api/realms'
org/jruby/RubyMethod.java:117:in call' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:1126:in
compile!'
org/jruby/RubyBasicObject.java:1697:in instance_eval' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:709:in
route_eval'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:693:in route!' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:741:in
process_route'
org/jruby/RubyKernel.java:1204:in catch' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:738:in
process_route'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:692:in route!' org/jruby/RubyArray.java:1572:in
each'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:691:in route!' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:826:in
dispatch!'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:619:in call!' org/jruby/RubyBasicObject.java:1697:in
instance_eval'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:791:in invoke' org/jruby/RubyKernel.java:1204:in
catch'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:791:in invoke' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:619:in
call!'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:604:in call' /Users/adriancole/workspace/deltacloud/server/lib/sinatra/rack_driver_select.rb:47:in
call'
/Users/adriancole/workspace/deltacloud/server/lib/sinatra/rack_matrix_params.rb:82:in call' /Users/adriancole/workspace/deltacloud/server/lib/sinatra/rack_runtime.rb:36:in
call'
/Users/adriancole/workspace/deltacloud/server/lib/sinatra/rack_etag.rb:42:in call' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/context.rb:22:in
call'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in call' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in
call'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:1245:in call' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:1276:in
synchronize'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/sinatra-1.2.1/lib/sinatra/base.rb:1245:in call' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/reloader.rb:44:in
call'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in call' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
call'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in service' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/1.9/webrick/httpserver.rb:111:in
service'
/usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/1.9/webrick/httpserver.rb:70:in run' /usr/local/Cellar/jruby/1.6.0/jruby/lib/ruby/1.9/webrick/server.rb:183:in
start_thread'
Aws::Sqs::Queue.new will raise the a NameError when the supplied queue name does not exist.
This is enough code to trigger the exception:
sqs = Aws::Sqs.new(access_key, secret_key)
Aws::Sqs::Queue.new(sqs, "some_nonexistant_queue")
This is the full backtrace:
New Aws::SqsInterface using per_request-connection mode
Opening new HTTPS connection to queue.amazonaws.com:443
#<NameError: undefined local variable or method on_exception' for Aws::SqsInterface:Class> ["/home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs_interface.rb:329:in
rescue in queue_name_by_url'", "/home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs_interface.rb:327:inqueue_name_by_url'", "/home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs_interface.rb:337:in
queue_name_by_url'", "/home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs.rb:117:ininitialize'", "aws.rb:4:in
new'", "aws.rb:4:in<main>'"].join(' ')} Request was: /?AWSAccessKeyId=AKIAI3WMSCZJ2HSYW3OA&Action=ListQueues&Expires=2011-03-08T02%3A06%3A18Z&QueueNamePrefix=some_nonexistant_queue&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=2009-02-01&Signature=i4WQoTcqOBaBbxeeW8ZogkRr1GAnt%2BqFld7VMX7kQeM%3D Response was: 200 -- OK -- <?xml version="1.0"?> <ListQueuesResponse xmlns="http://queue.amazonaws.com/doc/2009-02-01/"><ListQueuesResult></ListQueuesResult><ResponseMetadata><RequestId>0c7cf521-8ab4-4a8c-aafa-4ff75be4bd75</RequestId></ResponseMetadata></ListQueuesResponse> /home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs_interface.rb:329:in
rescue in queue_name_by_url': undefined local variable or methodon_exception' for Aws::SqsInterface:Class (NameError) from /home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs_interface.rb:327:in
queue_name_by_url'
from /home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs_interface.rb:337:inqueue_name_by_url' from /home/phiggins/.rvm/gems/ruby-1.9.2-p180/gems/aws-2.4.4/lib/sqs/sqs.rb:117:in
initialize'
from aws.rb:4:innew' from aws.rb:4:in
s3 = Aws::S3.new(...)
bucket = s3.bucket(...)
bucket.put("test", File.open("some_file"))
NoMethodError: undefined method `size' for #<File:/Users/druiden/Movies/clips/rails3upgrade.mov>
from /Users/druiden/.rvm/gems/ruby-1.8.7-p249/gems/aws-2.3.8/lib/s3/right_s3_interface.rb:406:in `put'
from /Users/druiden/.rvm/gems/ruby-1.8.7-p249/gems/aws-2.3.8/lib/s3/right_s3.rb:496:in `put'
from /Users/druiden/.rvm/gems/ruby-1.8.7-p249/gems/aws-2.3.8/lib/s3/right_s3.rb:283:in `put'
from (irb):35
This seems like the most obvious and common thing I would do with Aws::S3 so I'm a bit surprised it choked.
Am I missing something?
I can't find a method to create the signed url for S3. Is there one?
(note that this has been fixed in right_awsbase, just not in right_sqs_interface)
lib/sqs/right_sqs_interface.rb has
request['Content-Type'] = 'application/x-www-form-urlencoded'
I believe it should be
request['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'
per http://groups.google.com/group/simple-record/browse_thread/thread/aa3cd430b35e8e1c
How to reproduce:
:try_create_snapshot
methodThe resulting snapshot will have :aws_volume_id
property set to the ID of
first volume instead of the volume used for creation.
I'll check how hard is to fix this, if someone want to beat me he is very welcome to ;-)
Hi,
I just trying to get AWS working on 'proxied' environment. Is there any setting I can fiddle in order to use a proxy server for EC2 connections, or it's something which needs to be fixed/patched in http_connection library?
I thought that setting 'https_proxy' will get this work but unfortunately it seems like it's totally ignored.
Any clue about this?
-- Michal
If you use aws to generate a URL with an expiry for S3:
s3 = Aws::S3.new(aws_id, aws_secret)
bucket_gen = Aws::S3Generator::Bucket.create(s3, bucket)
# create a signed url good for a while
url = bucket_gen.get("key with ? in it", 30.days)
the resulting URL will not work: There are two problems:
Speculation and guesswork:
I looked at right_awsbase.rb it seems that the problem lies in the amz_escape
eg: add this around line 160
e2 = e2.gsub("?", "%3F")
Or maybe you need to use different encoding for the key from the other arguments.
I have much the same program accessing the same files written in Objective-C. There I (well ASI) encode the S3Key only with lots of encoding. It really can't hurt, except for readability of the resulting URL (so I don't encode for example /)
CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)key, NULL, CFSTR(":?#[]@!$ &'()*+,;="<>%{}|^~`"), NSUTF8StringEncoding);
I tried encoding the ? in the key before passing it in, but that did not work : the %3F then got double coded.
An S3 Key can be any string of utf-8 bytes.
You should likely also test with a string with lots of weird chars, just to be sure...
Thanks, the tools seem to work quite well.
--Tom Andersen
The constantize borrowed from ActiveSupport calls const_get with two args, but the default ruby const_get only takes one. Is this a const_get that is defined somewhere else in ActiveSupport?
see: https://github.com/appoxy/aws/blob/master/lib/awsbase/support.rb#L49
Hi,
I tried to filter only 'machine' images, but when I did:
ap @ec2.describe_images([], 'machine')
I got:
UnknownParameter
The parameter ImageType is not recognized15d5b5ac-d58d-464a-b03c-302ea46383d5 #####
I get a "uninitialized constant Aws::S3::Grantee::Bucket" error when I attempt to initialize a new grantee. Below is the stack trace.
Aws::S3::Grantee.new(nil, nil)
NameError: uninitialized constant Aws::S3::Grantee::Bucket
from /usr/local/lib/ruby/gems/1.9.1/gems/aws-2.4.5/lib/s3/grantee.rb:48:in owner_and_grantees' from /usr/local/lib/ruby/gems/1.9.1/gems/aws-2.4.5/lib/s3/grantee.rb:70:in
grantees'
from /usr/local/lib/ruby/gems/1.9.1/gems/aws-2.4.5/lib/s3/grantee.rb:195:in refresh' from /usr/local/lib/ruby/gems/1.9.1/gems/aws-2.4.5/lib/s3/grantee.rb:113:in
initialize'
from (irb):6:in new' from (irb):6 from /usr/local/bin/irb:12:in
Note: I am only using nil to demonstrate that I don't the invalid input error I would expect and instead get a constant uninitialized error.
I am running on 1.9.2.
Here's the current code of the method:
def escape(value)
%Q{'#{value.to_s.gsub(/(['\\])/){ "\\#{$1}" }}'} if value
end
This code was probably good for API 2007-11-07 but not for API 2009-04-15. Here's what it should be with the new API:
def escape(value)
%{'#{value.to_s.gsub(/(['\\])/){"#{$1}#{$1}"}}'} if value
end
Even Amazon's official documentation is not clear about that: here it looks like quotes must be escaped with backslashes whereas here it says they must be doubled.
To reproduce (using SimpleRecord):
class A < SimpleRecord::Base
has_strings :x
end
A.find_by_x("ain't good") # => doesn't work
Aws::SdbInterface.class_eval do
# Patch query escaping to comply with the 2009-04-15 API
def escape(value)
%{'#{value.to_s.gsub(/(['\\])/){"#{$1}#{$1}"}}'} if value
end
end
A.find_by_x("ain't good") # => works
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.