cliaws 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/License.txt +2 -2
- data/README.txt +0 -1
- data/Rakefile +50 -4
- data/VERSION +1 -0
- data/bin/cliec2 +2 -28
- data/bin/clis3 +2 -185
- data/bin/clisdb +44 -0
- data/bin/clisqs +2 -103
- data/cliaws.gemspec +40 -20
- data/lib/cliaws/cli/ec2.rb +97 -0
- data/lib/cliaws/cli/s3.rb +172 -0
- data/lib/cliaws/cli/sqs.rb +73 -0
- data/lib/cliaws/ec2.rb +38 -0
- data/lib/cliaws/s3.rb +1 -7
- data/lib/cliaws/sqs.rb +4 -4
- data/lib/cliaws.rb +0 -2
- metadata +20 -45
- data/Manifest.txt +0 -29
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/lib/cliaws/version.rb +0 -9
- data/log/.gitignore +0 -0
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -46
- data/tasks/environment.rake +0 -7
- data/test/test_cliaws.rb +0 -11
- data/test/test_helper.rb +0 -2
- data/vendor/right_http_connection-1.2.1/README.txt +0 -3
- data/vendor/right_http_connection-1.2.1/lib/right_http_connection.rb +0 -117
data/tasks/deployment.rake
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
require "find"
|
33
|
-
|
34
|
-
home = File.expand_path(File.dirname(__FILE__) + "/../") + "/"
|
35
|
-
files = []
|
36
|
-
Find.find(File.dirname(__FILE__) + "/..") do |entry|
|
37
|
-
Find.prune if entry =~ /\.git$/
|
38
|
-
next if File.directory?(entry)
|
39
|
-
files << File.expand_path(entry).sub(home, "")
|
40
|
-
end
|
41
|
-
|
42
|
-
File.open(File.dirname(__FILE__) + "/../Manifest.txt", "w") do |io|
|
43
|
-
io.puts files.sort.join("\n")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/tasks/environment.rake
DELETED
data/test/test_cliaws.rb
DELETED
data/test/test_helper.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2007-2008 RightScale Inc
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
#
|
23
|
-
|
24
|
-
module Rightscale
|
25
|
-
class HttpConnection
|
26
|
-
def request(request_params, &block)
|
27
|
-
loop do
|
28
|
-
# if we are inside a delay between retries: no requests this time!
|
29
|
-
if error_count > HTTP_CONNECTION_RETRY_COUNT \
|
30
|
-
&& error_time + HTTP_CONNECTION_RETRY_DELAY > Time.now
|
31
|
-
@logger.warn("#{err_header} re-raising same error: #{banana_message} " +
|
32
|
-
"-- error count: #{error_count}, error age: #{Time.now.to_i - error_time.to_i}")
|
33
|
-
exception = get_param(:exception) || RuntimeError
|
34
|
-
raise exception.new(banana_message)
|
35
|
-
end
|
36
|
-
|
37
|
-
# try to connect server(if connection does not exist) and get response data
|
38
|
-
begin
|
39
|
-
request_params[:protocol] ||= (request_params[:port] == 443 ? 'https' : 'http')
|
40
|
-
# (re)open connection to server if none exists or params has changed
|
41
|
-
unless @http &&
|
42
|
-
@http.started? &&
|
43
|
-
@server == request_params[:server] &&
|
44
|
-
@port == request_params[:port] &&
|
45
|
-
@protocol == request_params[:protocol]
|
46
|
-
start(request_params)
|
47
|
-
end
|
48
|
-
|
49
|
-
# get response and return it
|
50
|
-
request = request_params[:request]
|
51
|
-
request['User-Agent'] = get_param(:user_agent) || ''
|
52
|
-
|
53
|
-
# Detect if the body is a streamable object like a file or socket. If so, stream that
|
54
|
-
# bad boy.
|
55
|
-
if(request.body && request.body.respond_to?(:read))
|
56
|
-
body = request.body
|
57
|
-
request.content_length = if body.respond_to?(:lstat) then
|
58
|
-
body.lstat.size
|
59
|
-
elsif body.respond_to?(:stat) then
|
60
|
-
body.stat.size
|
61
|
-
elsif body.respond_to?(:length) then
|
62
|
-
body.length
|
63
|
-
elsif body.respond_to?(:size) then
|
64
|
-
body.size
|
65
|
-
else
|
66
|
-
raise "Cannot determine request's Content-Length header for #{body.inspect}. #{body} doesn't respond to #lstat, #stat, #length or #size."
|
67
|
-
end
|
68
|
-
request.body_stream = request.body
|
69
|
-
end
|
70
|
-
response = @http.request(request, &block)
|
71
|
-
|
72
|
-
error_reset
|
73
|
-
eof_reset
|
74
|
-
return response
|
75
|
-
|
76
|
-
# We treat EOF errors and the timeout/network errors differently. Both
|
77
|
-
# are tracked in different statistics blocks. Note below that EOF
|
78
|
-
# errors will sleep for a certain (exponentially increasing) period.
|
79
|
-
# Other errors don't sleep because there is already an inherent delay
|
80
|
-
# in them; connect and read timeouts (for example) have already
|
81
|
-
# 'slept'. It is still not clear which way we should treat errors
|
82
|
-
# like RST and resolution failures. For now, there is no additional
|
83
|
-
# delay for these errors although this may change in the future.
|
84
|
-
|
85
|
-
# EOFError means the server closed the connection on us.
|
86
|
-
rescue EOFError => e
|
87
|
-
@logger.debug("#{err_header} server #{@server} closed connection")
|
88
|
-
@http = nil
|
89
|
-
|
90
|
-
# if we have waited long enough - raise an exception...
|
91
|
-
if raise_on_eof_exception?
|
92
|
-
exception = get_param(:exception) || RuntimeError
|
93
|
-
@logger.warn("#{err_header} raising #{exception} due to permanent EOF being received from #{@server}, error age: #{Time.now.to_i - eof_time.to_i}")
|
94
|
-
raise exception.new("Permanent EOF is being received from #{@server}.")
|
95
|
-
else
|
96
|
-
# ... else just sleep a bit before new retry
|
97
|
-
sleep(add_eof)
|
98
|
-
end
|
99
|
-
rescue Exception => e # See comment at bottom for the list of errors seen...
|
100
|
-
@http = nil
|
101
|
-
# if ctrl+c is pressed - we have to reraise exception to terminate proggy
|
102
|
-
if e.is_a?(Interrupt) && !( e.is_a?(Errno::ETIMEDOUT) || e.is_a?(Timeout::Error))
|
103
|
-
@logger.debug( "#{err_header} request to server #{@server} interrupted by ctrl-c")
|
104
|
-
raise
|
105
|
-
elsif e.is_a?(ArgumentError) && e.message.include?('wrong number of arguments (5 for 4)')
|
106
|
-
# seems our net_fix patch was overriden...
|
107
|
-
exception = get_param(:exception) || RuntimeError
|
108
|
-
raise exception.new('incompatible Net::HTTP monkey-patch')
|
109
|
-
end
|
110
|
-
# oops - we got a banana: log it
|
111
|
-
error_add(e.message)
|
112
|
-
@logger.warn("#{err_header} request failure count: #{error_count}, exception: #{e.inspect}")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|