rudy 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +7 -0
- data/README.rdoc +3 -3
- data/lib/rudy.rb +1 -1
- data/lib/rudy/routines.rb +20 -17
- data/lib/rudy/routines/helper.rb +25 -4
- data/lib/rudy/routines/helpers/scripthelper.rb +27 -7
- data/lib/rudy/routines/reboot.rb +1 -1
- data/rudy.gemspec +3 -4
- metadata +4 -14
data/CHANGES.txt
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
RUDY, CHANGES
|
2
2
|
|
3
3
|
|
4
|
+
#### 0.8.3 (2009-06-03) ###############################
|
5
|
+
|
6
|
+
* CHANGE: Now requires rye-0.7.3 (disable_safe_mode method)
|
7
|
+
* CHANGE: Rye safe-mode is enabled after each routines script block to force disabling it
|
8
|
+
explicitly in every block it's needed.
|
9
|
+
* CHANGE: Removed grit dependency
|
10
|
+
|
4
11
|
|
5
12
|
#### 0.8.2 (2009-06-01) ###############################
|
6
13
|
|
data/README.rdoc
CHANGED
@@ -52,9 +52,9 @@ The routines configuration describes repeatable processes that you can execute o
|
|
52
52
|
end
|
53
53
|
|
54
54
|
after :rudy do # Run remote SSH commands
|
55
|
-
mkdir :p, "great"
|
56
|
-
touch "great/scott"
|
57
|
-
ls :l, :a
|
55
|
+
mkdir :p, "great" # $ mkdir -p great
|
56
|
+
touch "great/scott" # $ touch great/scott
|
57
|
+
ls :l, :a # $ ls -l -a
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
data/lib/rudy.rb
CHANGED
data/lib/rudy/routines.rb
CHANGED
@@ -80,13 +80,13 @@ module Rudy
|
|
80
80
|
}
|
81
81
|
|
82
82
|
|
83
|
-
lbox = Rye::Box.new('localhost', :info => false)
|
83
|
+
lbox = Rye::Box.new('localhost', :info => (@@global.verbose > 3), :debug => false)
|
84
84
|
sconf = fetch_script_config
|
85
85
|
|
86
86
|
enjoy_every_sandwich {
|
87
87
|
if Rudy::Routines::ScriptHelper.before_local?(routine) # before_local
|
88
88
|
# Runs "before_local" scripts of routines config.
|
89
|
-
|
89
|
+
task_separator("LOCAL SHELL")
|
90
90
|
lbox.cd Dir.pwd # Run local command block from current working directory
|
91
91
|
Rudy::Routines::ScriptHelper.before_local(routine, sconf, lbox, @option, @argv)
|
92
92
|
end
|
@@ -96,7 +96,7 @@ module Rudy
|
|
96
96
|
if Rudy::Routines::ScriptHelper.script_local?(routine) # script_local
|
97
97
|
# Runs "script_local" scripts of routines config.
|
98
98
|
# NOTE: This is synonymous with before_local
|
99
|
-
|
99
|
+
task_separator("LOCAL SHELL")
|
100
100
|
lbox.cd Dir.pwd # Run local command block from current working directory
|
101
101
|
Rudy::Routines::ScriptHelper.script_local(routine, sconf, lbox, @option, @argv)
|
102
102
|
end
|
@@ -186,28 +186,28 @@ module Rudy
|
|
186
186
|
|
187
187
|
enjoy_every_sandwich {
|
188
188
|
if Rudy::Routines::UserHelper.adduser?(routine) # adduser
|
189
|
-
|
189
|
+
task_separator("ADD USER")
|
190
190
|
Rudy::Routines::UserHelper.adduser(routine, machine, rbox)
|
191
191
|
end
|
192
192
|
}
|
193
193
|
|
194
194
|
enjoy_every_sandwich {
|
195
195
|
if Rudy::Routines::UserHelper.authorize?(routine) # authorize
|
196
|
-
|
196
|
+
task_separator("AUTHORIZE USER")
|
197
197
|
Rudy::Routines::UserHelper.authorize(routine, machine, rbox)
|
198
198
|
end
|
199
199
|
}
|
200
200
|
|
201
201
|
enjoy_every_sandwich {
|
202
202
|
if Rudy::Routines::ScriptHelper.before?(routine) # before
|
203
|
-
|
203
|
+
task_separator("REMOTE SHELL")
|
204
204
|
Rudy::Routines::ScriptHelper.before(routine, sconf, machine, rbox, @option, @argv)
|
205
205
|
end
|
206
206
|
}
|
207
207
|
|
208
208
|
enjoy_every_sandwich {
|
209
209
|
if Rudy::Routines::DiskHelper.disks?(routine) # disk
|
210
|
-
|
210
|
+
task_separator("DISKS")
|
211
211
|
if rbox.ostype == "sunos"
|
212
212
|
puts "Sorry, Solaris disks are not supported yet!"
|
213
213
|
else
|
@@ -234,7 +234,7 @@ module Rudy
|
|
234
234
|
# both be executed.
|
235
235
|
enjoy_every_sandwich {
|
236
236
|
if Rudy::Routines::ScriptHelper.script?(routine) # script
|
237
|
-
|
237
|
+
task_separator("REMOTE SHELL")
|
238
238
|
# Runs "after" scripts of routines config
|
239
239
|
Rudy::Routines::ScriptHelper.script(routine, sconf, machine, rbox, @option, @argv)
|
240
240
|
end
|
@@ -242,7 +242,7 @@ module Rudy
|
|
242
242
|
|
243
243
|
enjoy_every_sandwich {
|
244
244
|
if Rudy::Routines::ScriptHelper.after?(routine) # after
|
245
|
-
|
245
|
+
task_separator("REMOTE SHELL")
|
246
246
|
# Runs "after" scripts of routines config
|
247
247
|
Rudy::Routines::ScriptHelper.after(routine, sconf, machine, rbox, @option, @argv)
|
248
248
|
end
|
@@ -254,7 +254,7 @@ module Rudy
|
|
254
254
|
|
255
255
|
enjoy_every_sandwich {
|
256
256
|
if Rudy::Routines::ScriptHelper.after_local?(routine) # after_local
|
257
|
-
|
257
|
+
task_separator("LOCAL SHELL")
|
258
258
|
lbox.cd Dir.pwd # Run local command block from current working directory
|
259
259
|
# Runs "after_local" scripts of routines config
|
260
260
|
Rudy::Routines::ScriptHelper.after_local(routine, sconf, lbox, @option, @argv)
|
@@ -273,7 +273,7 @@ module Rudy
|
|
273
273
|
return unless depends
|
274
274
|
unless depends.empty?
|
275
275
|
depends.each_with_index do |d, index|
|
276
|
-
|
276
|
+
task_separator("DEPENDENCY: #{d}")
|
277
277
|
routine_dependency = fetch_routine_config(d)
|
278
278
|
unless routine_dependency
|
279
279
|
STDERR.puts " Unknown routine: #{d}".color(:red)
|
@@ -316,7 +316,7 @@ module Rudy
|
|
316
316
|
def task_separator(title)
|
317
317
|
dashes = 59 - title.size
|
318
318
|
dashes = 0 if dashes < 1
|
319
|
-
("%s--- %s %s" % [$/, title, '-'*dashes])
|
319
|
+
puts ("%s--- %s %s" % [$/, title, '-'*dashes]) if @@global.verbose > 2
|
320
320
|
end
|
321
321
|
|
322
322
|
def machine_separator(name, awsid)
|
@@ -337,7 +337,14 @@ module Rudy
|
|
337
337
|
rescue => ex
|
338
338
|
STDERR.puts " Error: #{ex.message}".color(:red)
|
339
339
|
STDERR.puts ex.backtrace if Rudy.debug?
|
340
|
-
|
340
|
+
choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
|
341
|
+
if choice.match(/\AS/i)
|
342
|
+
return
|
343
|
+
elsif choice.match(/\AR/i)
|
344
|
+
retry
|
345
|
+
else
|
346
|
+
exit 12
|
347
|
+
end
|
341
348
|
rescue Interrupt
|
342
349
|
puts "Aborting..."
|
343
350
|
exit 12
|
@@ -345,10 +352,6 @@ module Rudy
|
|
345
352
|
ret
|
346
353
|
end
|
347
354
|
|
348
|
-
def keep_going?
|
349
|
-
Annoy.pose_question(" Keep going?\a ", /yes|y|ya|sure|you bet!/i, STDOUT)
|
350
|
-
end
|
351
|
-
|
352
355
|
end
|
353
356
|
end
|
354
357
|
end
|
data/lib/rudy/routines/helper.rb
CHANGED
@@ -13,14 +13,35 @@ module Rudy
|
|
13
13
|
print_response(ret)
|
14
14
|
rescue IOError => ex
|
15
15
|
STDERR.puts " Connection Error (#{ex.message})".color(:red)
|
16
|
-
|
16
|
+
choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
|
17
|
+
if choice.match(/\AS/i)
|
18
|
+
return
|
19
|
+
elsif choice.match(/\AR/i)
|
20
|
+
retry
|
21
|
+
else
|
22
|
+
exit 12
|
23
|
+
end
|
17
24
|
rescue Rye::CommandError => ex
|
18
25
|
print_response(ex)
|
19
|
-
|
26
|
+
choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
|
27
|
+
if choice.match(/\AS/i)
|
28
|
+
return
|
29
|
+
elsif choice.match(/\AR/i)
|
30
|
+
retry
|
31
|
+
else
|
32
|
+
exit 12
|
33
|
+
end
|
20
34
|
rescue Rye::CommandNotFound => ex
|
21
35
|
STDERR.puts " CommandNotFound: #{ex.message}".color(:red)
|
22
36
|
STDERR.puts ex.backtrace if Rudy.debug?
|
23
|
-
|
37
|
+
choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
|
38
|
+
if choice.match(/\AS/i)
|
39
|
+
return
|
40
|
+
elsif choice.match(/\AR/i)
|
41
|
+
retry
|
42
|
+
else
|
43
|
+
exit 12
|
44
|
+
end
|
24
45
|
end
|
25
46
|
|
26
47
|
ret
|
@@ -35,7 +56,7 @@ module Rudy
|
|
35
56
|
cmd ||= ""
|
36
57
|
cmd, user = cmd.to_s, user.to_s
|
37
58
|
prompt = user == "root" ? "#" : "$"
|
38
|
-
("%s
|
59
|
+
("%s@%s%s %s" % [user, host, prompt, cmd.bright])
|
39
60
|
end
|
40
61
|
|
41
62
|
private
|
@@ -76,7 +76,12 @@ module Rudy; module Routines;
|
|
76
76
|
return false unless hasconf
|
77
77
|
unless routine[timing].kind_of?(Hash)
|
78
78
|
STDERR.puts "No user supplied for #{timing} block".color(:red)
|
79
|
-
|
79
|
+
choice = Annoy.get_user_input('(S)kip (A)bort: ')
|
80
|
+
if choice.match(/\AS/i)
|
81
|
+
return
|
82
|
+
else
|
83
|
+
exit 12
|
84
|
+
end
|
80
85
|
return false
|
81
86
|
end
|
82
87
|
routine[timing].each_pair do |user,proc|
|
@@ -101,7 +106,7 @@ module Rudy; module Routines;
|
|
101
106
|
|
102
107
|
# The config file that gets created on each remote machine
|
103
108
|
# will be created in the user's home directory.
|
104
|
-
script_config_remote_path = File.join(rbox.getenv['HOME'], @@script_config_file_name)
|
109
|
+
script_config_remote_path = File.join(rbox.getenv['HOME'] || '', @@script_config_file_name)
|
105
110
|
|
106
111
|
if sconf && !sconf.empty?
|
107
112
|
tf = Tempfile.new(@@script_config_file_name)
|
@@ -169,16 +174,31 @@ module Rudy; module Routines;
|
|
169
174
|
### EXECUTE THE COMMANDS BLOCK
|
170
175
|
rbox.batch(option, argv, &proc)
|
171
176
|
|
172
|
-
rbox.pre_command_hook = nil
|
173
|
-
rbox.post_command_hook = nil
|
174
|
-
|
175
177
|
rescue Rye::CommandError => ex
|
176
178
|
print_response(ex)
|
177
|
-
|
179
|
+
choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
|
180
|
+
if choice.match(/\AS/i)
|
181
|
+
return
|
182
|
+
elsif choice.match(/\AR/i)
|
183
|
+
retry
|
184
|
+
else
|
185
|
+
exit 12
|
186
|
+
end
|
178
187
|
rescue Rye::CommandNotFound => ex
|
179
188
|
STDERR.puts " CommandNotFound: #{ex.message}".color(:red)
|
180
189
|
STDERR.puts ex.backtrace if Rudy.debug?
|
181
|
-
|
190
|
+
choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
|
191
|
+
if choice.match(/\AS/i)
|
192
|
+
return
|
193
|
+
elsif choice.match(/\AR/i)
|
194
|
+
retry
|
195
|
+
else
|
196
|
+
exit 12
|
197
|
+
end
|
198
|
+
ensure
|
199
|
+
rbox.pre_command_hook = nil
|
200
|
+
rbox.post_command_hook = nil
|
201
|
+
rbox.enable_safe_mode # In case it was disabled
|
182
202
|
end
|
183
203
|
|
184
204
|
rbox.cd # reset to home dir
|
data/lib/rudy/routines/reboot.rb
CHANGED
data/rudy.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "rudy"
|
3
3
|
s.rubyforge_project = 'rudy'
|
4
|
-
s.version = "0.8.
|
4
|
+
s.version = "0.8.3"
|
5
5
|
s.summary = "Rudy: Not your grandparents' EC2 deployment tool."
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
@@ -16,12 +16,11 @@
|
|
16
16
|
|
17
17
|
s.add_dependency 'drydock', '>= 0.6.3'
|
18
18
|
s.add_dependency 'caesars', '>= 0.6.8'
|
19
|
-
s.add_dependency 'rye', '>= 0.7.
|
19
|
+
s.add_dependency 'rye', '>= 0.7.3'
|
20
20
|
s.add_dependency 'sysinfo', '>= 0.5.1'
|
21
21
|
s.add_dependency 'storable', '>= 0.5.2'
|
22
|
-
s.add_dependency 'annoy', '>= 0.5.
|
22
|
+
s.add_dependency 'annoy', '>= 0.5.1'
|
23
23
|
|
24
|
-
s.add_dependency 'grit'
|
25
24
|
s.add_dependency 'echoe'
|
26
25
|
s.add_dependency 'amazon-ec2', '>= 0.3.8' # Region fix
|
27
26
|
s.add_dependency 'aws-s3', '>= 0.6.1' # Ruby 1.9.1 compatability
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-03 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.7.
|
43
|
+
version: 0.7.3
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: sysinfo
|
@@ -70,17 +70,7 @@ dependencies:
|
|
70
70
|
requirements:
|
71
71
|
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 0.5.
|
74
|
-
version:
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: grit
|
77
|
-
type: :runtime
|
78
|
-
version_requirement:
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: "0"
|
73
|
+
version: 0.5.1
|
84
74
|
version:
|
85
75
|
- !ruby/object:Gem::Dependency
|
86
76
|
name: echoe
|