solutious-rudy 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +7 -0
- data/lib/rudy.rb +1 -1
- data/lib/rudy/aws.rb +2 -1
- data/lib/rudy/aws/sdb.rb +32 -24
- data/lib/rudy/cli.rb +1 -0
- data/lib/rudy/cli/aws/ec2/candy.rb +1 -1
- data/lib/rudy/cli/routines.rb +1 -1
- data/lib/rudy/global.rb +2 -0
- data/lib/rudy/routines.rb +3 -4
- data/lib/rudy/utils.rb +1 -1
- data/rudy.gemspec +1 -1
- metadata +1 -1
data/CHANGES.txt
CHANGED
@@ -8,6 +8,13 @@ RUDY, CHANGES
|
|
8
8
|
* TODO: Tests for AWS HTTPS
|
9
9
|
|
10
10
|
|
11
|
+
#### 0.7.2 (2009-04-04) ###############################
|
12
|
+
|
13
|
+
* FIXED: cli/routine.rb release method wasn't sending command alias (which broke rerelease)
|
14
|
+
* ADDED: global.offline for being cool when Internet is down
|
15
|
+
* ADDED: Better handling in aws/sdb when call returns nil (Internet is down)
|
16
|
+
|
17
|
+
|
11
18
|
#### 0.7.1 (2009-04-04) ###############################
|
12
19
|
|
13
20
|
* FIXED: rudy wasn't honouring -C option for specifying a config file
|
data/lib/rudy.rb
CHANGED
data/lib/rudy/aws.rb
CHANGED
@@ -23,6 +23,7 @@ module Rudy
|
|
23
23
|
end
|
24
24
|
|
25
25
|
module ObjectBase
|
26
|
+
include Rudy::Huxtable
|
26
27
|
|
27
28
|
protected
|
28
29
|
|
@@ -52,9 +53,9 @@ module Rudy
|
|
52
53
|
rescue Timeout::Error => ex
|
53
54
|
STDERR.puts "Timeout (#{timeout}): #{ex.message}!"
|
54
55
|
rescue SocketError => ex
|
55
|
-
raise SocketError, "Check your Internets!"
|
56
56
|
#STDERR.puts ex.message
|
57
57
|
#STDERR.puts ex.backtrace
|
58
|
+
raise SocketError, "Check your Internets!" unless @@global.offline
|
58
59
|
ensure
|
59
60
|
response ||= default
|
60
61
|
end
|
data/lib/rudy/aws/sdb.rb
CHANGED
@@ -98,18 +98,20 @@ module Rudy
|
|
98
98
|
|
99
99
|
doc = call(:get, params)
|
100
100
|
results = []
|
101
|
-
|
102
|
-
|
101
|
+
if doc
|
102
|
+
REXML::XPath.each(doc, "//Item") do |item|
|
103
|
+
name = REXML::XPath.first(item, './Name/text()').to_s
|
103
104
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
attributes = {'Name' => name}
|
106
|
+
REXML::XPath.each(item, "./Attribute") do |attr|
|
107
|
+
key = REXML::XPath.first(attr, './Name/text()').to_s
|
108
|
+
value = REXML::XPath.first(attr, './Value/text()').to_s
|
109
|
+
( attributes[key] ||= [] ) << value
|
110
|
+
end
|
111
|
+
results << attributes
|
109
112
|
end
|
110
|
-
results
|
113
|
+
#return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
111
114
|
end
|
112
|
-
#return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
113
115
|
|
114
116
|
hash_results = {}
|
115
117
|
results.each do |item|
|
@@ -134,8 +136,10 @@ module Rudy
|
|
134
136
|
|
135
137
|
doc = call(:get, params)
|
136
138
|
results = []
|
137
|
-
|
138
|
-
|
139
|
+
if doc
|
140
|
+
REXML::XPath.each(doc, '//ItemName/text()') do |item|
|
141
|
+
results << item.to_s
|
142
|
+
end
|
139
143
|
end
|
140
144
|
|
141
145
|
#return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
@@ -159,18 +163,20 @@ module Rudy
|
|
159
163
|
|
160
164
|
doc = call(:get, params)
|
161
165
|
results = []
|
162
|
-
|
163
|
-
|
166
|
+
if doc
|
167
|
+
REXML::XPath.each(doc, "//Item") do |item|
|
168
|
+
name = REXML::XPath.first(item, './Name/text()').to_s
|
164
169
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
+
attributes = {'Name' => name}
|
171
|
+
REXML::XPath.each(item, "./Attribute") do |attr|
|
172
|
+
key = REXML::XPath.first(attr, './Name/text()').to_s
|
173
|
+
value = REXML::XPath.first(attr, './Value/text()').to_s
|
174
|
+
( attributes[key] ||= [] ) << value
|
175
|
+
end
|
176
|
+
results << attributes
|
170
177
|
end
|
171
|
-
results
|
178
|
+
#return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
172
179
|
end
|
173
|
-
#return results, REXML::XPath.first(doc, '//NextToken/text()').to_s
|
174
180
|
|
175
181
|
hash_results = {}
|
176
182
|
results.each do |item|
|
@@ -216,10 +222,12 @@ module Rudy
|
|
216
222
|
}
|
217
223
|
)
|
218
224
|
attributes = {}
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
225
|
+
if doc
|
226
|
+
REXML::XPath.each(doc, "//Attribute") do |attr|
|
227
|
+
key = REXML::XPath.first(attr, './Name/text()').to_s
|
228
|
+
value = REXML::XPath.first(attr, './Value/text()').to_s
|
229
|
+
( attributes[key] ||= [] ) << value
|
230
|
+
end
|
223
231
|
end
|
224
232
|
attributes = nil if attributes.empty?
|
225
233
|
attributes
|
data/lib/rudy/cli.rb
CHANGED
@@ -154,6 +154,7 @@ module Rudy
|
|
154
154
|
global :C, :config, String, "Specify another configuration file to read (ie: #{Rudy::CONFIG_FILE})"
|
155
155
|
global :Y, :yes, "Assume a correct answer to confirmation questions"
|
156
156
|
global :q, :quiet, "Run with less output"
|
157
|
+
global :O, :offline, "Be cool about the internet being down"
|
157
158
|
global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
|
158
159
|
@verbose ||= 0
|
159
160
|
@verbose += 1
|
@@ -6,7 +6,7 @@ module AWS; module EC2;
|
|
6
6
|
|
7
7
|
def status_valid?
|
8
8
|
avail = Rudy::Utils.service_available?('status.aws.amazon.com', 80, 5)
|
9
|
-
raise ServiceUnavailable, 'status.aws.amazon.com' unless avail
|
9
|
+
raise ServiceUnavailable, 'status.aws.amazon.com' unless @@global.offline || avail
|
10
10
|
true
|
11
11
|
end
|
12
12
|
def status
|
data/lib/rudy/cli/routines.rb
CHANGED
data/lib/rudy/global.rb
CHANGED
data/lib/rudy/routines.rb
CHANGED
@@ -91,7 +91,6 @@ module Rudy
|
|
91
91
|
}
|
92
92
|
end
|
93
93
|
|
94
|
-
|
95
94
|
# TODO: trap rbox errors. We could get an authentication error.
|
96
95
|
opts = { :keys => root_keypairpath, :user => 'root', :info => @@global.verbose > 0 }
|
97
96
|
begin
|
@@ -125,12 +124,12 @@ module Rudy
|
|
125
124
|
puts task_separator("AUTHORIZE USER")
|
126
125
|
Rudy::Routines::UserHelper.authorize(@routine, machine, rbox)
|
127
126
|
end
|
128
|
-
|
127
|
+
#puts 1
|
129
128
|
if Rudy::Routines::ScriptHelper.before?(@routine) # before
|
130
129
|
puts task_separator("REMOTE SHELL")
|
131
130
|
Rudy::Routines::ScriptHelper.before(@routine, sconf, machine, rbox)
|
132
131
|
end
|
133
|
-
|
132
|
+
#puts 2
|
134
133
|
if Rudy::Routines::DiskHelper.disks?(@routine) # disk
|
135
134
|
puts task_separator("DISKS")
|
136
135
|
if rbox.ostype == "sunos"
|
@@ -139,7 +138,7 @@ module Rudy
|
|
139
138
|
Rudy::Routines::DiskHelper.execute(@routine, machine, rbox)
|
140
139
|
end
|
141
140
|
end
|
142
|
-
|
141
|
+
|
143
142
|
# Startup, shutdown, release, deploy, etc...
|
144
143
|
routine_action.call(machine, rbox) if routine_action
|
145
144
|
|
data/lib/rudy/utils.rb
CHANGED
@@ -21,7 +21,7 @@ module Rudy
|
|
21
21
|
ip = /([0-9]{1,3}\.){3}[0-9]{1,3}/.match(ipstr).to_s
|
22
22
|
break if ip && !ip.empty?
|
23
23
|
end
|
24
|
-
rescue SocketError, Errno::ETIMEDOUT
|
24
|
+
rescue SocketError, Errno::ETIMEDOUT => ex
|
25
25
|
STDERR.puts "Connection Error. Check your internets!"
|
26
26
|
end
|
27
27
|
ip += "/32" if ip
|
data/rudy.gemspec
CHANGED